You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drill.apache.org by GitBox <gi...@apache.org> on 2019/03/20 23:26:31 UTC

[GitHub] [drill] amansinha100 commented on a change in pull request #1707: DRILL-7125: REFRESH TABLE METADATA fails after upgrade from Drill 1.1…

amansinha100 commented on a change in pull request #1707: DRILL-7125: REFRESH TABLE METADATA fails after upgrade from Drill 1.1…
URL: https://github.com/apache/drill/pull/1707#discussion_r267585160
 
 

 ##########
 File path: exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/metadata/Metadata.java
 ##########
 @@ -675,32 +699,28 @@ private boolean tableModified(List<Path> directories, Path metaFilePath, Path pa
     FileStatus directoryStatus = fs.getFileStatus(parentDir);
     int numDirs = 1;
     if (directoryStatus.getModificationTime() > metaFileModifyTime) {
-      if (timer != null) {
-        logger.debug("Directory {} was modified. Took {} ms to check modification time of {} directories",
-            directoryStatus.getPath().toString(), timer.elapsed(TimeUnit.MILLISECONDS), numDirs);
-        timer.stop();
-      }
-      return true;
+      return logAndStopTimer(true, timer, numDirs);
     }
+    boolean isModified = false;
     for (Path directory : directories) {
       numDirs++;
       metaContext.setStatus(directory);
       directoryStatus = fs.getFileStatus(directory);
       if (directoryStatus.getModificationTime() > metaFileModifyTime) {
-        if (timer != null) {
-          logger.debug("Directory {} was modified. Took {} ms to check modification time of {} directories",
-              directoryStatus.getPath().toString(), timer.elapsed(TimeUnit.MILLISECONDS), numDirs);
-          timer.stop();
-        }
-        return true;
+        isModified = true;
+        break;
       }
     }
+    return logAndStopTimer(isModified, timer, numDirs);
+  }
+
+  private boolean logAndStopTimer(boolean isModified, Stopwatch timer, int numDirectories) {
     if (timer != null) {
-      logger.debug("No directories were modified. Took {} ms to check modification time of {} directories",
-          timer.elapsed(TimeUnit.MILLISECONDS), numDirs);
+      logger.debug("Directory {} was modified. Took {} ms to check modification time of {} directories",
+        isModified, timer.elapsed(TimeUnit.MILLISECONDS), numDirectories);
 
 Review comment:
   It is actually useful to have a log message even for the case when no directories were modified..that way we can account for the elapsed time.  You can preserve the prior log message conditional based on the `isModified` flag. 

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services