-
Notifications
You must be signed in to change notification settings - Fork 9.1k
HADOOP-19280. [ABFS] Initialize client timer only if metric collection is enabled #7061
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HADOOP-19280. [ABFS] Initialize client timer only if metric collection is enabled #7061
Conversation
@anujmodi2021 @anmolanmol1234 Please review the PR. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
boolean isTimerThreadPresent = isThreadRunning("abfs-timer-client"); | ||
|
||
// Check if a thread with the name "abfs-timer-client" exists | ||
assertFalse("Unexpected thread 'abfs-timer-client' found", isTimerThreadPresent); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use assertions.assertThat
...tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/services/ITestAbfsClient.java
Outdated
Show resolved
Hide resolved
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
…stAbfsClient class
HNS-OAuth[ERROR] testFileSystemCapabilities(org.apache.hadoop.fs.azurebfs.ITestFileSystemInitialization) Time elapsed: 0.402 s <<< FAILURE! [ERROR] testBackoffRetryMetrics(org.apache.hadoop.fs.azurebfs.services.TestAbfsRestOperation) Time elapsed: 1.597 s <<< ERROR! [ERROR] Tests run: 157, Failures: 0, Errors: 1, Skipped: 2 Test failures are known, and some are fixed in the below PRs. |
💔 -1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the patch.
Have added a few comments.
hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/AbfsClient.java
Outdated
Show resolved
Hide resolved
hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/AbfsClient.java
Outdated
Show resolved
Hide resolved
...-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/services/TestAbfsClient.java
Outdated
Show resolved
Hide resolved
🎊 +1 overall
This message was automatically generated. |
@mukund-thakur @steveloughran @saikatroy038 Could you please review the PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 LGTM
Thanks for taking my comments @bhattmanish98
The tests that you have are indeed the ones that are known and fixed/being fixed
Except the CheckAccess tests. Looks like they are failing due to some miss configuration on your end.
hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/AbfsClient.java
Outdated
Show resolved
Hide resolved
...-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/services/TestAbfsClient.java
Outdated
Show resolved
Hide resolved
...-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/services/TestAbfsClient.java
Outdated
Show resolved
Hide resolved
🎊 +1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Production code all good; some minor nits with the tests -I am thinking of whoever has to maintain them in future.
+1 pending those changes.
...-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/services/TestAbfsClient.java
Show resolved
Hide resolved
import static org.apache.hadoop.fs.azurebfs.constants.ConfigurationKeys.FS_AZURE_METRIC_FORMAT; | ||
import static org.apache.hadoop.fs.azurebfs.services.AbfsClient.ABFS_CLIENT_TIMER_THREAD_NAME; | ||
|
||
public class TestAbfsClient { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a little Java explaining what it is trying to test.
private static final long SLEEP_DURATION_MS = 500; | ||
|
||
@Test | ||
public void testTimerNotInitialize() throws Exception { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Add a comment stating that this verifies that's a timer is only created when metrics are being collected.
- Change the title of the method to something like
testTimerNotInitializedWithoutMetricCollection
} | ||
|
||
@Test | ||
public void testTimerInitialize() throws Exception { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Change the title of the method to something like
testTimerIsInitializedWithMetricCollection
...-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/services/TestAbfsClient.java
Show resolved
Hide resolved
🎊 +1 overall
This message was automatically generated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
+1
Manish, thank you! Please can you do a backport PR for branch-3.4; this is simply for testing rather than any more code reviews. |
@steveloughran Applogies for the delay. I have raised a PR (#7307) to backport these changes to branch-3.4. Thanks |
Description of PR
JIRA: https://issues.apache.org/jira/browse/HADOOP-19280
Current Flow: In the current flow, we are initializing the timer of the abfs-timer-client outside the metric collection enable check. As a result, for each file system, when the AbfsClient object is initialized, it spawns a thread to evaluate the time of the ABFS client. Since we are purging/closing the timer inside the metric collection check, these threads are not being closed, causing them to persist in a long-lived state.
Changes Made: This PR contains the changes related to moving the initialization of the timer inside the metric collection check. Also includes check on metric collection if we are accessing the timer variable to avoid the null pointer exception.
Created two test suites to check the behaviour of timer variable and thread spawn in case of metric collection enabled and disabled.