prashantwason commented on code in PR #8837:
URL: https://github.com/apache/hudi/pull/8837#discussion_r1213473799


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/metadata/HoodieBackedTableMetadataWriter.java:
##########
@@ -837,10 +840,75 @@ public void update(HoodieCleanMetadata cleanMetadata, 
String instantTime) {
    */
   @Override
   public void update(HoodieRestoreMetadata restoreMetadata, String 
instantTime) {
-    processAndCommit(instantTime, () -> 
HoodieTableMetadataUtil.convertMetadataToRecords(engineContext,
-        metadataMetaClient.getActiveTimeline(), restoreMetadata, 
getRecordsGenerationParams(), instantTime,
-        metadata.getSyncedInstantTime()), false);
-    closeInternal();
+    dataMetaClient.reloadActiveTimeline();
+
+    // Since the restore has completed on the dataset, the latest write 
timeline instant is the one to which the
+    // restore was performed. This should be always present.
+    final String restoreToInstantTime = 
dataMetaClient.getActiveTimeline().getWriteTimeline()
+        .getReverseOrderedInstants().findFirst().get().getTimestamp();
+
+    // We cannot restore to before the oldest compaction on MDT as we don't 
have the basefiles before that time.
+    Option<HoodieInstant> lastCompaction = 
metadataMetaClient.getCommitTimeline().filterCompletedInstants().lastInstant();

Review Comment:
   Yes, the BaseHoodieWriteClient also has this check. It is duplicated as we 
allow update() methods on the MDT to be called from outside. Its safer this way 
I suppose though duplicated.



-- 
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: commits-unsubscr...@hudi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to