danny0405 commented on code in PR #11923:
URL: https://github.com/apache/hudi/pull/11923#discussion_r1843166640


##########
hudi-cli/src/main/java/org/apache/hudi/cli/commands/ExportCommand.java:
##########
@@ -194,9 +195,10 @@ private int copyNonArchivedInstants(List<HoodieInstant> 
instants, int limit, Str
     }
 
     final HoodieTableMetaClient metaClient = HoodieCLI.getTableMetaClient();
+    final InstantFileNameGenerator instantFileNameFactory = 
metaClient.getInstantFileNameGenerator();

Review Comment:
   instantFileNameGenerator



##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/BaseHoodieTableServiceClient.java:
##########
@@ -217,7 +225,8 @@ protected HoodieWriteMetadata<O> logCompact(String 
logCompactionInstantTime, boo
     }
 
     HoodieTimeline pendingLogCompactionTimeline = 
table.getActiveTimeline().filterPendingLogCompactionTimeline();
-    HoodieInstant inflightInstant = 
HoodieTimeline.getLogCompactionInflightInstant(logCompactionInstantTime);
+    InstantGenerator instantFactory = 
table.getMetaClient().getInstantGenerator();

Review Comment:
   instantGenerator



##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/transaction/DirectMarkerTransactionManager.java:
##########
@@ -85,7 +86,7 @@ private static TypedProperties createUpdatedLockProps(
     return props;
   }
 
-  private HoodieInstant getInstant(String instantTime) {
-    return new HoodieInstant(HoodieInstant.State.INFLIGHT, EMPTY_STRING, 
instantTime);
+  private HoodieInstant getInstant(String instantTime, InstantGenerator 
instantFactory) {

Review Comment:
   instantGenerator



##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/BaseHoodieTableServiceClient.java:
##########
@@ -292,7 +301,8 @@ public Option<String> scheduleCompaction(Option<Map<String, 
String>> extraMetada
   protected HoodieWriteMetadata<O> compact(String compactionInstantTime, 
boolean shouldComplete) {
     HoodieTable<?, I, ?, T> table = createTable(config, 
context.getStorageConf());
     HoodieTimeline pendingCompactionTimeline = 
table.getActiveTimeline().filterPendingCompactionTimeline();
-    HoodieInstant inflightInstant = 
HoodieTimeline.getCompactionInflightInstant(compactionInstantTime);
+    InstantGenerator instantFactory = 
table.getMetaClient().getInstantGenerator();

Review Comment:
   instantGenerator



##########
hudi-cli/src/main/java/org/apache/hudi/cli/commands/CompactionCommand.java:
##########
@@ -381,20 +382,21 @@ private HoodieCompactionPlan 
readCompactionPlanForArchivedTimeline(HoodieArchive
    */
   private HoodieCompactionPlan 
readCompactionPlanForActiveTimeline(HoodieActiveTimeline activeTimeline,
                                                                    
HoodieInstant instant) {
+    InstantGenerator instantFactory = 
HoodieCLI.getTableMetaClient().getInstantGenerator();

Review Comment:
   To fix this, I mean renaming `instantFactory` to `instantGenerator`



##########
hudi-cli/src/main/java/org/apache/hudi/cli/commands/StatsCommand.java:
##########
@@ -73,14 +74,15 @@ public String writeAmplificationStats(
 
     List<Comparable[]> rows = new ArrayList<>();
     DecimalFormat df = new DecimalFormat("#.00");
+    TimelineLayout layout = 
TimelineLayout.getLayout(timeline.getTimelineLayoutVersion());

Review Comment:
   getLayout -> fromVersionCode ?



##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/metadata/HoodieBackedTableMetadataWriter.java:
##########
@@ -1230,8 +1232,9 @@ public void update(HoodieRestoreMetadata restoreMetadata, 
String instantTime) {
     dataMetaClient.reloadActiveTimeline();
 
     // Fetch the commit to restore to (savepointed commit time)
-    HoodieInstant restoreInstant = new HoodieInstant(REQUESTED, 
HoodieTimeline.RESTORE_ACTION, instantTime);
-    HoodieInstant requested = 
HoodieTimeline.getRestoreRequestedInstant(restoreInstant);
+    InstantGenerator dataInstantFactory = dataMetaClient.getInstantGenerator();

Review Comment:
   instantGenerator



##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/BaseHoodieTableServiceClient.java:
##########
@@ -617,7 +633,9 @@ protected void runTableServicesInline(HoodieTable table, 
HoodieCommitMetadata me
   public Option<String> scheduleTableService(String instantTime, 
Option<Map<String, String>> extraMetadata,
                                              TableServiceType 
tableServiceType) {
     // A lock is required to guard against race conditions between an ongoing 
writer and scheduling a table service.
-    final Option<HoodieInstant> inflightInstant = Option.of(new 
HoodieInstant(HoodieInstant.State.REQUESTED,
+    HoodieTableConfig tableConfig = 
HoodieTableConfig.loadFromHoodieProps(storage, config.getBasePath());

Review Comment:
   So we still always read the table config now if we want to generate an 
instant.



##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/BaseHoodieTableServiceClient.java:
##########
@@ -325,7 +335,8 @@ protected void completeCompaction(HoodieCommitMetadata 
metadata, HoodieTable tab
     this.context.setJobStatus(this.getClass().getSimpleName(), "Collect 
compaction write status and commit compaction: " + config.getTableName());
     List<HoodieWriteStat> writeStats = metadata.getWriteStats();
     handleWriteErrors(writeStats, TableServiceType.COMPACT);
-    final HoodieInstant compactionInstant = 
HoodieTimeline.getCompactionInflightInstant(compactionCommitTime);
+    InstantGenerator instantFactory = 
table.getMetaClient().getInstantGenerator();

Review Comment:
   instantGenerator



##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/transaction/DirectMarkerTransactionManager.java:
##########
@@ -45,21 +46,21 @@ public DirectMarkerTransactionManager(HoodieWriteConfig 
config, HoodieStorage st
     this.filePath = partitionPath + "/" + fileId;
   }
 
-  public void beginTransaction(String newTxnOwnerInstantTime) {
+  public void beginTransaction(String newTxnOwnerInstantTime, InstantGenerator 
instantFactory) {
     if (isLockRequired) {
       LOG.info("Transaction starting for " + newTxnOwnerInstantTime + " and " 
+ filePath);
       lockManager.lock();
 
-      reset(currentTxnOwnerInstant, 
Option.of(getInstant(newTxnOwnerInstantTime)), Option.empty());
+      reset(currentTxnOwnerInstant, 
Option.of(getInstant(newTxnOwnerInstantTime, instantFactory)), Option.empty());
       LOG.info("Transaction started for " + newTxnOwnerInstantTime + " and " + 
filePath);
     }
   }
 
-  public void endTransaction(String currentTxnOwnerInstantTime) {
+  public void endTransaction(String currentTxnOwnerInstantTime, 
InstantGenerator instantFactory) {

Review Comment:
   instantGenerator



##########
hudi-cli/src/main/java/org/apache/hudi/cli/commands/CompactionCommand.java:
##########
@@ -124,9 +124,10 @@ public String compactionShow(
       throws Exception {
     HoodieTableMetaClient client = checkAndGetMetaClient();
     HoodieActiveTimeline activeTimeline = client.getActiveTimeline();
+    InstantGenerator instantFactory = client.getInstantGenerator();

Review Comment:
   instantGenerator



##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/transaction/DirectMarkerTransactionManager.java:
##########
@@ -45,21 +46,21 @@ public DirectMarkerTransactionManager(HoodieWriteConfig 
config, HoodieStorage st
     this.filePath = partitionPath + "/" + fileId;
   }
 
-  public void beginTransaction(String newTxnOwnerInstantTime) {
+  public void beginTransaction(String newTxnOwnerInstantTime, InstantGenerator 
instantFactory) {

Review Comment:
   instantGenerator



##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/CompactionAdminClient.java:
##########
@@ -107,21 +108,21 @@ public List<ValidationOpResult> 
validateCompactionPlan(HoodieTableMetaClient met
   public List<RenameOpResult> unscheduleCompactionPlan(String 
compactionInstant, boolean skipValidation,
       int parallelism, boolean dryRun) throws Exception {
     HoodieTableMetaClient metaClient = createMetaClient(false);
-
+    InstantFileNameGenerator instantFileNameFactory = 
metaClient.getInstantFileNameGenerator();

Review Comment:
   xxxGenerator



##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/BaseHoodieTableServiceClient.java:
##########
@@ -885,7 +904,9 @@ protected Map<String, Option<HoodiePendingRollbackInfo>> 
getPendingRollbackInfos
         String instantToRollback = 
rollbackPlan.getInstantToRollback().getCommitTime();
         if (ignoreCompactionAndClusteringInstants) {
           if (!HoodieTimeline.COMPACTION_ACTION.equals(action)) {
-            boolean isClustering = 
ClusteringUtils.isClusteringInstant(metaClient.getActiveTimeline(), new 
HoodieInstant(true, action, instantToRollback));
+            InstantGenerator instantFactory = metaClient.getInstantGenerator();

Review Comment:
   instantGenerator



##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/utils/LegacyArchivedMetaEntryReader.java:
##########
@@ -100,7 +100,8 @@ private Pair<HoodieInstant, Option<byte[]>> 
readInstant(GenericRecord record) {
       }
       return null;
     });
-    HoodieInstant instant = new 
HoodieInstant(HoodieInstant.State.valueOf(record.get(ACTION_STATE).toString()), 
action,
+    InstantGenerator instantFactory = metaClient.getInstantGenerator();

Review Comment:
   instantGenerator



##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/action/compact/CompactHelpers.java:
##########
@@ -63,8 +63,9 @@ public static CompactHelpers getInstance() {
   public HoodieCommitMetadata createCompactionMetadata(
       HoodieTable table, String compactionInstantTime, HoodieData<WriteStatus> 
writeStatuses,
       String schema) throws IOException {
+    InstantGenerator instantFactory = table.getInstantGenerator();

Review Comment:
   instantGenerator



##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/metadata/HoodieBackedTableMetadataWriter.java:
##########
@@ -956,14 +957,15 @@ public void dropMetadataPartitions(List<String> 
metadataPartitions) throws IOExc
    * if the partition path in the plan matches with the given partition path.
    */
   private static void deletePendingIndexingInstant(HoodieTableMetaClient 
metaClient, String partitionPath) {
+    InstantGenerator instantFactory = metaClient.getInstantGenerator();

Review Comment:
   instantGenerator



##########
hudi-client/hudi-flink-client/src/main/java/org/apache/hudi/table/action/compact/HoodieFlinkMergeOnReadTableCompactor.java:
##########
@@ -45,9 +46,10 @@ public class HoodieFlinkMergeOnReadTableCompactor<T>
   @Override
   public void preCompact(
       HoodieTable table, HoodieTimeline pendingCompactionTimeline, 
WriteOperationType operationType, String instantTime) {
+    InstantGenerator instantFactory = table.getInstantGenerator();

Review Comment:
   instantGenerator



##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/action/BaseActionExecutor.java:
##########
@@ -46,14 +49,19 @@ public abstract class BaseActionExecutor<T, I, K, O, R> 
implements Serializable
   protected final HoodieWriteConfig config;
 
   protected final HoodieTable<T, I, K, O> table;
-
+  protected final InstantGenerator instantGenerator;
+  protected final InstantFileNameParser instantFileNameParser;
+  protected final InstantFileNameGenerator instantFileNameFactory;
   protected final String instantTime;
 
   public BaseActionExecutor(HoodieEngineContext context, HoodieWriteConfig 
config, HoodieTable<T, I, K, O> table, String instantTime) {
     this.context = context;
     this.storageConf = context.getStorageConf();
     this.config = config;
     this.table = table;
+    this.instantGenerator = table.getInstantGenerator();
+    this.instantFileNameFactory = table.getInstantFileNameGenerator();

Review Comment:
   instantFileNameGenerator



##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/action/index/ScheduleIndexActionExecutor.java:
##########
@@ -89,6 +89,7 @@ public Option<HoodieIndexPlan> execute() {
     validateBeforeScheduling();
     // make sure that it is idempotent, check with previously pending index 
operations.
     Set<String> indexesInflightOrCompleted = 
getInflightAndCompletedMetadataPartitions(table.getMetaClient().getTableConfig());
+    InstantGenerator instantFactory = 
table.getMetaClient().getInstantGenerator();

Review Comment:
   instantGenerator



##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/marker/SimpleTransactionDirectMarkerBasedDetectionStrategy.java:
##########
@@ -48,17 +50,18 @@ public SimpleTransactionDirectMarkerBasedDetectionStrategy(
   public void detectAndResolveConflictIfNecessary() throws 
HoodieEarlyConflictDetectionException {
     DirectMarkerTransactionManager txnManager =
         new DirectMarkerTransactionManager((HoodieWriteConfig) config, 
storage, partitionPath, fileId);
+    InstantGenerator instantFactory = 
TimelineLayout.getLayout(activeTimeline.getTimelineLayoutVersion()).getInstantGenerator();

Review Comment:
   instantGenerator



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