You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by jl...@apache.org on 2019/01/30 23:23:52 UTC

[incubator-pinot] branch add-log-for-delete-table-api updated: Address PR comment

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

jlli pushed a commit to branch add-log-for-delete-table-api
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git


The following commit(s) were added to refs/heads/add-log-for-delete-table-api by this push:
     new 71b6015  Address PR comment
71b6015 is described below

commit 71b6015164588e13bbf7bf14565d0ee0c9f4746d
Author: Jack Li(Analytics Engineering) <jl...@jlli-mn1.linkedin.biz>
AuthorDate: Wed Jan 30 15:23:36 2019 -0800

    Address PR comment
---
 .../helix/core/PinotHelixResourceManager.java      | 42 ++++++++++++----------
 .../sharding/SegmentAssignmentStrategyTest.java    |  8 ++---
 2 files changed, 28 insertions(+), 22 deletions(-)

diff --git a/pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java b/pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java
index 3c976d2..f8fc8ba 100644
--- a/pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java
+++ b/pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java
@@ -1324,15 +1324,15 @@ public class PinotHelixResourceManager {
         }, RetryPolicies.exponentialBackoffRetryPolicy(5, 500L, 2.0f));
   }
 
-  public void deleteOfflineTable(String tableName) {
-    String offlineTableName = TableNameBuilder.OFFLINE.tableNameWithType(tableName);
-    LOGGER.info("Start deleting table: {}", offlineTableName);
+  public void deleteOfflineTable(String rawTableName) {
+    String offlineTableName = TableNameBuilder.OFFLINE.tableNameWithType(rawTableName);
+    LOGGER.info("Deleting table {}: Start", offlineTableName);
     long startTime = System.currentTimeMillis();
 
     // Remove the table from brokerResource
     HelixHelper.removeResourceFromBrokerIdealState(_helixZkManager, offlineTableName);
     long removeFromBrokerResourceFinishTime = System.currentTimeMillis();
-    LOGGER.info("Finish removing resource from broker resource in {}ms",
+    LOGGER.info("Deleting table {}: Removed from broker resource in {}ms", offlineTableName,
         (removeFromBrokerResourceFinishTime - startTime));
 
     // Drop the table
@@ -1340,37 +1340,40 @@ public class PinotHelixResourceManager {
       _helixAdmin.dropResource(_helixClusterName, offlineTableName);
     }
     long dropTableFinishTime = System.currentTimeMillis();
-    LOGGER.info("Finish dropping table in {}ms", (dropTableFinishTime - removeFromBrokerResourceFinishTime));
+    LOGGER.info("Deleting table {}: Dropped table in {}ms", offlineTableName,
+        (dropTableFinishTime - removeFromBrokerResourceFinishTime));
 
     // Remove all segments for the table
     _segmentDeletionManager.removeSegmentsFromStore(offlineTableName, getSegmentsFor(offlineTableName));
     ZKMetadataProvider.removeResourceSegmentsFromPropertyStore(_propertyStore, offlineTableName);
     long removeSegmentFinishTime = System.currentTimeMillis();
-    LOGGER.info("Finish removing segments in {}ms", (removeSegmentFinishTime - dropTableFinishTime));
+    LOGGER.info("Deleting table {}: Removed segments in {}ms", offlineTableName,
+        (removeSegmentFinishTime - dropTableFinishTime));
 
     // Remove table config
     ZKMetadataProvider.removeResourceConfigFromPropertyStore(_propertyStore, offlineTableName);
     long removeTableConfigFinishTime = System.currentTimeMillis();
-    LOGGER.info("Finish removing table config in {}ms", (removeTableConfigFinishTime - removeSegmentFinishTime));
+    LOGGER.info("Deleting table {}: Removed table config in {}ms", offlineTableName,
+        (removeTableConfigFinishTime - removeSegmentFinishTime));
 
     // Remove replica group partition assignment
     ZKMetadataProvider.removeInstancePartitionAssignmentFromPropertyStore(_propertyStore, offlineTableName);
     long removeReplicaGroupPartitionAssignment = System.currentTimeMillis();
-    LOGGER.info("Finish removing replica group partition assignment in {}ms",
+    LOGGER.info("Deleting table {}: Removed replica group partition assignment in {}ms", offlineTableName,
         (removeReplicaGroupPartitionAssignment - removeTableConfigFinishTime));
-    LOGGER.info("Finish deleting table {} in {}ms", offlineTableName,
+    LOGGER.info("Deleting table {}: Finish in {}ms", offlineTableName,
         (removeReplicaGroupPartitionAssignment - startTime));
   }
 
-  public void deleteRealtimeTable(String tableName) {
-    String realtimeTableName = TableNameBuilder.REALTIME.tableNameWithType(tableName);
-    LOGGER.info("Start deleting table: {}", realtimeTableName);
+  public void deleteRealtimeTable(String rawTableName) {
+    String realtimeTableName = TableNameBuilder.REALTIME.tableNameWithType(rawTableName);
+    LOGGER.info("Deleting table {}: Start", realtimeTableName);
     long startTime = System.currentTimeMillis();
 
     // Remove the table from brokerResource
     HelixHelper.removeResourceFromBrokerIdealState(_helixZkManager, realtimeTableName);
     long removeFromBrokerResourceFinishTime = System.currentTimeMillis();
-    LOGGER.info("Finish removing resource from broker resource in {}ms",
+    LOGGER.info("Deleting table {}: Removed from broker resource in {}ms", realtimeTableName,
         (removeFromBrokerResourceFinishTime - startTime));
 
     // Cache the state and drop the table
@@ -1380,18 +1383,21 @@ public class PinotHelixResourceManager {
       _helixAdmin.dropResource(_helixClusterName, realtimeTableName);
     }
     long dropTableFinishTime = System.currentTimeMillis();
-    LOGGER.info("Finish dropping table in {}ms", (dropTableFinishTime - removeFromBrokerResourceFinishTime));
+    LOGGER.info("Deleting table {}: Dropped table in {}ms", realtimeTableName,
+        (dropTableFinishTime - removeFromBrokerResourceFinishTime));
 
     // Remove all segments for the table
     _segmentDeletionManager.removeSegmentsFromStore(realtimeTableName, getSegmentsFor(realtimeTableName));
     ZKMetadataProvider.removeResourceSegmentsFromPropertyStore(_propertyStore, realtimeTableName);
     long removeSegmentFinishTime = System.currentTimeMillis();
-    LOGGER.info("Finish removing segments in {}ms", (removeSegmentFinishTime - dropTableFinishTime));
+    LOGGER.info("Deleting table {}: Removed segments in {}ms", realtimeTableName,
+        (removeSegmentFinishTime - dropTableFinishTime));
 
     // Remove table config
     ZKMetadataProvider.removeResourceConfigFromPropertyStore(_propertyStore, realtimeTableName);
     long removeTableConfigFinishTime = System.currentTimeMillis();
-    LOGGER.info("Finish removing table config in {}ms", (removeTableConfigFinishTime - removeSegmentFinishTime));
+    LOGGER.info("Deleting table {}: Removed table config in {}ms", realtimeTableName,
+        (removeTableConfigFinishTime - removeSegmentFinishTime));
 
     // Remove groupId/PartitionId mapping for HLC table
     if (instancesForTable != null) {
@@ -1404,9 +1410,9 @@ public class PinotHelixResourceManager {
       }
     }
     long removeReplicaGroupPartitionAssignment = System.currentTimeMillis();
-    LOGGER.info("Finish removing replica group partition assignment in {}ms",
+    LOGGER.info("Deleting table {}: Removed replica group partition assignment in {}ms", realtimeTableName,
         (removeReplicaGroupPartitionAssignment - removeTableConfigFinishTime));
-    LOGGER.info("Finish deleting table {} in {}ms", realtimeTableName,
+    LOGGER.info("Deleting table {}: Finish in {}ms", realtimeTableName,
         (removeReplicaGroupPartitionAssignment - startTime));
   }
 
diff --git a/pinot-controller/src/test/java/org/apache/pinot/controller/helix/core/sharding/SegmentAssignmentStrategyTest.java b/pinot-controller/src/test/java/org/apache/pinot/controller/helix/core/sharding/SegmentAssignmentStrategyTest.java
index d340921..9649a60 100644
--- a/pinot-controller/src/test/java/org/apache/pinot/controller/helix/core/sharding/SegmentAssignmentStrategyTest.java
+++ b/pinot-controller/src/test/java/org/apache/pinot/controller/helix/core/sharding/SegmentAssignmentStrategyTest.java
@@ -202,8 +202,8 @@ public class SegmentAssignmentStrategyTest {
   @Test
   public void testReplicaGroupPartitionAssignment()
       throws Exception {
-    String tableNameWithType =
-        TableNameBuilder.OFFLINE.tableNameWithType(TABLE_NAME_REPLICA_GROUP_PARTITION_ASSIGNMENT);
+    String rawTableName = TABLE_NAME_REPLICA_GROUP_PARTITION_ASSIGNMENT;
+    String tableNameWithType = TableNameBuilder.OFFLINE.tableNameWithType(rawTableName);
 
     // Adding a table without replica group
     TableConfig tableConfig = new TableConfig.Builder(CommonConstants.Helix.TableType.OFFLINE)
@@ -236,7 +236,7 @@ public class SegmentAssignmentStrategyTest {
     Assert.assertTrue(partitionAssignment != null);
 
     // After table deletion, check that the replica group partition assignment is deleted
-    _pinotHelixResourceManager.deleteOfflineTable(tableNameWithType);
+    _pinotHelixResourceManager.deleteOfflineTable(rawTableName);
     partitionAssignment = _partitionAssignmentGenerator.getReplicaGroupPartitionAssignment(tableNameWithType);
     Assert.assertTrue(partitionAssignment == null);
 
@@ -246,7 +246,7 @@ public class SegmentAssignmentStrategyTest {
     Assert.assertTrue(partitionAssignment != null);
 
     // Check that the replica group partition assignment is deleted
-    _pinotHelixResourceManager.deleteOfflineTable(tableNameWithType);
+    _pinotHelixResourceManager.deleteOfflineTable(rawTableName);
     partitionAssignment = _partitionAssignmentGenerator.getReplicaGroupPartitionAssignment(tableNameWithType);
     Assert.assertTrue(partitionAssignment == null);
   }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org