twdsilva commented on a change in pull request #883:
URL: https://github.com/apache/phoenix/pull/883#discussion_r488935507
##########
File path:
phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java
##########
@@ -224,6 +224,7 @@
public static final String TASK_PRIORITY = "TASK_PRIORITY";
public static final String TASK_DATA = "TASK_DATA";
public static final String TASK_TABLE_TTL = "864000";
+ public static final int TTL_FOR_MUTEX = 15 * 60; // 15min
Review comment:
We just picked a long enough time so that the client that created the
mutex would be able to complete the metadata operation.
##########
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:
I assume the ``SYSTEM_MUTEX_FAMILY_NAME_BYTES`` column family should
always exist.
----------------------------------------------------------------
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]