You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by ad...@apache.org on 2020/03/19 19:03:17 UTC

[kudu] branch master updated (c0e922d -> 0923488)

This is an automated email from the ASF dual-hosted git repository.

adar pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git.


    from c0e922d  [client] Mark the Bloom filter predicate method as experimental
     new 332d4bb  [ranger] validate the JAR file path of the subprocess
     new 0923488  util: stop using namespaces

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/kudu/ranger/ranger_client.cc         | 54 +++++++++++++++++++-------------
 src/kudu/util/block_bloom_filter-test.cc |  5 +--
 src/kudu/util/logging.cc                 |  9 +++---
 src/kudu/util/url-coding-test.cc         |  8 +++--
 src/kudu/util/url-coding.cc              |  5 +--
 5 files changed, 48 insertions(+), 33 deletions(-)


[kudu] 02/02: util: stop using namespaces

Posted by ad...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

adar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git

commit 0923488fda7ce8d2222fa9ea676a0ece5f1d313b
Author: Adar Dembo <ad...@cloudera.com>
AuthorDate: Thu Mar 19 00:27:41 2020 -0700

    util: stop using namespaces
    
    There were a few holdouts of this, most likely from imported Impala code.
    It's a no-no for Kudu style, and "using namespace std" causes IWYU to
    recommend including <__config> when run against libc++.
    
    Change-Id: I71cc50ca397c3384c79be2181ffb0e0133939c6c
    Reviewed-on: http://gerrit.cloudera.org:8080/15491
    Reviewed-by: Alexey Serbin <as...@cloudera.com>
    Tested-by: Adar Dembo <ad...@cloudera.com>
---
 src/kudu/util/block_bloom_filter-test.cc | 5 +++--
 src/kudu/util/logging.cc                 | 9 +++++----
 src/kudu/util/url-coding-test.cc         | 8 +++++---
 src/kudu/util/url-coding.cc              | 5 +++--
 4 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/src/kudu/util/block_bloom_filter-test.cc b/src/kudu/util/block_bloom_filter-test.cc
index fa9b989..8815680 100644
--- a/src/kudu/util/block_bloom_filter-test.cc
+++ b/src/kudu/util/block_bloom_filter-test.cc
@@ -21,7 +21,6 @@
 #include <cstdint>
 #include <cstdlib>
 #include <cstring>
-#include <iosfwd>
 #include <memory>
 #include <unordered_set>
 #include <utility>
@@ -40,7 +39,9 @@
 
 DECLARE_bool(disable_blockbloomfilter_avx2);
 
-using namespace std; // NOLINT(*)
+using std::unique_ptr;
+using std::unordered_set;
+using std::vector;
 
 namespace kudu {
 
diff --git a/src/kudu/util/logging.cc b/src/kudu/util/logging.cc
index 36850c3..0ad4504 100644
--- a/src/kudu/util/logging.cc
+++ b/src/kudu/util/logging.cc
@@ -29,7 +29,6 @@
 #include <utility>
 
 #include <boost/uuid/random_generator.hpp>
-#include <boost/uuid/uuid.hpp>
 #include <boost/uuid/uuid_io.hpp>
 #include <gflags/gflags.h>
 #include <glog/logging.h>
@@ -75,11 +74,13 @@ TAG_FLAG(max_log_files, experimental);
 
 bool logging_initialized = false;
 
-using namespace std; // NOLINT(*)
-using namespace boost::uuids; // NOLINT(*)
-
 using base::SpinLock;
 using base::SpinLockHolder;
+using boost::uuids::random_generator;
+using std::string;
+using std::ofstream;
+using std::ostream;
+using std::ostringstream;
 
 namespace kudu {
 
diff --git a/src/kudu/util/url-coding-test.cc b/src/kudu/util/url-coding-test.cc
index 3892772..aca738f 100644
--- a/src/kudu/util/url-coding-test.cc
+++ b/src/kudu/util/url-coding-test.cc
@@ -15,6 +15,8 @@
 // specific language governing permissions and limitations
 // under the License.
 
+#include "kudu/util/url-coding.h"
+
 #include <cstring>
 #include <cstdint>
 #include <iostream>
@@ -23,9 +25,9 @@
 
 #include <gtest/gtest.h>
 
-#include "kudu/util/url-coding.h"
-
-using namespace std; // NOLINT(*)
+using std::ostringstream;
+using std::string;
+using std::vector;
 
 namespace kudu {
 
diff --git a/src/kudu/util/url-coding.cc b/src/kudu/util/url-coding.cc
index 81a2994..96a6a0f 100644
--- a/src/kudu/util/url-coding.cc
+++ b/src/kudu/util/url-coding.cc
@@ -14,7 +14,6 @@
 // KIND, either express or implied.  See the License for the
 // specific language governing permissions and limitations
 // under the License.
-//
 
 #include "kudu/util/url-coding.h"
 
@@ -33,9 +32,11 @@
 #include <boost/function.hpp>
 #include <glog/logging.h>
 
+using boost::archive::iterators::base64_from_binary;
+using boost::archive::iterators::binary_from_base64;
+using boost::archive::iterators::transform_width;
 using std::string;
 using std::vector;
-using namespace boost::archive::iterators; // NOLINT(*)
 
 namespace kudu {
 


[kudu] 01/02: [ranger] validate the JAR file path of the subprocess

Posted by ad...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

adar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git

commit 332d4bb0bcda04276be1ec25123f204877664966
Author: Hao Hao <ha...@cloudera.com>
AuthorDate: Fri Mar 13 22:19:43 2020 -0700

    [ranger] validate the JAR file path of the subprocess
    
    This patch updates the previous flag validator for --ranger_java_path
    to be group validation for all Ranger-related flags including the JAR
    file path of the subprocess flag --ranger_jar_path.
    
    Change-Id: I361689971dcd8dd74c13b90b61b922e7f7c7a88d
    Reviewed-on: http://gerrit.cloudera.org:8080/15435
    Reviewed-by: Adar Dembo <ad...@cloudera.com>
    Tested-by: Hao Hao <ha...@cloudera.com>
---
 src/kudu/ranger/ranger_client.cc | 54 ++++++++++++++++++++++++----------------
 1 file changed, 32 insertions(+), 22 deletions(-)

diff --git a/src/kudu/ranger/ranger_client.cc b/src/kudu/ranger/ranger_client.cc
index 85447d8..7899b6e 100644
--- a/src/kudu/ranger/ranger_client.cc
+++ b/src/kudu/ranger/ranger_client.cc
@@ -54,7 +54,9 @@ DEFINE_string(ranger_config_path, "",
 TAG_FLAG(ranger_config_path, experimental);
 
 DEFINE_string(ranger_jar_path, "",
-              "Path to the JAR file containing the Ranger subprocess.");
+              "Path to the JAR file containing the Ranger subprocess. "
+              "If not set, the default JAR file path is expected to be"
+              "next to the master binary");
 TAG_FLAG(ranger_jar_path, experimental);
 
 METRIC_DEFINE_histogram(server, ranger_subprocess_execution_time_ms,
@@ -125,23 +127,39 @@ using std::unordered_set;
 using std::vector;
 using strings::Substitute;
 
-static bool ValidateRangerJavaPath() {
-  // First, check the specified path.
-  if (!FLAGS_ranger_config_path.empty() &&
-      !Env::Default()->FileExists(FLAGS_ranger_java_path)) {
-    // Otherwise, since the specified path is not absolute, check if
-    // the Java binary is on the PATH.
-    string p;
-    Status s = Subprocess::Call({ "which", FLAGS_ranger_java_path }, "", &p);
-    if (!s.ok()) {
-      LOG(ERROR) << Substitute("FLAGS_ranger_java_path has invalid java binary path: $0",
-                                FLAGS_ranger_java_path);
+// Returns the path to the JAR file containing the Ranger subprocess.
+static string GetRangerJarPath() {
+  string exe;
+  CHECK_OK(Env::Default()->GetExecutablePath(&exe));
+  const string bin_dir = DirName(exe);
+  return FLAGS_ranger_jar_path.empty() ? JoinPathSegments(bin_dir, "kudu-subprocess.jar") :
+         FLAGS_ranger_jar_path;
+}
+
+static bool ValidateRangerConfiguration() {
+  if (!FLAGS_ranger_config_path.empty()) {
+    // First, check the specified path.
+    if (!Env::Default()->FileExists(FLAGS_ranger_java_path)) {
+      // Otherwise, since the specified path is not absolute, check if
+      // the Java binary is on the PATH.
+      string p;
+      Status s = Subprocess::Call({ "which", FLAGS_ranger_java_path }, "", &p);
+      if (!s.ok()) {
+        LOG(ERROR) << Substitute("FLAGS_ranger_java_path has invalid java binary path: $0",
+                                 FLAGS_ranger_java_path);
+        return false;
+      }
+    }
+    string ranger_jar_path = GetRangerJarPath();
+    if (!Env::Default()->FileExists(ranger_jar_path)) {
+      LOG(ERROR) << Substitute("FLAGS_ranger_jar_path has invalid JAR file path: $0",
+                               ranger_jar_path);
       return false;
     }
   }
   return true;
 }
-GROUP_FLAG_VALIDATOR(ranger_java_path_flags, ValidateRangerJavaPath);
+GROUP_FLAG_VALIDATOR(ranger_config_flags, ValidateRangerConfiguration);
 
 static const char* kUnauthorizedAction = "Unauthorized action";
 static const char* kDenyNonRangerTableTemplate = "Denying action on table with invalid name $0. "
@@ -356,15 +374,7 @@ Status RangerClient::AuthorizeActions(const string& user_name,
 }
 
 string RangerClient::GetJavaClasspath() {
-  Env* env = Env::Default();
-  string exe;
-  CHECK_OK(env->GetExecutablePath(&exe));
-  const string bin_dir = DirName(exe);
-  string jar_path = FLAGS_ranger_jar_path.empty() ?
-    JoinPathSegments(bin_dir, "kudu-subprocess.jar") :
-    FLAGS_ranger_jar_path;
-
-  return Substitute("$0:$1", jar_path, FLAGS_ranger_config_path);
+  return Substitute("$0:$1", GetRangerJarPath(), FLAGS_ranger_config_path);
 }
 
 } // namespace ranger