-
Notifications
You must be signed in to change notification settings - Fork 8.9k
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
HDFS-16457.Make fs.getspaceused.classname reconfigurable #4069
Conversation
💔 -1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
Hello @jojochuang @ferhui @tasanuma @goiri,PTAL.Thanks a lot. |
🎊 +1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
The failed check has nothing to do with my changes, the last check passed. @jojochuang ,As can be seen from the generated log, my ut passed. |
Can you review my code, thanks a lot. @jojochuang |
Thanks for working on this, @singer-bin. I'd like to review your PR after #3863. I hope you will rebase this PR after merging #3863. |
@tasanuma Thanks for your comment, I will. |
I merged #3863 just now. |
💔 -1 overall
This message was automatically generated. |
@tasanuma Hello, in the method startDFCluster, I set it as follows: |
@Test | ||
public void testDfsUsageKlass() throws IOException, ReconfigurationException, | ||
InterruptedException { | ||
|
||
long lastCounter = counter; | ||
Thread.sleep(5000); | ||
assertTrue(counter > lastCounter); | ||
|
||
for (int i = 0; i < NUM_DATA_NODE; i++) { | ||
DataNode dn = cluster.getDataNodes().get(i); | ||
dn.reconfigurePropertyImpl(FS_GETSPACEUSED_CLASSNAME, null); | ||
} | ||
|
||
lastCounter = counter; | ||
Thread.sleep(5000); | ||
assertEquals(lastCounter, counter); | ||
} |
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.
@singer-bin Thanks for updating the PR.
How about we stop using conf.setClass
in startDFCluster
, and reconfigure DummyCachingGetSpaceUsed
in the unit test, and replace the order of the assertions? (But after this change, somehow the unit test failed.)
@Test | |
public void testDfsUsageKlass() throws IOException, ReconfigurationException, | |
InterruptedException { | |
long lastCounter = counter; | |
Thread.sleep(5000); | |
assertTrue(counter > lastCounter); | |
for (int i = 0; i < NUM_DATA_NODE; i++) { | |
DataNode dn = cluster.getDataNodes().get(i); | |
dn.reconfigurePropertyImpl(FS_GETSPACEUSED_CLASSNAME, null); | |
} | |
lastCounter = counter; | |
Thread.sleep(5000); | |
assertEquals(lastCounter, counter); | |
} | |
@Test | |
public void testDfsUsageKlass() throws IOException, ReconfigurationException, | |
InterruptedException { | |
long lastCounter = counter; | |
Thread.sleep(5000); | |
assertEquals(lastCounter, counter); | |
for (int i = 0; i < NUM_DATA_NODE; i++) { | |
DataNode dn = cluster.getDataNodes().get(i); | |
dn.reconfigurePropertyImpl(FS_GETSPACEUSED_CLASSNAME, DummyCachingGetSpaceUsed.class.getName()); | |
} | |
lastCounter = counter; | |
Thread.sleep(5000); | |
assertTrue(counter > lastCounter); | |
} |
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.
Hi, thanks for your comment. My UT ideas come from HDFS-15120 ,you can take a look to help understand. My conf comes from the getNewConf() method as follows:
private void reconfSpaceUsedKlass(){
List<FsVolumeImpl> volumeList = data.getVolumeList();
for (FsVolumeImpl fsVolume : volumeList) {
Map<String, BlockPoolSlice> blockPoolSlices = fsVolume.getBlockPoolSlices();
for (BlockPoolSlice bp : blockPoolSlices.values()) {
try {
bp.refreshSpaceUsedKlass(getNewConf());
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
so , passing in DummyCachingGetSpaceUsed.class.toString()
in
dn.reconfigurePropertyImpl(FS_GETSPACEUSED_CLASSNAME, DummyCachingGetSpaceUsed.class.toString());
doesn't make sense to me.
I need to set it to my own custom class when the service starts, then wait for the counter to change, and then use dn.reconfigurePropertyImpl(FS_GETSPACEUSED_CLASSNAME, null);
to refresh the value to the default,and then the counter is not changing.
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.
Looking forward to your comments and suggestions. @tasanuma
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.
- As well as other reconfiguring properties of DataNode, I prefer to be able to update parameters by calling
reconf.. .Parameters(property, newVal)
. - I think this PR is similar to HDFS-16413. Reconfig dfs usage parameters for datanode #3863. Instead of creating the new method of
reconfSpaceUsedKlass()
, how about extendingreconfDfsUsageParameters
to updatefs.getspaceused.classname
?
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.
Thank you very much for your comment, I will consider it. @tasanuma
💔 -1 overall
This message was automatically generated. |
Class<? extends GetSpaceUsed> klass = (newVal == null ? DU.class : | ||
Class.forName(newVal).asSubclass(GetSpaceUsed.class)); |
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.
@singer-bin Thanks for updating the PR.
We may need to use WindowsGetSpaceUsed.class
if it is windows os.
hadoop/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/GetSpaceUsed.java
Lines 79 to 83 in 4ef1d3e
if (Shell.WINDOWS) { | |
result = WindowsGetSpaceUsed.class; | |
} else { | |
result = DU.class; | |
} |
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.
Thank you very much for your review, I will revise it right away. @tasanuma
🎊 +1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
I ran it several times, and the error has nothing to do with my code. Can you help me, thank you. @tasanuma |
@singer-bin It almost looks good to me. But, I have one more request. Please arrange the order of the import sentences alphabetically as much as possible. If you use IntelliJ, it will do it by pressing Alt + Enter key. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
Hello, thank you for your reminder, I have completed the revision, can you take a look at it again? @tasanuma |
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.
The failed tests seem not to be related. +1.
Merged it. Thanks for your contribution, @singer-bin! |
@singer-bin Could you create the same PR for branch-3.3? There are some conflicts. |
@tasanuma Ok, I'll try to commit to 3.3, thanks for the review and merge. |
JIRA: HDFS-16457.
Make fs.getspaceused.classname reconfigurable