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

[1/2] kudu git commit: Add support for clang from XCode 8 in macOS

Repository: kudu
Updated Branches:
  refs/heads/master 1069aaae2 -> 7327c28b2


Add support for clang from XCode 8 in macOS

Since upgrading XCode to 8 (even in El Capitan), cmake has outputted an
unsupported compiler message:

  Unknown compiler.  Version info:

  Apple LLVM version 8.0.0 (clang-800.0.38)

  Target: x86_64-apple-darwin16.0.0

  Thread model: posix

  InstalledDir:
  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

This is also the default version in the new macOS Sierra.
This patch fixes this by adding it to the list of supported
compilers.

Note that this patch, by itself, won't allow to fully compile Kudu in
macOS Sierra, as the current version of tcmalloc is incompatible:
https://github.com/gperftools/gperftools/issues/827

We need to wait until the issue above is fixed in order to fully support
building with the default toolchain in macOS Sierra. In the meanwhile this
patch is still valuable. It's still possible to build Kudu with the clang
toolchain we ship and CLion users can still use the default toolchain,
as long as they don't actually run the CLion build's binaries.

Were we to change to jemalloc, that issue is solved there:
https://github.com/jemalloc/jemalloc/pull/427

Change-Id: I74574fb80525c7b7545e2aaf9b220f63486a46b6
Reviewed-on: http://gerrit.cloudera.org:8080/4482
Reviewed-by: Dan Burkert <da...@cloudera.com>
Tested-by: Kudu Jenkins


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

Branch: refs/heads/master
Commit: 2e0f669ea0e75df87bbbdc631895538d0b6303e3
Parents: 1069aaa
Author: David Alves <dr...@apache.org>
Authored: Tue Sep 20 14:37:02 2016 -0700
Committer: David Ribeiro Alves <dr...@apache.org>
Committed: Tue Sep 20 22:59:56 2016 +0000

----------------------------------------------------------------------
 cmake_modules/CompilerInfo.cmake | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/2e0f669e/cmake_modules/CompilerInfo.cmake
----------------------------------------------------------------------
diff --git a/cmake_modules/CompilerInfo.cmake b/cmake_modules/CompilerInfo.cmake
index d77080c..80aeb2f 100644
--- a/cmake_modules/CompilerInfo.cmake
+++ b/cmake_modules/CompilerInfo.cmake
@@ -37,6 +37,11 @@ elseif("${COMPILER_VERSION_FULL}" MATCHES ".*clang-7")
   set(COMPILER_FAMILY "clang")
   set(COMPILER_VERSION "3.7.0svn")
 
+# clang on Mac OS X, XCode 8.
+elseif("${COMPILER_VERSION_FULL}" MATCHES ".*clang-8")
+  set(COMPILER_FAMILY "clang")
+  set(COMPILER_VERSION "3.8.0svn")
+
 # gcc
 elseif("${COMPILER_VERSION_FULL}" MATCHES ".*gcc version.*")
   set(COMPILER_FAMILY "gcc")


[2/2] kudu git commit: cli tool: List all tablets/replica_uuids with 'kudu table list'

Posted by da...@apache.org.
cli tool: List all tablets/replica_uuids with 'kudu table list'

I noticed that given a tablet or replica_uuid we need to execute
multiple nested commands and also need to correlate tablets and
their replica uuids and their relation to tables. Added a verbose
flag to 'kudu table list' to make this simpler.

This lists tablet/replica uuids irrespective of their states.

Change-Id: Ic8f8e0dfb8e7ba9f67d5926199a9b831351585a7
Reviewed-on: http://gerrit.cloudera.org:8080/4440
Tested-by: Kudu Jenkins
Reviewed-by: Dan Burkert <da...@cloudera.com>


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

Branch: refs/heads/master
Commit: 7327c28b2f445d3756da34273c5dca7e4ee8d69d
Parents: 2e0f669
Author: Dinesh Bhat <di...@cloudera.com>
Authored: Fri Sep 16 10:51:09 2016 -0700
Committer: Dan Burkert <da...@cloudera.com>
Committed: Wed Sep 21 17:13:32 2016 +0000

----------------------------------------------------------------------
 src/kudu/tools/kudu-admin-test.cc           | 50 ++++++++++++++++++++++++
 src/kudu/tools/tool_action_local_replica.cc | 16 ++++----
 src/kudu/tools/tool_action_table.cc         | 33 ++++++++++++++--
 3 files changed, 89 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/7327c28b/src/kudu/tools/kudu-admin-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tools/kudu-admin-test.cc b/src/kudu/tools/kudu-admin-test.cc
index 6d72f77..daada31 100644
--- a/src/kudu/tools/kudu-admin-test.cc
+++ b/src/kudu/tools/kudu-admin-test.cc
@@ -33,6 +33,8 @@ namespace tools {
 
 using client::KuduClient;
 using client::KuduClientBuilder;
+using client::KuduSchema;
+using client::KuduTableCreator;
 using client::sp::shared_ptr;
 using itest::TabletServerMap;
 using itest::TServerDetails;
@@ -209,5 +211,53 @@ TEST_F(AdminCliTest, TestListTables) {
   ASSERT_EQ(Substitute("$0\n", kTableId), stdout_lines[0]);
 }
 
+TEST_F(AdminCliTest, TestListTablesDetail) {
+  FLAGS_num_tablet_servers = 3;
+  FLAGS_num_replicas = 3;
+
+  BuildAndStart({}, {});
+
+  // Add another table to test multiple tables output.
+  const string kAnotherTableId = "TestAnotherTable";
+  KuduSchema client_schema(client::KuduSchemaFromSchema(schema_));
+  gscoped_ptr<KuduTableCreator> table_creator(client_->NewTableCreator());
+  ASSERT_OK(table_creator->table_name(kAnotherTableId)
+           .schema(&client_schema)
+           .set_range_partition_columns({ "key" })
+           .num_replicas(FLAGS_num_replicas)
+           .Create());
+
+  // Grab list of tablet_ids from any tserver.
+  vector<TServerDetails*> tservers;
+  vector<string> tablet_ids;
+  AppendValuesFromMap(tablet_servers_, &tservers);
+  ListRunningTabletIds(tservers.front(),
+                       MonoDelta::FromSeconds(30), &tablet_ids);
+
+  string stdout;
+  ASSERT_OK(Subprocess::Call({
+    GetAdminToolPath(),
+    "table",
+    "list",
+    "--list_tablets",
+    cluster_->master()->bound_rpc_addr().ToString()
+  }, &stdout, nullptr));
+
+  vector<string> stdout_lines = strings::Split(stdout, "\n",
+                                               strings::SkipEmpty());
+
+  // Verify multiple tables along with their tablets and replica-uuids.
+  ASSERT_EQ(4, stdout_lines.size());
+  ASSERT_STR_CONTAINS(stdout, kTableId);
+  ASSERT_STR_CONTAINS(stdout, kAnotherTableId);
+  ASSERT_STR_CONTAINS(stdout, tablet_ids.front());
+  ASSERT_STR_CONTAINS(stdout, tablet_ids.back());
+
+  for (auto& ts : tservers) {
+    ASSERT_STR_CONTAINS(stdout, ts->uuid());
+    ASSERT_STR_CONTAINS(stdout, ts->uuid());
+  }
+}
+
 } // namespace tools
 } // namespace kudu

http://git-wip-us.apache.org/repos/asf/kudu/blob/7327c28b/src/kudu/tools/tool_action_local_replica.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tools/tool_action_local_replica.cc b/src/kudu/tools/tool_action_local_replica.cc
index 01986c2..63e22d4 100644
--- a/src/kudu/tools/tool_action_local_replica.cc
+++ b/src/kudu/tools/tool_action_local_replica.cc
@@ -64,14 +64,16 @@
 #include "kudu/util/pb_util.h"
 #include "kudu/util/status.h"
 
+DEFINE_bool(dump_data, false,
+            "Dump the data for each column in the rowset.");
 DEFINE_bool(metadata_only, false,
             "Only dump the block metadata when printing blocks.");
 DEFINE_int64(nrows, 0, "Number of rows to dump");
+DEFINE_bool(list_detail, false,
+            "Print partition info for the local replicas");
 DEFINE_int64(rowset_index, -1,
              "Index of the rowset in local replica, default value(-1) "
              "will dump all the rowsets of the local replica");
-DEFINE_bool(verbose, false,
-            "Print additional information (if any)");
 
 namespace kudu {
 namespace tools {
@@ -363,7 +365,7 @@ Status ListLocalReplicas(const RunnerContext& context) {
   vector<string> tablets;
   RETURN_NOT_OK(fs_manager->ListTabletIds(&tablets));
   for (const string& tablet : tablets) {
-    if (FLAGS_verbose) {
+    if (FLAGS_list_detail) {
       cout << "Tablet: " << tablet << endl;
       RETURN_NOT_OK(DumpTabletMeta(fs_manager.get(), tablet, 2));
     } else {
@@ -383,7 +385,7 @@ Status DumpCFileBlockInternal(FsManager* fs_manager,
 
   cout << Indent(indent) << "CFile Header: "
        << reader->header().ShortDebugString() << endl;
-  if (!FLAGS_verbose) {
+  if (!FLAGS_dump_data) {
     return Status::OK();
   }
   cout << Indent(indent) << reader->footer().num_values()
@@ -489,7 +491,7 @@ Status DumpDeltaCFileBlockInternal(FsManager* fs_manager,
                                                               &out,
                                                               &arena));
     for (const DeltaKeyAndUpdate& upd : out) {
-      if (FLAGS_verbose) {
+      if (FLAGS_dump_data) {
         cout << Indent(indent) << upd.key.ToString() << " "
              << RowChangeList(upd.cell).ToString(schema) << endl;
         ++ndeltas;
@@ -631,12 +633,12 @@ unique_ptr<Mode> BuildDumpMode() {
       ActionBuilder("rowset", &DumpRowSet)
       .Description("Dump the rowset contents of a local replica")
       .AddRequiredParameter({ "tablet_id", "tablet identifier" })
+      .AddOptionalParameter("dump_data")
       .AddOptionalParameter("fs_wal_dir")
       .AddOptionalParameter("fs_data_dirs")
       .AddOptionalParameter("metadata_only")
       .AddOptionalParameter("nrows")
       .AddOptionalParameter("rowset_index")
-      .AddOptionalParameter("verbose")
       .Build();
 
   unique_ptr<Action> dump_wals =
@@ -706,7 +708,7 @@ unique_ptr<Mode> BuildLocalReplicaMode() {
       .Description("Show list of Kudu replicas in the local filesystem")
       .AddOptionalParameter("fs_wal_dir")
       .AddOptionalParameter("fs_data_dirs")
-      .AddOptionalParameter("verbose")
+      .AddOptionalParameter("list_detail")
       .Build();
 
   return ModeBuilder("local_replica")

http://git-wip-us.apache.org/repos/asf/kudu/blob/7327c28b/src/kudu/tools/tool_action_table.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tools/tool_action_table.cc b/src/kudu/tools/tool_action_table.cc
index ccbeb17..1e58286 100644
--- a/src/kudu/tools/tool_action_table.cc
+++ b/src/kudu/tools/tool_action_table.cc
@@ -18,7 +18,6 @@
 #include "kudu/tools/tool_action.h"
 
 #include <algorithm>
-#include <iterator>
 #include <iostream>
 #include <memory>
 #include <string>
@@ -27,14 +26,21 @@
 
 #include "kudu/client/client.h"
 #include "kudu/gutil/map-util.h"
+#include "kudu/gutil/stl_util.h"
 #include "kudu/gutil/strings/split.h"
 #include "kudu/util/status.h"
 
+DEFINE_bool(list_tablets, false,
+            "Include tablet and replica UUIDs in the output");
+
 namespace kudu {
 namespace tools {
 
 using client::KuduClient;
 using client::KuduClientBuilder;
+using client::KuduScanToken;
+using client::KuduScanTokenBuilder;
+using client::KuduTable;
 using std::cout;
 using std::endl;
 using std::string;
@@ -71,8 +77,28 @@ Status ListTables(const RunnerContext& context) {
   vector<string> table_names;
   RETURN_NOT_OK(client->ListTables(&table_names));
 
-  std::copy(table_names.begin(), table_names.end(),
-            std::ostream_iterator<string>(cout, "\n"));
+  for (const auto& tname : table_names) {
+    cout << tname << endl;
+    if (!FLAGS_list_tablets) {
+      continue;
+    }
+    client::sp::shared_ptr<KuduTable> client_table;
+    RETURN_NOT_OK(client->OpenTable(tname, &client_table));
+    vector<KuduScanToken*> tokens;
+    ElementDeleter deleter(&tokens);
+    KuduScanTokenBuilder builder(client_table.get());
+    RETURN_NOT_OK(builder.Build(&tokens));
+
+    for (const auto* token : tokens) {
+      cout << "T " << token->tablet().id() << "\t";
+      for (const auto* replica : token->tablet().replicas()) {
+        cout << "P" << (replica->is_leader() ? "(L) " : "    ")
+             << replica->ts().uuid() << "    ";
+      }
+      cout << endl;
+    }
+    cout << endl;
+  }
   return Status::OK();
 }
 
@@ -96,6 +122,7 @@ unique_ptr<Mode> BuildTableMode() {
         kMasterAddressesArg,
         "Comma-separated list of Kudu Master addresses where each address is "
         "of form 'hostname:port'" })
+      .AddOptionalParameter("list_tablets")
       .Build();
 
   return ModeBuilder("table")