virajjasani commented on a change in pull request #923:
URL: https://github.com/apache/phoenix/pull/923#discussion_r506169651
##########
File path:
phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
##########
@@ -4006,6 +4037,33 @@ private PhoenixConnection
upgradeSystemTask(PhoenixConnection metaConnection)
"ALTER TABLE " + taskTableFullName + " SET " + TTL +
"=" + TASK_TABLE_TTL);
clearCache();
}
+ // If SYSTEM.TASK does not have disabled regions split policy,
+ // set it up here while upgrading it
+ try (Admin admin = metaConnection.getQueryServices().getAdmin()) {
+ String tableNameStr = PhoenixDatabaseMetaData.SYSTEM_TASK_NAME;
+ TableName tableName;
+ TableDescriptor td;
+ try {
+ tableName = TableName.valueOf(tableNameStr);
+ td = admin.getDescriptor(tableName);
+ } catch (org.apache.hadoop.hbase.TableNotFoundException tnfe) {
+ tableNameStr = tableNameStr.replace(
+ QueryConstants.NAME_SEPARATOR,
+ QueryConstants.NAMESPACE_SEPARATOR);
+ tableName = TableName.valueOf(tableNameStr);
+ td = admin.getDescriptor(tableName);
+ }
+ TableDescriptorBuilder tableDescriptorBuilder =
+ TableDescriptorBuilder.newBuilder(td);
+ if (isSplitPolicyUpdatedForTaskTable(tableDescriptorBuilder)) {
+ admin.modifyTable(tableDescriptorBuilder.build());
+ pollForUpdatedTableDescriptor(admin,
+ tableDescriptorBuilder.build(), tableName.getName());
+ }
+ } catch (InterruptedException | TimeoutException ite) {
+ throw new SQLException(PhoenixDatabaseMetaData.SYSTEM_TASK_NAME
Review comment:
I could find `UpgradeInProgressException`, `UpgradeNotRequiredException`
and `UpgradeRequiredException`. Perhaps they don't fit well here? Thought?
##########
File path:
phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
##########
@@ -1451,7 +1454,35 @@ private TableDescriptor ensureTableCreated(byte[]
physicalTableName, PTableType
}
return null; // will never make it here
}
-
+
+ private boolean isSplitPolicyUpdatedForTaskTable(
+ final TableDescriptorBuilder tdBuilder) {
Review comment:
Done
##########
File path:
phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
##########
@@ -4006,6 +4037,33 @@ private PhoenixConnection
upgradeSystemTask(PhoenixConnection metaConnection)
"ALTER TABLE " + taskTableFullName + " SET " + TTL +
"=" + TASK_TABLE_TTL);
clearCache();
}
+ // If SYSTEM.TASK does not have disabled regions split policy,
+ // set it up here while upgrading it
+ try (Admin admin = metaConnection.getQueryServices().getAdmin()) {
Review comment:
Added a test on `BackwardsCompatibilityIT`. Tested on 4.x with
compatible client versions: 4.14.3 and 4.15.0.
For one, split policy was set by DDL statement at server and for another,
upgrade path was followed to ensure split policy is updated.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]