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


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/metadata/HoodieBackedTableMetadataWriter.java:
##########
@@ -147,84 +156,55 @@ protected <T extends SpecificRecordBase> 
HoodieBackedTableMetadataWriter(Configu
     this.metrics = Option.empty();
     this.enabledPartitionTypes = new ArrayList<>();
 
-    if (writeConfig.isMetadataTableEnabled()) {
-      this.tableName = writeConfig.getTableName() + METADATA_TABLE_NAME_SUFFIX;
-      this.metadataWriteConfig = createMetadataWriteConfig(writeConfig, 
failedWritesCleaningPolicy);
-      enabled = true;
-
-      // Inline compaction and auto clean is required as we do not expose this 
table outside
-      ValidationUtils.checkArgument(!this.metadataWriteConfig.isAutoClean(),
-          "Cleaning is controlled internally for Metadata table.");
-      
ValidationUtils.checkArgument(!this.metadataWriteConfig.inlineCompactionEnabled(),
-          "Compaction is controlled internally for metadata table.");
-      // Auto commit is required
-      
ValidationUtils.checkArgument(this.metadataWriteConfig.shouldAutoCommit(),
-          "Auto commit is required for Metadata Table");
-      
ValidationUtils.checkArgument(this.metadataWriteConfig.getWriteStatusClassName().equals(FailOnFirstErrorWriteStatus.class.getName()),
-          "MDT should use " + FailOnFirstErrorWriteStatus.class.getName());
-      // Metadata Table cannot have metadata listing turned on. (infinite 
loop, much?)
-      
ValidationUtils.checkArgument(!this.metadataWriteConfig.isMetadataTableEnabled(),
-          "File listing cannot be used for Metadata Table");
-
-      this.dataMetaClient =
-          
HoodieTableMetaClient.builder().setConf(hadoopConf).setBasePath(dataWriteConfig.getBasePath()).build();
-      enablePartitions();
-      initRegistry();
-      initialize(engineContext, actionMetadata, inflightInstantTimestamp);
-      initTableMetadata();
-    } else {
-      enabled = false;
+    this.dataMetaClient = 
HoodieTableMetaClient.builder().setConf(hadoopConf).setBasePath(dataWriteConfig.getBasePath()).build();
+
+    if (dataMetaClient.getTableConfig().isMetadataTableEnabled() || 
writeConfig.isMetadataTableEnabled()) {

Review Comment:
   We would like to disable deletion of MDT from configs as it can cause 
accidental issues in production. MDT partitions like record index may takes 
hours to build so deletions should always be through manual intervention or 
planned. 
   Also, if the config disables an index for one commit and enables it again 
then the indexes will be out of sync and need to be re-created (as we have sync 
commit to MDT).
   
   There are two solutions here:
   1. Automatically delete the MDT if the config is disabled and then 
re-bootstrap when config is enabled
   2. Use the config to ONLY enable the MDT partition and once enabled used the 
hoodie.properties to check which partitions are enabled. Deletion is manual 
(through hudi-cli or other means).
   
   #2 prevents accidental deletions. I think removal of MDT partitions should 
be rare.



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