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/02/01 19:30:38 UTC
[incubator-pinot] branch master updated: Add log for delete table
API (#3763)
This is an automated email from the ASF dual-hosted git repository.
jlli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git
The following commit(s) were added to refs/heads/master by this push:
new 1c7b03f Add log for delete table API (#3763)
1c7b03f is described below
commit 1c7b03f0c494893b36dfdcb2dea28af9171c9400
Author: Jialiang Li <jl...@linkedin.com>
AuthorDate: Fri Feb 1 11:30:33 2019 -0800
Add log for delete table API (#3763)
* Add log for delete table API
---
.../helix/core/PinotHelixResourceManager.java | 32 ++++++++++++++++++----
.../sharding/SegmentAssignmentStrategyTest.java | 8 +++---
2 files changed, 30 insertions(+), 10 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 ed9b604..4e59582 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,47 +1324,65 @@ public class PinotHelixResourceManager {
}, RetryPolicies.exponentialBackoffRetryPolicy(5, 500L, 2.0f));
}
- public void deleteOfflineTable(String tableName) {
- String offlineTableName = TableNameBuilder.OFFLINE.tableNameWithType(tableName);
+ public void deleteOfflineTable(String rawTableName) {
+ String offlineTableName = TableNameBuilder.OFFLINE.tableNameWithType(rawTableName);
+ LOGGER.info("Deleting table {}: Start", offlineTableName);
// Remove the table from brokerResource
HelixHelper.removeResourceFromBrokerIdealState(_helixZkManager, offlineTableName);
+ LOGGER.info("Deleting table {}: Removed from broker resource", offlineTableName);
// Drop the table
if (_helixAdmin.getResourcesInCluster(_helixClusterName).contains(offlineTableName)) {
_helixAdmin.dropResource(_helixClusterName, offlineTableName);
+ LOGGER.info("Deleting table {}: Removed helix table resource", offlineTableName);
}
- // Remove all segments for the table
+ // Remove all stored segments for the table
_segmentDeletionManager.removeSegmentsFromStore(offlineTableName, getSegmentsFor(offlineTableName));
+ LOGGER.info("Deleting table {}: Removed stored segments", offlineTableName);
+
+ // Remove segment metadata
ZKMetadataProvider.removeResourceSegmentsFromPropertyStore(_propertyStore, offlineTableName);
+ LOGGER.info("Deleting table {}: Removed segment metadata", offlineTableName);
// Remove table config
ZKMetadataProvider.removeResourceConfigFromPropertyStore(_propertyStore, offlineTableName);
+ LOGGER.info("Deleting table {}: Removed table config", offlineTableName);
// Remove replica group partition assignment
ZKMetadataProvider.removeInstancePartitionAssignmentFromPropertyStore(_propertyStore, offlineTableName);
+ LOGGER.info("Deleting table {}: Removed replica group partition assignment", offlineTableName);
+ LOGGER.info("Deleting table {}: Finish", offlineTableName);
}
- public void deleteRealtimeTable(String tableName) {
- String realtimeTableName = TableNameBuilder.REALTIME.tableNameWithType(tableName);
+ public void deleteRealtimeTable(String rawTableName) {
+ String realtimeTableName = TableNameBuilder.REALTIME.tableNameWithType(rawTableName);
+ LOGGER.info("Deleting table {}: Start", realtimeTableName);
// Remove the table from brokerResource
HelixHelper.removeResourceFromBrokerIdealState(_helixZkManager, realtimeTableName);
+ LOGGER.info("Deleting table {}: Removed from broker resource", realtimeTableName);
// Cache the state and drop the table
Set<String> instancesForTable = null;
if (_helixAdmin.getResourcesInCluster(_helixClusterName).contains(realtimeTableName)) {
instancesForTable = getAllInstancesForTable(realtimeTableName);
_helixAdmin.dropResource(_helixClusterName, realtimeTableName);
+ LOGGER.info("Deleting table {}: Removed helix table resource", realtimeTableName);
}
- // Remove all segments for the table
+ // Remove all stored segments for the table
_segmentDeletionManager.removeSegmentsFromStore(realtimeTableName, getSegmentsFor(realtimeTableName));
+ LOGGER.info("Deleting table {}: Removed stored segments", realtimeTableName);
+
+ // Remove segment metadata
ZKMetadataProvider.removeResourceSegmentsFromPropertyStore(_propertyStore, realtimeTableName);
+ LOGGER.info("Deleting table {}: Removed segment metadata", realtimeTableName);
// Remove table config
ZKMetadataProvider.removeResourceConfigFromPropertyStore(_propertyStore, realtimeTableName);
+ LOGGER.info("Deleting table {}: Removed table config", realtimeTableName);
// Remove groupId/PartitionId mapping for HLC table
if (instancesForTable != null) {
@@ -1376,6 +1394,8 @@ public class PinotHelixResourceManager {
}
}
}
+ LOGGER.info("Deleting table {}: Removed replica group partition assignment", realtimeTableName);
+ LOGGER.info("Deleting table {}: Finish", realtimeTableName);
}
/**
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