zhangshuyan0 commented on code in PR #5825:
URL: https://github.com/apache/hadoop/pull/5825#discussion_r1348520619
##########
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DirectoryScanner.java:
##########
@@ -777,4 +793,29 @@ private void accumulateTimeWaiting() {
perfTimer.reset().start();
}
}
+
+ /**
+ * Trigger an instant run of directory scanner if it's not running currently.
+ * @return
+ */
+ public String triggerDirectoryScanner() throws IOException {
+ if (reconcileRunning.get()) {
Review Comment:
Just as mentioned above.
##########
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DirectoryScanner.java:
##########
@@ -404,6 +407,11 @@ public void run() {
"This cycle terminating immediately because 'shouldRun' has been
deactivated");
return;
}
+ if (reconcileRunning.get()) {
Review Comment:
Using the `reconcileRunning` variable in this way cannot prevent two threads
from executing `reconcile()` at the same time. When this thread is running
after line410 and before line416, another thread may set `reconcileRunning` to
true.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]