[ 
https://issues.apache.org/jira/browse/PHOENIX-6655?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17646862#comment-17646862
 ] 

ASF GitHub Bot commented on PHOENIX-6655:
-----------------------------------------

virajjasani commented on code in PR #1534:
URL: https://github.com/apache/phoenix/pull/1534#discussion_r1047842719


##########
phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java:
##########
@@ -4373,10 +4380,39 @@ private PhoenixConnection upgradeSystemSequence(
             } else {
                 nSequenceSaltBuckets = getSaltBuckets(e);
             }
+
+            updateSystemSequenceWithCacheOnWriteProps(metaConnection);
         }
         return metaConnection;
     }
 
+    private void updateSystemSequenceWithCacheOnWriteProps(PhoenixConnection 
metaConnection) throws
+        IOException, SQLException {
+
+        try (Admin admin = getAdmin()) {
+            PTable pTable = PhoenixRuntime.getTable(metaConnection,
+                PhoenixDatabaseMetaData.SYSTEM_SEQUENCE_NAME);
+            TableDescriptor oldTD = admin.getDescriptor(
+                
SchemaUtil.getPhysicalTableName(PhoenixDatabaseMetaData.SYSTEM_SEQUENCE_NAME,
+                    metaConnection.getQueryServices().getProps()));
+            ColumnFamilyDescriptor oldCf = oldTD.getColumnFamily(
+                SchemaUtil.getEmptyColumnFamily(pTable));
+
+            // If the CacheOnWrite related properties are not set, lets set 
them.
+            if (!oldCf.isCacheDataOnWrite()) {

Review Comment:
   +1





> SYSTEM.SEQUENCE should have CACHE_DATA_ON_WRITE set to true
> -----------------------------------------------------------
>
>                 Key: PHOENIX-6655
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-6655
>             Project: Phoenix
>          Issue Type: Improvement
>            Reporter: Geoffrey Jacoby
>            Assignee: Gourab Taparia
>            Priority: Major
>         Attachments: Screenshot 2022-11-25 at 4.38.38 PM.png
>
>
> High volume use cases of Phoenix sequences need to write to the same row of 
> SYSTEM.SEQUENCE very frequently, but each time we write, the block cache that 
> row is in is invalidated and has to be loaded again. 
> [~rushabh.shah] was looking at a case in our environment where a sequence was 
> being used heavily and found lots of time spent reading the HFiles for the 
> same Get of the sequence row within the SequenceRegionObserver increment 
> coproc. 
> [~apurtell] pointed out offline that HColumnDescriptor has a property, 
> CACHE_DATA_ON_WRITE that keeps caches updated when a value is flushed. This 
> should help improve contention on sequence increments. 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to