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

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

tkhurana commented on code in PR #1570:
URL: https://github.com/apache/phoenix/pull/1570#discussion_r1131742664


##########
phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertValuesIT.java:
##########
@@ -480,10 +488,14 @@ public void testBatchedUpsert() throws Exception {
             pstmt.addBatch();
             pstmt.executeBatch();
             conn.commit();
+            PhoenixConnection pConn = conn.unwrap(PhoenixConnection.class);
+            Map<String, Map<MetricType, Long>> mutationMetrics = 
pConn.getMutationMetrics();

Review Comment:
   You should also check that the underlying mutation state inside connection 
has joined all the statements in the batch. You can check the value of 
`connection.getMutationState().getUpdateCount()`





> Batching with auto-commit connections
> -------------------------------------
>
>                 Key: PHOENIX-6821
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-6821
>             Project: Phoenix
>          Issue Type: Improvement
>            Reporter: Kadir Ozdemir
>            Assignee: Hari Krishna Dara
>            Priority: Major
>
> Phoenix commits the commands of a batch individually when executeBatch() is 
> called if auto commit is enabled on the connection.  For example, if a batch 
> of 100 upsert statements is created using addBatch() within an auto-commit 
> mode connection then when executeBatch() is called, Phoenix creates 100 HBase 
> batches each with a single mutation, i.e., one for each upsert. This defeats 
> the purpose of batching. The correct behavior is to commit the entire batch 
> of upsert statements using the minimum number of HBase batches. This means if 
> the entire batch of upsert statements fits in a single HBase batch, then one 
> HBase batch should be used.
> Please note for connections without auto-commit, Phoenix behaves correctly, 
> that is, the entire batch of upsert commands is committed using the minimum 
> number of HBase batches.



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

Reply via email to