Mike Percy has posted comments on this change. ( 
http://gerrit.cloudera.org:8080/9452 )

Change subject: KUDU-2293 fix cleanup after failed copies
......................................................................


Patch Set 10:

(1 comment)

http://gerrit.cloudera.org:8080/#/c/9452/10/src/kudu/tserver/tablet_copy_client.cc
File src/kudu/tserver/tablet_copy_client.cc:

http://gerrit.cloudera.org:8080/#/c/9452/10/src/kudu/tserver/tablet_copy_client.cc@458
PS10, Line 458:   fs_manager_->dd_manager()->DeleteDataDirGroup(tablet_id_);
> 1. If we don't remove the data dir group, if we ever try to create a new da
Gotcha. What do you think about changing the implementation to the below and 
get rid of other calls to delete the data dir group? I believe that will ensure 
that if we manage to get the tombstoned superblock to disk then we will 
unregister the data dir group, but not otherwise.

diff --git a/src/kudu/tablet/tablet_metadata.cc 
b/src/kudu/tablet/tablet_metadata.cc
index 004a5ed..bc90bf8 100644
--- a/src/kudu/tablet/tablet_metadata.cc
+++ b/src/kudu/tablet/tablet_metadata.cc
@@ -215,22 +215,14 @@ Status TabletMetadata::DeleteTabletData(TabletDataState 
delete_type,
     }
   }

-  // Keep a copy of the old data dir group in case of flush failure.
-  DataDirGroupPB pb;
-  bool old_group_exists = 
fs_manager_->dd_manager()->GetDataDirGroupPB(tablet_id_, &pb).ok();
-
-  // Remove the tablet's data dir group tracked by the DataDirManager.
-  fs_manager_->dd_manager()->DeleteDataDirGroup(tablet_id_);
-  auto revert_group_cleanup = MakeScopedCleanup([&]() {
-    if (old_group_exists) {
-      fs_manager_->dd_manager()->LoadDataDirGroupFromPB(tablet_id_, pb);
-    }
-  });
-
   // Flushing will sync the new tablet_data_state_ to disk and will now also
   // delete all the data.
   RETURN_NOT_OK(Flush());
-  revert_group_cleanup.cancel();
+
+  // Unregister the tablet's data dir group from memory (its configuration is
+  // stored in the superblock).
+  // If the data dir group was somehow already deleted, this is a no-op.
+  fs_manager_->dd_manager()->DeleteDataDirGroup(tablet_id_);

   // Re-sync to disk one more time.
   // This call will typically re-sync with an empty orphaned blocks list



--
To view, visit http://gerrit.cloudera.org:8080/9452
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I0459d484a3064aa2de392328e2910c9f6741be04
Gerrit-Change-Number: 9452
Gerrit-PatchSet: 10
Gerrit-Owner: Andrew Wong <aw...@cloudera.com>
Gerrit-Reviewer: Andrew Wong <aw...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Mike Percy <mpe...@apache.org>
Gerrit-Reviewer: Tidy Bot
Gerrit-Comment-Date: Tue, 10 Apr 2018 20:55:19 +0000
Gerrit-HasComments: Yes

Reply via email to