kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ale...@apache.org
Subject kudu git commit: [catalog_manager] cleanup on InitTokenSigner
Date Wed, 07 Nov 2018 23:38:24 GMT
Repository: kudu
Updated Branches:
  refs/heads/master ecdeac7d3 -> 17061dd13


[catalog_manager] cleanup on InitTokenSigner

With this patch, the catalog manager no longer issues empty write
operations to the system tablet upon initializing TokenSigner.
Additionally, the catalog manager now logs about deleted TSK keys.

Change-Id: I68eb1972c0ab330c7739e6901ebe36e4190144cc
Reviewed-on: http://gerrit.cloudera.org:8080/11902
Tested-by: Kudu Jenkins
Reviewed-by: Andrew Wong <awong@cloudera.com>


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/17061dd1
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/17061dd1
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/17061dd1

Branch: refs/heads/master
Commit: 17061dd13a43a3a82d05ad92d2535b0d421cd835
Parents: ecdeac7
Author: Alexey Serbin <alexey@apache.org>
Authored: Wed Nov 7 10:36:39 2018 -0800
Committer: Alexey Serbin <aserbin@cloudera.com>
Committed: Wed Nov 7 21:48:32 2018 +0000

----------------------------------------------------------------------
 src/kudu/master/catalog_manager.cc | 10 ++++++++--
 src/kudu/master/catalog_manager.h  |  3 ++-
 src/kudu/master/sys_catalog.cc     |  6 +++---
 src/kudu/master/sys_catalog.h      |  3 ++-
 4 files changed, 15 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/17061dd1/src/kudu/master/catalog_manager.cc
----------------------------------------------------------------------
diff --git a/src/kudu/master/catalog_manager.cc b/src/kudu/master/catalog_manager.cc
index 0af3aa0..c5e1873 100644
--- a/src/kudu/master/catalog_manager.cc
+++ b/src/kudu/master/catalog_manager.cc
@@ -939,7 +939,10 @@ Status CatalogManager::InitTokenSigner() {
   set<string> expired_tsk_entry_ids;
   RETURN_NOT_OK(LoadTskEntries(&expired_tsk_entry_ids));
   RETURN_NOT_OK(TryGenerateNewTskUnlocked());
-  return DeleteTskEntries(expired_tsk_entry_ids);
+  if (!expired_tsk_entry_ids.empty()) {
+    return DeleteTskEntries(expired_tsk_entry_ids);
+  }
+  return Status::OK();
 }
 
 void CatalogManager::PrepareForLeadershipTask() {
@@ -4116,7 +4119,10 @@ Status CatalogManager::LoadTspkEntries(vector<TokenSigningPublicKeyPB>*
keys) {
 
 Status CatalogManager::DeleteTskEntries(const set<string>& entry_ids) {
   leader_lock_.AssertAcquiredForWriting();
-  return sys_catalog_->RemoveTskEntries(entry_ids);
+  RETURN_NOT_OK(sys_catalog_->RemoveTskEntries(entry_ids));
+  LOG_WITH_PREFIX(INFO) << Substitute("Deleted TSKs: $0",
+                                      JoinStrings(entry_ids, ", "));
+  return Status::OK();
 }
 
 struct DeferredAssignmentActions {

http://git-wip-us.apache.org/repos/asf/kudu/blob/17061dd1/src/kudu/master/catalog_manager.h
----------------------------------------------------------------------
diff --git a/src/kudu/master/catalog_manager.h b/src/kudu/master/catalog_manager.h
index bed52ce..d21ab8c 100644
--- a/src/kudu/master/catalog_manager.h
+++ b/src/kudu/master/catalog_manager.h
@@ -851,7 +851,8 @@ class CatalogManager : public tserver::TabletReplicaLookupIf {
   Status LoadTspkEntries(std::vector<security::TokenSigningPublicKeyPB>* keys);
 
   // Delete TSK entries with the specified entry identifiers
-  // (identifiers correspond to the 'entry_id' column).
+  // (identifiers correspond to the 'entry_id' column). The 'entry_ids'
+  // container must not be empty.
   Status DeleteTskEntries(const std::set<std::string>& entry_ids);
 
   Status ApplyAlterSchemaSteps(const SysTablesEntryPB& current_pb,

http://git-wip-us.apache.org/repos/asf/kudu/blob/17061dd1/src/kudu/master/sys_catalog.cc
----------------------------------------------------------------------
diff --git a/src/kudu/master/sys_catalog.cc b/src/kudu/master/sys_catalog.cc
index 01b18f1..4f9630a 100644
--- a/src/kudu/master/sys_catalog.cc
+++ b/src/kudu/master/sys_catalog.cc
@@ -743,19 +743,19 @@ Status SysCatalogTable::AddTskEntry(const SysTskEntryPB& entry)
{
 }
 
 Status SysCatalogTable::RemoveTskEntries(const set<string>& entry_ids) {
+  CHECK(!entry_ids.empty());
   WriteRequestPB req;
-  WriteResponsePB resp;
-
   req.set_tablet_id(kSysCatalogTabletId);
+  RowOperationsPBEncoder enc(req.mutable_row_operations());
   CHECK_OK(SchemaToPB(schema_, req.mutable_schema()));
   for (const auto& id : entry_ids) {
     KuduPartialRow row(&schema_);
     CHECK_OK(row.SetInt8(kSysCatalogTableColType, TSK_ENTRY));
     CHECK_OK(row.SetStringNoCopy(kSysCatalogTableColId, id));
-    RowOperationsPBEncoder enc(req.mutable_row_operations());
     enc.Add(RowOperationsPB::DELETE, row);
   }
 
+  WriteResponsePB resp;
   return SyncWrite(&req, &resp);
 }
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/17061dd1/src/kudu/master/sys_catalog.h
----------------------------------------------------------------------
diff --git a/src/kudu/master/sys_catalog.h b/src/kudu/master/sys_catalog.h
index 2b0f56f..64dd893 100644
--- a/src/kudu/master/sys_catalog.h
+++ b/src/kudu/master/sys_catalog.h
@@ -186,7 +186,8 @@ class SysCatalogTable {
   Status AddTskEntry(const SysTskEntryPB& entry);
 
   // Remove TSK (Token Signing Key) entries with the specified entry identifiers
-  // (as in 'entry_id' column) from the system table.
+  // (as in 'entry_id' column) from the system table. The container of the
+  // entry identifiers must not be empty.
   Status RemoveTskEntries(const std::set<std::string>& entry_ids);
 
   // Return the underlying TabletReplica instance hosting the metadata.


Mime
View raw message