Skip to content

Commit f28419c

Browse files
authored
reset PayloadContentSize after relogin, because the new credential may be different with the old one (#399)
1 parent ca63d43 commit f28419c

File tree

5 files changed

+24
-0
lines changed

5 files changed

+24
-0
lines changed

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

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

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

243+
243244
/**
244245
* Reset the cached payload content size to force recalculation
245246
* Subclasses should override this method to reset their own cached sizes
246247
* and call this method on their child objects
247248
*/
249+
@Override
248250
public void resetPayloadContentSize() {
249251
this.payLoadContentSize = INVALID_PAYLOAD_CONTENT_SIZE;
250252
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,4 +97,5 @@ public interface ObPayload extends ObUnisVersion {
9797
*/
9898
long getPayloadContentSize();
9999

100+
void resetPayloadContentSize();
100101
}

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,4 +168,14 @@ public long getPayloadContentSize() {
168168
return this.payLoadContentSize;
169169
}
170170

171+
@Override
172+
public void resetPayloadContentSize() {
173+
super.resetPayloadContentSize();
174+
for (ObHbaseCell cell : cells) {
175+
if (cell != null) {
176+
cell.resetPayloadContentSize();
177+
}
178+
}
179+
}
180+
171181
}

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,16 @@ public long getPayloadContentSize() {
155155
return payLoadContentSize;
156156
}
157157

158+
@Override
159+
public void resetPayloadContentSize() {
160+
super.resetPayloadContentSize();
161+
for (ObHbaseCfRows cfRows : cfRows) {
162+
if (cfRows != null) {
163+
cfRows.resetPayloadContentSize();
164+
}
165+
}
166+
}
167+
158168
public void setTimeout(long timeout) {
159169
this.timeout = timeout;
160170
}

src/main/java/com/alipay/oceanbase/rpc/table/ObTable.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,7 @@ private ObPayload executeWithReconnect(ObTableConnection connection, final ObPay
461461
connection.getObTable().getIp(), connection.getObTable().getPort(),
462462
connection.getTenantId(), retryTimes);
463463
connection.reConnectAndLogin(msg);
464+
request.resetPayloadContentSize();
464465
needReconnect = false;
465466
}
466467
payload = realClient.invokeSync(connection, request, obTableExecuteTimeout);

0 commit comments

Comments
 (0)