-
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-17068. Datanode should record last directory scan time. #5809
Conversation
@ayushtkn @Hexiaoqiao . Hi, sir. Could you please help me review this PR when you have free time ? Thanks a lot~ |
🎊 +1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
/** | ||
* Returns the last time in milliseconds of directory scanner run. | ||
*/ | ||
public long getLastDirectoryScannerRunTime(); |
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.
This name will be little misleading if it is the begin or end time of one loop of DirectoryScanner.
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.
Sir. have changed to getLastDirectoryScannerFinishTime and other fields have also modified. Thanks for this review.
🎊 +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.
lgtm, with minor suggestions.
@@ -3811,5 +3818,10 @@ void stopAllDataxceiverThreads(FsVolumeImpl volume) { | |||
public List<FsVolumeImpl> getVolumeList() { | |||
return volumes.getVolumes(); | |||
} | |||
|
|||
@Override | |||
public void updateLastDirScannerFinishTime(long time) { |
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.
nit: can we rename to setLastDirScannerFinishTime
, following the getter/setter convention?
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.
@xinglin Sir, thanks for suggestions. Have changed.
|
||
beanClass.getNumBlocksFailedToUncache()) | ||
.addGauge(Interns.info("LastDirectoryScannerFinishTime", | ||
"Last finish time of directory scanner"), |
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.
"Last finish time of directory scanner" -> "Finish time of the last directory scan".
I would actually prefer "most recent" over "last", but fine with "last".
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.
@xinglin Sir, Thanks a lot for reviewing. modify "Last finish time of directory scanner" -> "Finish time of the last directory scan". "last" reserved.
🎊 +1 overall
This message was automatically generated. |
eb1a7bb
to
10a223d
Compare
@@ -477,4 +482,7 @@ public MountVolumeMap getMountVolumeMap() { | |||
public List<FsVolumeImpl> getVolumeList() { | |||
return null; | |||
} | |||
|
|||
@Override | |||
public void setLastDirScannerFinishTime(long time) {} |
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.
Is there a reason that in one test case, we throw an unsupported exception while in this test class, it is a no-op? can we make both behave the same way?
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.
@xinglin Hi, sir. I do not know why exacltly, but i think the SimulatedFSDataset is just for simplifing test. if we make both behave the same way, there is no need to have class SimulatedFSDataset. What's your idea?Thanks a lot.
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, I am also confused why this behavior is different with ExternalDatasetImpl#setLastDirScannerFinishTime.
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
947e1c4
to
9333981
Compare
🎊 +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.
Leave some comments inline, JFYI. Please also check the checkstyle report by Yetus if relate with this PR. Thanks.
...hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/FsDatasetSpi.java
Outdated
Show resolved
Hide resolved
...-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java
Show resolved
Hide resolved
@@ -477,4 +482,7 @@ public MountVolumeMap getMountVolumeMap() { | |||
public List<FsVolumeImpl> getVolumeList() { | |||
return null; | |||
} | |||
|
|||
@Override | |||
public void setLastDirScannerFinishTime(long time) {} |
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, I am also confused why this behavior is different with ExternalDatasetImpl#setLastDirScannerFinishTime.
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. No need to enforce the same implementation between SimulatedFSDataset.java
and ExternalDatasetImpl.java
.
@@ -53,6 +53,7 @@ public class ExternalDatasetImpl implements FsDatasetSpi<ExternalVolumeImpl> { | |||
private final DatanodeStorage storage = new DatanodeStorage( | |||
DatanodeStorage.generateUuid(), DatanodeStorage.State.NORMAL, | |||
StorageType.DEFAULT); | |||
private long lastDirScannerFinishTime; |
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.
A lot of functions in this class are not implemented. I think we should following the same pattern here.
getLastDirScannerFinishTime() -> return 0.
setLastDirScannerFinishTime() -> do nothing.
Below are functions related with Trash.
@Override
public void enableTrash(String bpid) {
}
@Override
public void clearTrash(String bpid) {
}
@Override
public boolean trashEnabled(String bpid) {
return false;
}
SimulatedFSDataset.java
has a different implementation for enableTrash(). So, I guess we don't have to enforce the same implementation between SimulatedFSDataset
and ExternalDatasetImpl
. I am fine with the current change.
@Override
public void enableTrash(String bpid) {
throw new UnsupportedOperationException();
}
cc @Hexiaoqiao
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.
sorry, I should have requested a change instead.
💔 -1 overall
This message was automatically generated. |
2b1902e
to
244f7d8
Compare
💔 -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.
Makes sense, minor comments, need to extend a basic test, which can be just validate the last dir scan time is getting set, it isn't 0, and may be even not same as the time before we triggered director scanner
...oject/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DirectoryScanner.java
Outdated
Show resolved
Hide resolved
...hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/FsDatasetSpi.java
Outdated
Show resolved
Hide resolved
...hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/metrics/FSDatasetMBean.java
Outdated
Show resolved
Hide resolved
...dfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/extdataset/ExternalDatasetImpl.java
Outdated
Show resolved
Hide resolved
...dfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/extdataset/ExternalDatasetImpl.java
Outdated
Show resolved
Hide resolved
🎊 +1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
0e26dfd
to
4354b94
Compare
...s/src/test/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/TestFsDatasetImpl.java
Show resolved
Hide resolved
💔 -1 overall
This message was automatically generated. |
9111da7
to
b61bb60
Compare
💔 -1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
...t/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestDirectoryScanner.java
Outdated
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
@Hexiaoqiao any further comments, planning to hold for you a couple of days |
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 from my side.
…5809). Contributed by farmmamba. Reviewed-by: He Xiaoqiao <hexiaoqiao@apache.org> Signed-off-by: Ayush Saxena <ayushsaxena@apache.org>
Description of PR
please see HDFS-17068.