zhjwpku commented on code in PR #744:
URL: https://github.com/apache/iceberg-cpp/pull/744#discussion_r3411029859


##########
src/iceberg/catalog/memory/in_memory_catalog.cc:
##########
@@ -511,7 +512,19 @@ Result<bool> InMemoryCatalog::TableExists(const 
TableIdentifier& identifier) con
 
 Status InMemoryCatalog::DropTable(const TableIdentifier& identifier, bool 
purge) {
   std::unique_lock lock(mutex_);
-  // TODO(Guotao): Delete all metadata files if purge is true.
+  if (purge && file_io_) {
+    ICEBERG_ASSIGN_OR_RAISE(auto metadata_location,
+                            
root_namespace_->GetTableMetadataLocation(identifier));
+    ICEBERG_ASSIGN_OR_RAISE(auto metadata,
+                            TableMetadataUtil::Read(*file_io_, 
metadata_location));
+    // Delete previous metadata files from the log first, so that if deletion
+    // fails and is retried, the current metadata file still exists as an
+    // anchor to locate any remaining old files.
+    for (const auto& entry : metadata->metadata_log) {

Review Comment:
   Not a blocking comment, but should we use the newly introduced DeleteFiles 
API so that batch deletion can be leveraged when supported by the underlying 
FileIO implementation?



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to