This is an automated email from the ASF dual-hosted git repository.
shahrs87 pushed a commit to branch PHOENIX-6883-feature
in repository https://gitbox.apache.org/repos/asf/phoenix.git
The following commit(s) were added to refs/heads/PHOENIX-6883-feature by this
push:
new 7b71c11061 PHOENIX-7297 : Update cache before retrying if Drop Column
encounters a ConcurrentTableMutationException (#1867)
7b71c11061 is described below
commit 7b71c110618884f82390f7b13731f708f7d996ae
Author: palash <[email protected]>
AuthorDate: Mon Apr 1 15:45:50 2024 -0700
PHOENIX-7297 : Update cache before retrying if Drop Column encounters a
ConcurrentTableMutationException (#1867)
---
.../org/apache/phoenix/schema/MetaDataClient.java | 23 ++++++++++++++++------
1 file changed, 17 insertions(+), 6 deletions(-)
diff --git
a/phoenix-core-client/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
b/phoenix-core-client/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
index 6f390006e1..e9550fc482 100644
---
a/phoenix-core-client/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
+++
b/phoenix-core-client/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
@@ -4743,12 +4743,16 @@ public class MetaDataClient {
.setColumnName(columnToDrop.getName().getString()).build().buildException();
}
columnsToDrop.add(new ColumnRef(columnRef.getTableRef(),
columnToDrop.getPosition()));
- boolean acquiredMutex = writeCell(null, physicalSchemaName,
- physicalTableName, columnToDrop.toString());
- if (!acquiredMutex) {
- throw new
ConcurrentTableMutationException(physicalSchemaName, physicalTableName);
+ // check if client is already holding a mutex from
previous retry
+ if
(!acquiredColumnMutexSet.contains(columnToDrop.toString())) {
+ boolean acquiredMutex = writeCell(null,
physicalSchemaName,
+ physicalTableName, columnToDrop.toString());
+ if (!acquiredMutex) {
+ throw new
ConcurrentTableMutationException(physicalSchemaName,
+
physicalTableName);
+ }
+ acquiredColumnMutexSet.add(columnToDrop.toString());
}
- acquiredColumnMutexSet.add(columnToDrop.toString());
}
dropColumnMutations(table, tableColumnsToDrop);
@@ -4974,7 +4978,14 @@ public class MetaDataClient {
if (retried) {
throw e;
}
- table = connection.getTable(fullTableName);
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug(LogUtil.addCustomAnnotations(
+ "Caught ConcurrentTableMutationException for table
"
+ +
SchemaUtil.getTableName(e.getSchemaName(), e.getTableName())
+ + ". Will update cache and try again...",
connection));
+ }
+ updateCache(connection.getTenantId(),
+ e.getSchemaName(), e.getTableName(), true);
retried = true;
} catch (Throwable e) {
TableMetricsManager.updateMetricsForSystemCatalogTableMethod(tableName,
NUM_METADATA_LOOKUP_FAILURES, 1);