ChinmaySKulkarni commented on a change in pull request #883:
URL: https://github.com/apache/phoenix/pull/883#discussion_r488956433
##########
File path:
phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
##########
@@ -3286,6 +3288,43 @@ void createSysMutexTableIfNotExists(HBaseAdmin admin)
throws IOException, SQLExc
}
}
+ /**
+ * Check if the SYSTEM MUTEX table exists. If it does, ensure that its TTL
is correct and if
+ * not, modify its table descriptor
+ * @param admin HBase admin
+ * @return true if SYSTEM MUTEX exists already and false if it needs to be
created
+ * @throws IOException thrown if there is an error getting the table
descriptor
+ */
+ @VisibleForTesting
+ boolean checkIfSysMutexExistsAndModifyTTLIfRequired(HBaseAdmin admin)
throws IOException {
+ HTableDescriptor htd;
+ try {
+ htd = admin.getTableDescriptor(Bytes.toBytes(SYSTEM_MUTEX_NAME));
+ } catch (org.apache.hadoop.hbase.TableNotFoundException ignored) {
+ try {
+ // Try with the namespace mapping name
+ htd =
admin.getTableDescriptor(TableName.valueOf(SYSTEM_SCHEMA_NAME,
+ SYSTEM_MUTEX_TABLE_NAME));
+ } catch (org.apache.hadoop.hbase.TableNotFoundException ignored2) {
+ return false;
+ }
+ }
+
+ // The SYSTEM MUTEX table already exists so check its TTL
+ if (htd.getFamily(SYSTEM_MUTEX_FAMILY_NAME_BYTES).getTimeToLive() !=
TTL_FOR_MUTEX) {
Review comment:
@twdsilva yes, it is basically `DEFAULT_COLUMN_FAMILY` i.e. "0"
----------------------------------------------------------------
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]