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

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

gjacoby126 commented on a change in pull request #1286:
URL: https://github.com/apache/phoenix/pull/1286#discussion_r689876158



##########
File path: 
phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ViewIndexIT.java
##########
@@ -522,6 +527,9 @@ private void createTableForRowKeyTestsAndVerify(Connection 
conn, String viewPkCo
         String actualExplainPlan = QueryUtil.getExplainPlan(rs1);
         assertTrue(actualExplainPlan.contains("_IDX_" + fullTableName));
 
+        SingleCellIndexIT.dumpTable("_IDX_" + fullTableName);

Review comment:
       Please remove dumpTable statements before merging

##########
File path: 
phoenix-core/src/main/java/org/apache/phoenix/index/IndexMaintainer.java
##########
@@ -846,18 +847,19 @@ public void setDataEncodingScheme(QualifierEncodingScheme 
sc) {
                 // Write separator byte if variable length unless it's the 
last field in the schema
                 // (but we still need to write it if it's DESC to ensure sort 
order is correct).
                 byte sepByte = 
SchemaUtil.getSeparatorByte(rowKeyOrderOptimizable, ptr.getLength() == 0, 
dataRowKeySchema.getField(i));
-                if (!dataRowKeySchema.getField(i).getDataType().isFixedWidth() 
&& (((i+1) !=  dataRowKeySchema.getFieldCount()) || sepByte == 
QueryConstants.DESC_SEPARATOR_BYTE)) {
+                if 
(!dataRowKeySchema.getField(i).getDataType().isFixedWidth()){

Review comment:
       Need to fix comment on line 848 which refers to the logic you're changing

##########
File path: 
phoenix-core/src/main/java/org/apache/phoenix/index/IndexMaintainer.java
##########
@@ -846,18 +847,19 @@ public void setDataEncodingScheme(QualifierEncodingScheme 
sc) {
                 // Write separator byte if variable length unless it's the 
last field in the schema
                 // (but we still need to write it if it's DESC to ensure sort 
order is correct).
                 byte sepByte = 
SchemaUtil.getSeparatorByte(rowKeyOrderOptimizable, ptr.getLength() == 0, 
dataRowKeySchema.getField(i));
-                if (!dataRowKeySchema.getField(i).getDataType().isFixedWidth() 
&& (((i+1) !=  dataRowKeySchema.getFieldCount()) || sepByte == 
QueryConstants.DESC_SEPARATOR_BYTE)) {
+                if 
(!dataRowKeySchema.getField(i).getDataType().isFixedWidth()){
                     output.writeByte(sepByte);
+                    trailingVariableWidthColumnNum++;
+                } else {
+                    trailingVariableWidthColumnNum = 0;
                 }
             }
             int length = stream.size();
-            int minLength = length - maxTrailingNulls;
             byte[] dataRowKey = stream.getBuffer();
             // Remove trailing nulls
-            int index = dataRowKeySchema.getFieldCount() - 1;
-            while (index >= 0 && 
!dataRowKeySchema.getField(index).getDataType().isFixedWidth() && length > 
minLength && dataRowKey[length-1] == QueryConstants.SEPARATOR_BYTE) {
+            while (trailingVariableWidthColumnNum > 0 && dataRowKey[length-1] 
== QueryConstants.SEPARATOR_BYTE) {

Review comment:
       What if it's the DESC_SEPARATOR_BYTE? wouldn't we need to continue the 
loop and decrement trailingVariableWidthColumnNum? The old logic only needed to 
check the asc SEPARATOR_BYTE but that's because it only wrote a SEPARATOR_BYTE 
in the asc case, but that's changed now above.




-- 
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: issues-unsubscr...@phoenix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> When view index pk has a variable length column, read repair doesn't work 
> correctly
> -----------------------------------------------------------------------------------
>
>                 Key: PHOENIX-6528
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-6528
>             Project: Phoenix
>          Issue Type: Bug
>    Affects Versions: 4.14.3
>            Reporter: Gokcen Iskender
>            Assignee: Gokcen Iskender
>            Priority: Critical
>
> If a view index rowkey has a variable length column, read repair might work 
> incorrectly. We fixed PHOENIX-6266 and same fix should be applied to the case 
> where the index row is UNVERIFIED so that read repair happens.
> This only happens for view indexes (mutitenant or not)
> This is the reason 
> org.apache.phoenix.end2end.index.ViewIndexIT.testRowKeyComposition[ViewIndexIT_isNamespaceMapped=false]
>  sometimes flaps



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to