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

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

commit 5664e280a7cdbce055227da2e556f937952dd89f
Author: Alexey Serbin <[email protected]>
AuthorDate: Tue Jul 12 19:24:20 2022 -0700

    KUDU-2671 range-specific hash schemas enabled by default
    
    This patch sets the default value for --enable_per_range_hash_schemas
    to be 'true' by default, enabling the support for range-specific hash
    schemas for the server side right out of the box.
    
    Change-Id: Iae6220bfec4089819b292d4f6879c4421e05e444
    Reviewed-on: http://gerrit.cloudera.org:8080/18727
    Tested-by: Kudu Jenkins
    Reviewed-by: Mahesh Reddy <[email protected]>
    Reviewed-by: Yingchun Lai <[email protected]>
---
 .../org/apache/kudu/client/TestAlterTable.java     |  6 -----
 .../org/apache/kudu/client/TestKuduClient.java     |  3 ---
 .../java/org/apache/kudu/client/TestKuduTable.java | 30 ----------------------
 .../apache/kudu/client/TestPartitionPruner.java    |  3 ---
 src/kudu/client/client-test.cc                     |  1 -
 src/kudu/client/flex_partitioning_client-test.cc   |  7 +----
 src/kudu/client/scan_token-test.cc                 |  3 ---
 .../integration-tests/table_locations-itest.cc     |  5 ----
 src/kudu/master/catalog_manager.cc                 |  4 +--
 src/kudu/master/master-test.cc                     |  9 -------
 10 files changed, 3 insertions(+), 68 deletions(-)

diff --git 
a/java/kudu-client/src/test/java/org/apache/kudu/client/TestAlterTable.java 
b/java/kudu-client/src/test/java/org/apache/kudu/client/TestAlterTable.java
index 35ee0a8cb..2c4908020 100644
--- a/java/kudu-client/src/test/java/org/apache/kudu/client/TestAlterTable.java
+++ b/java/kudu-client/src/test/java/org/apache/kudu/client/TestAlterTable.java
@@ -517,9 +517,6 @@ public class TestAlterTable {
    * per range.
    */
   @Test(timeout = 100000)
-  @KuduTestHarness.MasterServerConfig(flags = {
-      "--enable_per_range_hash_schemas=true",
-  })
   public void testAlterAddRangeWithCustomHashSchema() throws Exception {
     ArrayList<ColumnSchema> columns = new ArrayList<>(2);
     columns.add(new ColumnSchema.ColumnSchemaBuilder("c0", Type.INT32)
@@ -608,9 +605,6 @@ public class TestAlterTable {
    * ranges between partition with the table-wide and custom hash schemas.
    */
   @Test(timeout = 100000)
-  @KuduTestHarness.MasterServerConfig(flags = {
-      "--enable_per_range_hash_schemas=true",
-  })
   public void testAlterAddRangeWithCustomHashSchemaNonCoveredRange() throws 
Exception {
     ArrayList<ColumnSchema> columns = new ArrayList<>(2);
     columns.add(new ColumnSchema.ColumnSchemaBuilder("c0", Type.INT32)
diff --git 
a/java/kudu-client/src/test/java/org/apache/kudu/client/TestKuduClient.java 
b/java/kudu-client/src/test/java/org/apache/kudu/client/TestKuduClient.java
index 00e5d8f40..82670b812 100644
--- a/java/kudu-client/src/test/java/org/apache/kudu/client/TestKuduClient.java
+++ b/java/kudu-client/src/test/java/org/apache/kudu/client/TestKuduClient.java
@@ -746,9 +746,6 @@ public class TestKuduClient {
    * with custom hash schema.
    */
   @Test(timeout = 100000)
-  @KuduTestHarness.MasterServerConfig(flags = {
-      "--enable_per_range_hash_schemas=true",
-  })
   public void testRangeWithCustomHashSchema() throws Exception {
     List<ColumnSchema> cols = new ArrayList<>();
     cols.add(new ColumnSchema.ColumnSchemaBuilder("c0", 
Type.INT64).key(true).build());
diff --git 
a/java/kudu-client/src/test/java/org/apache/kudu/client/TestKuduTable.java 
b/java/kudu-client/src/test/java/org/apache/kudu/client/TestKuduTable.java
index 0d4a08028..80101d806 100644
--- a/java/kudu-client/src/test/java/org/apache/kudu/client/TestKuduTable.java
+++ b/java/kudu-client/src/test/java/org/apache/kudu/client/TestKuduTable.java
@@ -495,9 +495,6 @@ public class TestKuduTable {
   }
 
   @Test(timeout = 100000)
-  @KuduTestHarness.MasterServerConfig(flags = {
-      "--enable_per_range_hash_schemas=true",
-  })
   public void testCreateTablePartitionWithEmptyCustomHashSchema() throws 
Exception {
     PartialRow lower = basicSchema.newPartialRow();
     lower.addInt(0, -100);
@@ -549,9 +546,6 @@ public class TestKuduTable {
   }
 
   @Test(timeout = 100000)
-  @KuduTestHarness.MasterServerConfig(flags = {
-      "--enable_per_range_hash_schemas=true",
-  })
   public void testCreateTablePartitionWithCustomHashSchema() throws Exception {
     PartialRow lower = basicSchema.newPartialRow();
     lower.addInt(0, -100);
@@ -617,9 +611,6 @@ public class TestKuduTable {
   }
 
   @Test(timeout = 100000)
-  @KuduTestHarness.MasterServerConfig(flags = {
-      "--enable_per_range_hash_schemas=true",
-  })
   public void testRangePartitionWithCustomHashSchemaBasic() throws Exception {
     final int valLower = 10;
     final int valUpper = 20;
@@ -704,9 +695,6 @@ public class TestKuduTable {
   }
 
   @Test(timeout = 100000)
-  @KuduTestHarness.MasterServerConfig(flags = {
-      "--enable_per_range_hash_schemas=true",
-  })
   public void testCreateTableCustomHashSchemasTwoRanges() throws Exception {
     CreateTableOptions builder = getBasicCreateTableOptions();
 
@@ -901,9 +889,6 @@ public class TestKuduTable {
   }
 
   @Test(timeout = 100000)
-  @KuduTestHarness.MasterServerConfig(flags = {
-      "--enable_per_range_hash_schemas=true",
-  })
   public void testCreateTableCustomHashSchemasTwoMixedRanges() throws 
Exception {
     CreateTableOptions builder = getBasicCreateTableOptions();
 
@@ -1090,9 +1075,6 @@ public class TestKuduTable {
   }
 
   @Test(timeout = 100000)
-  @KuduTestHarness.MasterServerConfig(flags = {
-      "--enable_per_range_hash_schemas=true",
-  })
   public void testCreateTableCustomHashSchemaDifferentDimensions() throws 
Exception {
     // Have the table-wide hash schema different from custom hash schema per
     // various ranges: it should not be possible to create a table.
@@ -1171,9 +1153,6 @@ public class TestKuduTable {
   }
 
   @Test(timeout = 100000)
-  @KuduTestHarness.MasterServerConfig(flags = {
-      "--enable_per_range_hash_schemas=true",
-  })
   public void testGetHashSchemaForRange() throws Exception {
     final int valLower = 100;
     final int valUpper = 200;
@@ -1260,9 +1239,6 @@ public class TestKuduTable {
   }
 
   @Test(timeout = 100000)
-  @KuduTestHarness.MasterServerConfig(flags = {
-      "--enable_per_range_hash_schemas=true",
-  })
   public void testGetHashSchemaForRangeUnbounded() throws Exception {
     // The test table is created with the following ranges:
     //   (-inf, -100) [-100, 0) [0, 100), [100, +inf)
@@ -1684,9 +1660,6 @@ public class TestKuduTable {
   }
 
   @Test(timeout = 100000)
-  @KuduTestHarness.MasterServerConfig(flags = {
-      "--enable_per_range_hash_schemas=true",
-  })
   public void testAlterTableAddRangePartitionCustomHashSchemaOverlapped() 
throws Exception {
     final List<ColumnSchema> columns = ImmutableList.of(
         new ColumnSchema.ColumnSchemaBuilder("key", 
Type.INT32).key(true).build(),
@@ -1768,9 +1741,6 @@ public class TestKuduTable {
   }
 
   @Test(timeout = 100000)
-  @KuduTestHarness.MasterServerConfig(flags = {
-      "--enable_per_range_hash_schemas=true",
-  })
   public void testAlterTableAddRangePartitionCustomHashSchema() throws 
Exception {
     final List<ColumnSchema> columns = ImmutableList.of(
         new ColumnSchema.ColumnSchemaBuilder("key", 
Type.INT32).key(true).build(),
diff --git 
a/java/kudu-client/src/test/java/org/apache/kudu/client/TestPartitionPruner.java
 
b/java/kudu-client/src/test/java/org/apache/kudu/client/TestPartitionPruner.java
index 60e576a4a..32c68ee7c 100644
--- 
a/java/kudu-client/src/test/java/org/apache/kudu/client/TestPartitionPruner.java
+++ 
b/java/kudu-client/src/test/java/org/apache/kudu/client/TestPartitionPruner.java
@@ -879,9 +879,6 @@ public class TestPartitionPruner {
   }
 
   @Test(timeout = 100000)
-  @KuduTestHarness.MasterServerConfig(flags = {
-      "--enable_per_range_hash_schemas=true",
-  })
   public void testPruningWithCustomHashSchemas() throws Exception {
     // CREATE TABLE timeseries
     //   (host STRING, metric STRING, timestamp UNIXTIME_MICROS, value DOUBLE)
diff --git a/src/kudu/client/client-test.cc b/src/kudu/client/client-test.cc
index 97a38618c..c86288e13 100644
--- a/src/kudu/client/client-test.cc
+++ b/src/kudu/client/client-test.cc
@@ -139,7 +139,6 @@ DECLARE_bool(allow_unsafe_replication_factor);
 DECLARE_bool(catalog_manager_support_live_row_count);
 DECLARE_bool(catalog_manager_support_on_disk_size);
 DECLARE_bool(client_use_unix_domain_sockets);
-DECLARE_bool(enable_per_range_hash_schemas);
 DECLARE_bool(enable_txn_system_client_init);
 DECLARE_bool(fail_dns_resolution);
 DECLARE_bool(location_mapping_by_uuid);
diff --git a/src/kudu/client/flex_partitioning_client-test.cc 
b/src/kudu/client/flex_partitioning_client-test.cc
index 17ed4baa0..8a56050d1 100644
--- a/src/kudu/client/flex_partitioning_client-test.cc
+++ b/src/kudu/client/flex_partitioning_client-test.cc
@@ -97,9 +97,6 @@ class FlexPartitioningTest : public KuduTest {
     // Reduce the TS<->Master heartbeat interval to speed up testing.
     FLAGS_heartbeat_interval_ms = 10;
 
-    // Explicitly enable support for custom hash schemas per range partition.
-    FLAGS_enable_per_range_hash_schemas = true;
-
     // Start minicluster and wait for tablet servers to connect to master.
     cluster_.reset(new InternalMiniCluster(env_, 
InternalMiniClusterOptions()));
     ASSERT_OK(cluster_->Start());
@@ -1667,10 +1664,8 @@ TEST_F(FlexPartitioningAlterTableTest, 
UnsupportedRangeSpecificHashSchema) {
 }
 
 // Make sure adding and dropping ranges with the table-wide hash schema works
-// as expected when --enable_per_range_hash_schemas=true.
+// as expected.
 TEST_F(FlexPartitioningAlterTableTest, AddDropTableWideHashSchemaPartitions) {
-  FLAGS_enable_per_range_hash_schemas = true;
-
   constexpr const char* const kTableName =
       "AddDropTableWideHashSchemaPartitions";
 
diff --git a/src/kudu/client/scan_token-test.cc 
b/src/kudu/client/scan_token-test.cc
index d0a6f5377..4ac87d8ce 100644
--- a/src/kudu/client/scan_token-test.cc
+++ b/src/kudu/client/scan_token-test.cc
@@ -62,7 +62,6 @@
 #include "kudu/util/test_macros.h"
 #include "kudu/util/test_util.h"
 
-DECLARE_bool(enable_per_range_hash_schemas);
 DECLARE_bool(tserver_enforce_access_control);
 
 
METRIC_DECLARE_histogram(handler_latency_kudu_master_MasterService_GetTableSchema);
@@ -583,7 +582,6 @@ TEST_F(ScanTokenTest, TestScanTokensWithNonCoveringRange) {
 }
 
 TEST_F(ScanTokenTest, ScanTokensWithCustomHashSchemasPerRange) {
-  FLAGS_enable_per_range_hash_schemas = true;
   KuduSchema schema;
   // Create schema
   {
@@ -732,7 +730,6 @@ TEST_F(ScanTokenTest, 
ScanTokensWithCustomHashSchemasPerRange) {
 }
 
 TEST_F(ScanTokenTest, TestScanTokensWithCustomHashSchemasPerNonCoveringRange) {
-  FLAGS_enable_per_range_hash_schemas = true;
   KuduSchema schema;
   // Create schema
   {
diff --git a/src/kudu/integration-tests/table_locations-itest.cc 
b/src/kudu/integration-tests/table_locations-itest.cc
index 94356c8f2..4d6829d7a 100644
--- a/src/kudu/integration-tests/table_locations-itest.cc
+++ b/src/kudu/integration-tests/table_locations-itest.cc
@@ -94,7 +94,6 @@ DEFINE_int32(benchmark_runtime_secs, 5, "Number of seconds to 
run the benchmark"
 DEFINE_int32(benchmark_num_threads, 16, "Number of threads to run the 
benchmark");
 DEFINE_int32(benchmark_num_tablets, 60, "Number of tablets to create");
 
-DECLARE_bool(enable_per_range_hash_schemas);
 DECLARE_double(leader_failure_max_missed_heartbeat_periods);
 DECLARE_int32(follower_unavailable_considered_failed_sec);
 DECLARE_int32(heartbeat_interval_ms);
@@ -475,8 +474,6 @@ TEST_F(TableLocationsTest, 
RangeSpecificHashingSameDimensions) {
                 }, 3);
   KuduPartialRow row(&schema);
 
-  FLAGS_enable_per_range_hash_schemas = true; // enable for testing.
-
   // Use back-to-back and sparse range placement.
   vector<pair<KuduPartialRow, KuduPartialRow>> bounds(5, { row, row });
   ASSERT_OK(bounds[0].first.SetStringNoCopy(0, "a"));
@@ -558,8 +555,6 @@ TEST_F(TableLocationsTest, 
RangeSpecificHashingVaryingDimensions) {
   Schema schema({ ColumnSchema("key", STRING), ColumnSchema("val", STRING) }, 
2);
   KuduPartialRow row(&schema);
 
-  FLAGS_enable_per_range_hash_schemas = true; // enable for testing.
-
   vector<pair<KuduPartialRow, KuduPartialRow>> bounds(2, { row, row });
   ASSERT_OK(bounds[0].first.SetStringNoCopy(0, "a"));
   ASSERT_OK(bounds[0].second.SetStringNoCopy(0, "b"));
diff --git a/src/kudu/master/catalog_manager.cc 
b/src/kudu/master/catalog_manager.cc
index 534405aa6..e52e4225b 100644
--- a/src/kudu/master/catalog_manager.cc
+++ b/src/kudu/master/catalog_manager.cc
@@ -353,8 +353,8 @@ DEFINE_uint32(table_locations_cache_capacity_mb, 0,
               "of 0 means table locations are not be cached");
 TAG_FLAG(table_locations_cache_capacity_mb, advanced);
 
-DEFINE_bool(enable_per_range_hash_schemas, false,
-            "Whether the ability to specify different hash schemas per range 
is enabled");
+DEFINE_bool(enable_per_range_hash_schemas, true,
+            "Whether to support range-specific hash schemas for tables");
 TAG_FLAG(enable_per_range_hash_schemas, advanced);
 TAG_FLAG(enable_per_range_hash_schemas, runtime);
 
diff --git a/src/kudu/master/master-test.cc b/src/kudu/master/master-test.cc
index 5161eb349..d6bdda02c 100644
--- a/src/kudu/master/master-test.cc
+++ b/src/kudu/master/master-test.cc
@@ -122,7 +122,6 @@ using strings::Substitute;
 
 DECLARE_bool(catalog_manager_check_ts_count_for_create_table);
 DECLARE_bool(enable_metadata_cleanup_for_deleted_tables_and_tablets);
-DECLARE_bool(enable_per_range_hash_schemas);
 DECLARE_bool(master_client_location_assignment_enabled);
 DECLARE_bool(master_support_authz_tokens);
 DECLARE_bool(mock_table_metrics_for_testing);
@@ -934,7 +933,6 @@ TEST_P(AlterTableWithRangeSpecificHashSchema, 
TestAlterTableWithDifferentHashDim
   constexpr const char* const kTableName = "testtb";
   const Schema kTableSchema({ColumnSchema("key", INT32),
                              ColumnSchema("val", INT32)}, 2);
-  FLAGS_enable_per_range_hash_schemas = true; // enable for testing.
   FLAGS_default_num_replicas = 1;
 
   // Create a table with one partition
@@ -1030,7 +1028,6 @@ TEST_F(MasterTest, 
AlterTableAddAndDropRangeWithSpecificHashSchema) {
   constexpr const char* const kCol1 = "c_int64";
   const Schema kTableSchema({ColumnSchema(kCol0, INT32),
                              ColumnSchema(kCol1, INT64)}, 2);
-  FLAGS_enable_per_range_hash_schemas = true;
   FLAGS_default_num_replicas = 1;
 
   // Create a table with one range partition based on the table-wide hash 
schema.
@@ -1280,7 +1277,6 @@ TEST_F(MasterTest, 
AlterTableAddDropRangeWithTableWideHashSchema) {
   const Schema kTableSchema({ColumnSchema(kCol0, INT32),
                              ColumnSchema(kCol1, INT64),
                              ColumnSchema(kCol2, STRING)}, 2);
-  FLAGS_enable_per_range_hash_schemas = true;
   FLAGS_default_num_replicas = 1;
 
   // Create a table with one range partition based on the table-wide hash 
schema.
@@ -1471,7 +1467,6 @@ TEST_F(MasterTest, TestCreateTableCheckRangeInvariants) {
   // on split rows.
   {
     google::FlagSaver flag_saver;
-    FLAGS_enable_per_range_hash_schemas = true;
     KuduPartialRow split1(&kTableSchema);
     ASSERT_OK(split1.SetInt32("key", 1));
     KuduPartialRow a_lower(&kTableSchema);
@@ -1495,7 +1490,6 @@ TEST_F(MasterTest, TestCreateTableCheckRangeInvariants) {
   // CreateTableRequestPB::partition_schema::custom_hash_schema_ranges fields.
   {
     google::FlagSaver flag_saver;
-    FLAGS_enable_per_range_hash_schemas = true;
     KuduPartialRow a_lower(&kTableSchema);
     KuduPartialRow a_upper(&kTableSchema);
     ASSERT_OK(a_lower.SetInt32("key", 0));
@@ -1744,9 +1738,6 @@ TEST_F(MasterTest, 
NonPrimaryKeyColumnsForPerRangeCustomHashSchema) {
   const Schema kTableSchema(
       { ColumnSchema("key", INT32), ColumnSchema("int32_val", INT32) }, 1);
 
-  // Explicitly enable support for per-range custom hash bucket schemas.
-  FLAGS_enable_per_range_hash_schemas = true;
-
   // For simplicity, a single tablet replica is enough.
   FLAGS_default_num_replicas = 1;
 

Reply via email to