Skip to content

Commit ba38bf7

Browse files
committed
fix lsop encode error
1 parent f34336a commit ba38bf7

File tree

7 files changed

+86
-0
lines changed

7 files changed

+86
-0
lines changed

src/main/java/com/alipay/oceanbase/rpc/protocol/payload/AbstractPayload.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,4 +240,13 @@ protected byte[] encodeDefaultBytes() {
240240

241241
protected boolean isUseDefaultEncode() { return false; }
242242

243+
/**
244+
* Reset the cached payload content size to force recalculation
245+
* Subclasses should override this method to reset their own cached sizes
246+
* and call this method on their child objects
247+
*/
248+
public void resetPayloadContentSize() {
249+
this.payLoadContentSize = INVALID_PAYLOAD_CONTENT_SIZE;
250+
}
251+
243252
}

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,4 +160,15 @@ public void setCredential(ObBytesString credential) {
160160
public void setTableId(long tableId) {
161161
this.lsOperation.setTableId(tableId);
162162
}
163+
164+
/**
165+
* Reset the cached payload content size and propagate to child objects
166+
*/
167+
@Override
168+
public void resetPayloadContentSize() {
169+
super.resetPayloadContentSize();
170+
if (lsOperation != null) {
171+
lsOperation.resetPayloadContentSize();
172+
}
173+
}
163174
}

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,19 @@ public long getPayloadContentSize() {
230230

231231
}
232232

233+
/**
234+
* Reset the cached payload content size and propagate to child objects
235+
*/
236+
@Override
237+
public void resetPayloadContentSize() {
238+
super.resetPayloadContentSize();
239+
for (ObTableTabletOp operation : tabletOperations) {
240+
if (operation != null) {
241+
operation.resetPayloadContentSize();
242+
}
243+
}
244+
}
245+
233246
/*
234247
* Get table operations.
235248
*/
@@ -372,6 +385,7 @@ public void prepareColumnNamesBitMap() {
372385
}
373386

374387
public void prepare() {
388+
this.resetPayloadContentSize(); // to avoid use wrong cached when do retry
375389
this.collectColumnNamesIdxMap();
376390
this.beforeOption();
377391
this.prepareOption();

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,22 @@ public long getPayloadContentSize() {
143143
return this.payLoadContentSize;
144144
}
145145

146+
/**
147+
* Reset the cached payload content size and propagate to child objects
148+
*/
149+
@Override
150+
public void resetPayloadContentSize() {
151+
super.resetPayloadContentSize();
152+
if (query != null) {
153+
query.resetPayloadContentSize();
154+
}
155+
for (ObTableSingleOpEntity entity : entities) {
156+
if (entity != null) {
157+
entity.resetPayloadContentSize();
158+
}
159+
}
160+
}
161+
146162
public List<ObNewRange> getScanRange() {
147163
return query.getScanRanges();
148164
}

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,15 @@ public long getPayloadContentSize() {
224224
return this.payLoadContentSize;
225225
}
226226

227+
/**
228+
* Reset the cached payload content size
229+
* This class has no child objects, so just call super
230+
*/
231+
@Override
232+
public void resetPayloadContentSize() {
233+
super.resetPayloadContentSize();
234+
}
235+
227236
public static boolean areArraysSameLengthOrBothNull(Object[] a, Object[] b) {
228237
if (a == null && b == null) {
229238
return true;

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,20 @@ public long getPayloadContentSize() {
239239
return this.payLoadContentSize;
240240
}
241241

242+
/**
243+
* Reset the cached payload content size and propagate to child objects
244+
*/
245+
@Override
246+
public void resetPayloadContentSize() {
247+
super.resetPayloadContentSize();
248+
if (hTableFilter != null) {
249+
hTableFilter.resetPayloadContentSize();
250+
}
251+
if (obKVParams != null) {
252+
obKVParams.resetPayloadContentSize();
253+
}
254+
}
255+
242256
// Support class, which is used for column name sorted
243257
private static class ColumnNamePair implements Comparable<ColumnNamePair> {
244258
long number;

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,19 @@ public long getPayloadContentSize() {
135135
return this.payLoadContentSize;
136136
}
137137

138+
/**
139+
* Reset the cached payload content size and propagate to child objects
140+
*/
141+
@Override
142+
public void resetPayloadContentSize() {
143+
super.resetPayloadContentSize();
144+
for (ObTableSingleOp operation : singleOperations) {
145+
if (operation != null) {
146+
operation.resetPayloadContentSize();
147+
}
148+
}
149+
}
150+
138151
/*
139152
* Get table operations.
140153
*/

0 commit comments

Comments
 (0)