zhangyue19921010 commented on code in PR #8772:
URL: https://github.com/apache/hudi/pull/8772#discussion_r1199757261


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/metadata/HoodieBackedTableMetadataWriter.java:
##########
@@ -822,6 +825,21 @@ private static void 
deletePendingIndexingInstant(HoodieTableMetaClient metaClien
         });
   }
 
+  private static void checkNumDeltaCommits(HoodieTableMetaClient metaClient, 
int maxNumDeltaCommitsWhenPending) {
+    final HoodieActiveTimeline activeTimeline = 
metaClient.reloadActiveTimeline();
+    Option<HoodieInstant> lastCompaction = 
activeTimeline.filterCompletedInstants()
+        .filter(s -> s.getAction().equals(COMPACTION_ACTION)).lastInstant();
+    int numDeltaCommits = lastCompaction.isPresent()
+        ? 
activeTimeline.getDeltaCommitTimeline().findInstantsAfter(lastCompaction.get().getTimestamp()).countInstants()
+        : activeTimeline.getDeltaCommitTimeline().countInstants();
+    if (numDeltaCommits > maxNumDeltaCommitsWhenPending) {
+      throw new HoodieMetadataException(String.format("Metadata table's 
deltacommits exceeded %d: "
+              + "this is likely caused by a pending instant in the data table. 
Resolve the pending instant "
+              + "or adjust `%s`, the restart the pipeline.",

Review Comment:
   nit: `the restart the pipeline. => then restart the pipeline`



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

Reply via email to