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


##########
hudi-common/src/main/java/org/apache/hudi/common/table/HoodieTableMetaClient.java:
##########
@@ -271,7 +271,13 @@ public boolean buildIndexDefinition(HoodieIndexDefinition 
indexDefinition) {
   public void deleteIndexDefinition(String indexName) {
     checkState(indexMetadataOpt.isPresent(), "Index metadata is not present");
     indexMetadataOpt.get().getIndexDefinitions().remove(indexName);
-    writeIndexMetadataToStorage();
+    if (indexMetadataOpt.get().getIndexDefinitions().isEmpty()) {
+      String indexMetaPath = getIndexDefinitionPath();
+      writeIndexMetadataToStorage(storage, indexMetaPath, new 
HoodieIndexMetadata(), getTableConfig().getTableVersion());

Review Comment:
   I mean we can use the `indexMetadataOpt.get()` directly instead of a new 
`new HoodieIndexMetadata()`.



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