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


##########
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:
   Previously in `getIndexMetadata()` function if index definitions are empty, 
we were setting the `indexMetadataOpt` to Option.empty() but now as we are 
taking the deserialized value directly, in `deleteIndexDefinition` function we 
have this special handling for empty index definitions because 
`writeIndexMetadataToStorage()` method just flushes to disk for non empty 
`indexMetadataOpt` and to handle the empty flush to disk, i am using it



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