You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by GitBox <gi...@apache.org> on 2019/11/07 18:51:21 UTC

[GitHub] [incubator-hudi] bvaradar commented on a change in pull request #996: Fixes to ensure MOR incr pull provides consistent results

bvaradar commented on a change in pull request #996: Fixes to ensure MOR incr pull provides consistent results
URL: https://github.com/apache/incubator-hudi/pull/996#discussion_r343815022
 
 

 ##########
 File path: hudi-common/src/main/java/org/apache/hudi/common/table/timeline/HoodieActiveTimeline.java
 ##########
 @@ -58,19 +59,28 @@
 
   public static final SimpleDateFormat COMMIT_FORMATTER = new SimpleDateFormat("yyyyMMddHHmmss");
 
-  public static final Set<String> VALID_EXTENSIONS_IN_ACTIVE_TIMELINE = new HashSet<>(Arrays.asList(new String[] {
+  public static final Set<String> VALID_EXTENSIONS_IN_ACTIVE_TIMELINE = new HashSet<>(Arrays.asList(new String[]{
       COMMIT_EXTENSION, INFLIGHT_COMMIT_EXTENSION, DELTA_COMMIT_EXTENSION, INFLIGHT_DELTA_COMMIT_EXTENSION,
       SAVEPOINT_EXTENSION, INFLIGHT_SAVEPOINT_EXTENSION, CLEAN_EXTENSION, INFLIGHT_CLEAN_EXTENSION,
       INFLIGHT_COMPACTION_EXTENSION, REQUESTED_COMPACTION_EXTENSION, INFLIGHT_RESTORE_EXTENSION, RESTORE_EXTENSION}));
 
   private static final transient Logger log = LogManager.getLogger(HoodieActiveTimeline.class);
   protected HoodieTableMetaClient metaClient;
+  private static AtomicReference<String> lastInstantTime = new AtomicReference<>();
 
   /**
    * Returns next commit time in the {@link #COMMIT_FORMATTER} format.
+   * Ensures each commit time is atleast 1 second apart since we create COMMIT times at second granularity
    */
   public static String createNewCommitTime() {
-    return HoodieActiveTimeline.COMMIT_FORMATTER.format(new Date());
+    lastInstantTime.updateAndGet((oldVal) -> {
 
 Review comment:
   Along with this change, can we also make commit timestamp millisec granularity ? High level, don't see any backwards compatibility moving to lower granularity as long as all commit timestamps (for all actions) uses same granularity ? 

----------------------------------------------------------------
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