Skip to content

Commit 57e22c6

Browse files
committed
fix bug for indexName encode
1 parent 210ee9c commit 57e22c6

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/main/java/com/alipay/oceanbase/rpc/protocol/payload/impl/execute/ObTableSingleOpQuery.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public void encode(ObByteBuf buf) {
114114
encodeHeader(buf);
115115

116116
// 1. encode index name
117-
if (indexName == null || indexName.isEmpty() || indexName.compareToIgnoreCase("PRIMARY") == 0) {
117+
if (indexName != null && indexName.compareToIgnoreCase("PRIMARY") == 0) {
118118
buf.writeBytes(primaryIndexByteArray);
119119
} else {
120120
Serialization.encodeVString(buf, indexName);
@@ -207,8 +207,11 @@ public long getPayloadContentSize() {
207207
for (ObNewRange range : keyRanges) {
208208
payloadContentSize += ObTableSerialUtil.getEncodedSize(range);
209209
}
210-
211-
payloadContentSize += Serialization.getNeedBytes(indexName);
210+
if (indexName != null && indexName.compareToIgnoreCase("PRIMARY") == 0) {
211+
payloadContentSize += primaryIndexByteArray.length;
212+
} else {
213+
payloadContentSize += Serialization.getNeedBytes(indexName);
214+
}
212215
payloadContentSize += Serialization.getNeedBytes(filterString);
213216

214217
// calculate part required by HBase Batch Get

0 commit comments

Comments
 (0)