Skip to content

Commit 3b46700

Browse files
authored
add log for ObSingleOpEntity decode err (#396)
1 parent 8fe6c37 commit 3b46700

File tree

3 files changed

+39
-26
lines changed

3 files changed

+39
-26
lines changed

src/main/java/com/alipay/oceanbase/rpc/bolt/transport/ObTableRemoting.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,13 @@ public ObPayload invokeSync(final ObTableConnection conn, final ObPayload reques
169169
"receive unexpected command code: " + response.getCmdCode().value());
170170
throw new ObTableUnexpectedException(errMessage, resultCode.getRcode());
171171
}
172-
173-
payload.decode(buf);
172+
try {
173+
payload.decode(buf);
174+
} catch (Exception e) {
175+
String errMessage = TraceUtil.formatTraceMessage(conn, response,
176+
"decode meet exception, cause: " + e.getMessage());
177+
throw new RuntimeException(errMessage, e);
178+
}
174179
return payload;
175180
} finally {
176181
// Very important to release ByteBuf memory

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public static ObTableObjType decodeTableObjType(ByteBuf buf) {
5151
byte type = Serialization.decodeI8(buf);
5252
ObTableObjType objType = ObTableObjType.valueOf(type);
5353
if (objType == null) {
54-
throw new IllegalArgumentException("cannot get table object type from value");
54+
throw new IllegalArgumentException("cannot get table object type from value, type: " + type);
5555
}
5656
return objType;
5757
}

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

Lines changed: 31 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -161,31 +161,39 @@ private byte[] parseBitMap(long bitLen, List<String> aggColumnNames, List<String
161161
*/
162162
@Override
163163
public Object decode(ByteBuf buf) {
164-
// 0. decode header
165-
super.decode(buf);
166-
167-
// 1. rowkey bitmap
168-
rowKeyBitLen = Serialization.decodeVi64(buf);
169-
rowKeyBitMap = parseBitMap(rowKeyBitLen, aggRowKeyNames, rowKeyNames, buf);
170-
171-
// 2. rowkey obobj
172-
int len = (int) Serialization.decodeVi64(buf);
173-
for (int i = 0; i < len; i++) {
174-
ObObj obj = new ObObj();
175-
ObTableSerialUtil.decode(buf, obj);
176-
rowkey.add(obj);
177-
}
164+
int rowkeyLen = 0;
165+
int propLen = 0;
166+
try {
167+
// 0. decode header
168+
super.decode(buf);
169+
170+
// 1. rowkey bitmap
171+
rowKeyBitLen = Serialization.decodeVi64(buf);
172+
rowKeyBitMap = parseBitMap(rowKeyBitLen, aggRowKeyNames, rowKeyNames, buf);
173+
174+
// 2. rowkey obobj
175+
rowkeyLen = (int) Serialization.decodeVi64(buf);
176+
for (int i = 0; i < rowkeyLen; i++) {
177+
ObObj obj = new ObObj();
178+
ObTableSerialUtil.decode(buf, obj);
179+
rowkey.add(obj);
180+
}
178181

179-
// 3. properties bitmap
180-
propertiesBitLen = Serialization.decodeVi64(buf);
181-
propertiesBitMap = parseBitMap(propertiesBitLen, aggPropertiesNames, propertiesNames, buf);
182+
// 3. properties bitmap
183+
propertiesBitLen = Serialization.decodeVi64(buf);
184+
propertiesBitMap = parseBitMap(propertiesBitLen, aggPropertiesNames, propertiesNames, buf);
182185

183-
// 4. properties obobj
184-
len = (int) Serialization.decodeVi64(buf);
185-
for (int i = 0; i < len; i++) {
186-
ObObj obj = new ObObj();
187-
ObTableSerialUtil.decode(buf, obj);
188-
propertiesValues.add(obj);
186+
// 4. properties obobj
187+
propLen = (int) Serialization.decodeVi64(buf);
188+
for (int i = 0; i < propLen; i++) {
189+
ObObj obj = new ObObj();
190+
ObTableSerialUtil.decode(buf, obj);
191+
propertiesValues.add(obj);
192+
}
193+
} catch (Exception e) {
194+
String errMsg = String.format("ObTableSingleOpEntity decode exception: rowkeyBitLen=%d, rowkeyLen=%d, propertiesBitLen=%d, propertiesLen=%d"
195+
, rowKeyBitLen, rowkeyLen, propertiesBitLen, propLen);
196+
throw new IllegalArgumentException(errMsg + ", cause: " + e.getMessage(), e);
189197
}
190198

191199
return this;

0 commit comments

Comments
 (0)