This is an automated email from the ASF dual-hosted git repository. alexey pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/kudu.git
The following commit(s) were added to refs/heads/master by this push: new 034b85f [security] cleanup on InitKerberosForServer() 034b85f is described below commit 034b85f9c93ac2d54b23fa9f8358421b4795d217 Author: Alexey Serbin <ale...@apache.org> AuthorDate: Mon Jan 10 10:19:58 2022 -0800 [security] cleanup on InitKerberosForServer() Since I was looking into the code of InitKerberosForServer() in src/kudu/security/init.cc while reviewing a related changelist, I took the liberty cleaning up the code around. This patch doesn't contain any functional changes. Change-Id: If2e7cb622df23844239b94dc0fc026d68bb5a9d1 Reviewed-on: http://gerrit.cloudera.org:8080/18139 Reviewed-by: Attila Bukor <abu...@apache.org> Tested-by: Kudu Jenkins --- src/kudu/security/init.cc | 8 ++------ src/kudu/util/thread.cc | 3 +-- src/kudu/util/thread.h | 3 ++- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/kudu/security/init.cc b/src/kudu/security/init.cc index 7769ffd..1a512dc 100644 --- a/src/kudu/security/init.cc +++ b/src/kudu/security/init.cc @@ -37,7 +37,6 @@ #include <glog/logging.h> #include "kudu/gutil/macros.h" -#include "kudu/gutil/ref_counted.h" #include "kudu/gutil/strings/substitute.h" #include "kudu/gutil/strings/util.h" #include "kudu/security/kinit_context.h" @@ -496,11 +495,8 @@ Status InitKerberosForServer(const std::string& raw_principal, const std::string RETURN_NOT_OK_PREPEND(g_kinit_ctx->Kinit( keytab_file, configured_principal), "unable to kinit"); - scoped_refptr<Thread> reacquire_thread; - // Start the reacquire thread. - RETURN_NOT_OK(Thread::Create("kerberos", "reacquire thread", &RenewThread, &reacquire_thread)); - - return Status::OK(); + // Start the thread to renew and reacquire Kerberos tickets. + return Thread::Create("kerberos", "reacquire thread", &RenewThread, nullptr); } string GetKrb5ConfigFile() { diff --git a/src/kudu/util/thread.cc b/src/kudu/util/thread.cc index ddf2f95..1db8579 100644 --- a/src/kudu/util/thread.cc +++ b/src/kudu/util/thread.cc @@ -570,10 +570,9 @@ int64_t Thread::WaitForTid() const { } } - Status Thread::StartThread(string category, string name, std::function<void()> functor, uint64_t flags, - scoped_refptr<Thread> *holder) { + scoped_refptr<Thread>* holder) { TRACE_COUNTER_INCREMENT("threads_started", 1); TRACE_COUNTER_SCOPE_LATENCY_US("thread_start_us"); GoogleOnceInit(&once, &InitThreading); diff --git a/src/kudu/util/thread.h b/src/kudu/util/thread.h index 91e4480..d49beb6 100644 --- a/src/kudu/util/thread.h +++ b/src/kudu/util/thread.h @@ -285,7 +285,8 @@ class Thread : public RefCountedThreadSafe<Thread> { // Starts the thread running SuperviseThread(), and returns once that thread has // initialised and its TID has been read. Waits for notification from the started // thread that initialisation is complete before returning. On success, stores a - // reference to the thread in holder. + // reference to the thread into the 'holder' parameter which can be passed as + // 'nullptr' if the reference isn't needed. static Status StartThread(std::string category, std::string name, std::function<void()> functor, uint64_t flags, scoped_refptr<Thread>* holder);