Repository: kudu Updated Branches: refs/heads/master af00c4c9b -> 43e7bb1f8
De-flake sentry_client-test and sentry_authz_provider-test Currently, sentry_client-test and sentry_authz_provider-test often fail with 'BindException: Address already in use'. Because Sentry uses a default port number '8038' if 'sentry.service.server.rpc-port' is not set. This commit sets this configuration with port 0 to ensure the mini Sentry service can always find a free port to bound to. When running sentry_client-test and sentry_authz_provider-test in parallel on the same machine: before the change, one of the tests failed with BindException; after the change, both tests passed without any errors. Change-Id: I0e30ce88b7c2ab4afe451c50e13ef739237709e0 Reviewed-on: http://gerrit.cloudera.org:8080/11898 Tested-by: Hao Hao <[email protected]> Reviewed-by: Grant Henke <[email protected]> Reviewed-by: Andrew Wong <[email protected]> Reviewed-by: Adar Dembo <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/kudu/repo Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/43e7bb1f Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/43e7bb1f Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/43e7bb1f Branch: refs/heads/master Commit: 43e7bb1f8135f37375f5188cd8252b0cbd809fd5 Parents: af00c4c Author: Hao Hao <[email protected]> Authored: Tue Nov 6 21:51:08 2018 -0800 Committer: Hao Hao <[email protected]> Committed: Wed Nov 7 17:46:26 2018 +0000 ---------------------------------------------------------------------- src/kudu/sentry/mini_sentry.cc | 12 +++++++++++- src/kudu/sentry/mini_sentry.h | 2 ++ 2 files changed, 13 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kudu/blob/43e7bb1f/src/kudu/sentry/mini_sentry.cc ---------------------------------------------------------------------- diff --git a/src/kudu/sentry/mini_sentry.cc b/src/kudu/sentry/mini_sentry.cc index 61b2810..5a7ad7d 100644 --- a/src/kudu/sentry/mini_sentry.cc +++ b/src/kudu/sentry/mini_sentry.cc @@ -169,6 +169,10 @@ Status MiniSentry::CreateSentryConfigs(const string& tmp_dir) const { // - sentry.service.allow.connect // Set of Kerberos principals which is allowed to connect to Sentry when // the Kerberos security mode is enabled. + // + // - sentry.service.server.rpc-port + // Port number that the Sentry service starts with. + // static const string kFileTemplate = R"( <configuration> @@ -218,6 +222,11 @@ Status MiniSentry::CreateSentryConfigs(const string& tmp_dir) const { </property> <property> + <name>sentry.service.server.rpc-port</name> + <value>$5</value> + </property> + + <property> <name>sentry.service.admin.group</name> <value>admin</value> </property> @@ -237,7 +246,8 @@ Status MiniSentry::CreateSentryConfigs(const string& tmp_dir) const { service_principal_, keytab_file_, tmp_dir, - users_ini_path); + users_ini_path, + port_); RETURN_NOT_OK(WriteStringToFile(Env::Default(), file_contents, JoinPathSegments(tmp_dir, "sentry-site.xml"))); http://git-wip-us.apache.org/repos/asf/kudu/blob/43e7bb1f/src/kudu/sentry/mini_sentry.h ---------------------------------------------------------------------- diff --git a/src/kudu/sentry/mini_sentry.h b/src/kudu/sentry/mini_sentry.h index 708ed6b..169c9e6 100644 --- a/src/kudu/sentry/mini_sentry.h +++ b/src/kudu/sentry/mini_sentry.h @@ -74,6 +74,8 @@ class MiniSentry { Status WaitForSentryPorts() WARN_UNUSED_RESULT; std::unique_ptr<Subprocess> sentry_process_; + + // Port number of the mini Sentry service. Default to 0. uint16_t port_ = 0; // Kerberos configuration
