virajjasani commented on PR #1534:
URL: https://github.com/apache/phoenix/pull/1534#issuecomment-1331114308
Since DDL SQL statement doesn't allow updating CF properties, we should use
Admin API.
Let's see if this can help:
```
diff --git
a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
index aedf2ed27..e05c1438e 100644
---
a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
+++
b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
@@ -63,6 +63,7 @@ import static
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.TASK_TABLE_TTL;
import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.TENANT_ID;
import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.TRANSACTIONAL;
import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.TTL_FOR_MUTEX;
+import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.TYPE_SEQUENCE;
import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.VIEW_CONSTANT;
import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.VIEW_INDEX_ID;
import static
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.SYSTEM_CATALOG_HBASE_TABLE_NAME;
@@ -4202,6 +4203,7 @@ public class ConnectionQueryServicesImpl extends
DelegateQueryServices implement
// snapshot entries
metaConnection =
upgradeOtherSystemTablesIfRequired(metaConnection,
moveChildLinks, systemTableToSnapshotMap);
+ updateSystemSequenceWithCacheOnWriteProps();
// Synchronize necessary properties amongst all column families
of a base table
// and its indexes. See PHOENIX-3955
if (syncAllTableAndIndexProps) {
@@ -4256,6 +4258,25 @@ public class ConnectionQueryServicesImpl extends
DelegateQueryServices implement
}
}
+ private void updateSystemSequenceWithCacheOnWriteProps() throws
IOException, SQLException {
+ try (Admin admin = getAdmin()) {
+ try (Table table = connection.getTable(
+ TableName.valueOf(SYSTEM_CATALOG_SCHEMA + "." +
TYPE_SEQUENCE))) {
+ TableDescriptor oldTd = table.getDescriptor();
+ ColumnFamilyDescriptor oldCf =
oldTd.getColumnFamily(QueryConstants.DEFAULT_COLUMN_FAMILY_BYTES);
+ if (!oldCf.isCacheDataOnWrite()) {
+ ColumnFamilyDescriptorBuilder newCfBuilder =
ColumnFamilyDescriptorBuilder.newBuilder(oldCf);
+ newCfBuilder.setCacheBloomsOnWrite(true);
+ newCfBuilder.setCacheDataOnWrite(true);
+ newCfBuilder.setCacheIndexesOnWrite(true);
+ TableDescriptorBuilder newTd =
TableDescriptorBuilder.newBuilder(oldTd);
+ newTd.setColumnFamily(newCfBuilder.build());
+ admin.modifyTable(newTd.build());
+ }
+ }
+ }
+ }
+
/**
* Create or upgrade SYSTEM tables other than SYSTEM.CATALOG
* @param metaConnection Phoenix connection
```
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]