|
32 | 32 | import com.alipay.oceanbase.rpc.mutation.result.BatchOperationResult; |
33 | 33 | import com.alipay.oceanbase.rpc.mutation.result.MutationResult; |
34 | 34 | import com.alipay.oceanbase.rpc.protocol.payload.ObPayload; |
| 35 | +import com.alipay.oceanbase.rpc.protocol.payload.ResultCodes; |
35 | 36 | import com.alipay.oceanbase.rpc.protocol.payload.impl.ObObj; |
36 | 37 | import com.alipay.oceanbase.rpc.protocol.payload.impl.ObRowKey; |
37 | 38 | import com.alipay.oceanbase.rpc.protocol.payload.impl.execute.*; |
@@ -1429,7 +1430,13 @@ public Result increment(Increment increment) throws IOException { |
1429 | 1430 | return new Result(keyValues); |
1430 | 1431 | } catch (Exception e) { |
1431 | 1432 | logger.error(LCD.convert("01-00007"), tableNameString, e); |
1432 | | - throw new IOException("increment table " + tableNameString + " error.", e); |
| 1433 | + if (e instanceof ObTableException && |
| 1434 | + ((ObTableException) e).getErrorCode() == ResultCodes.OB_KV_HBASE_INCR_FIELD_IS_NOT_LONG.errorCode) { |
| 1435 | + String errMsg = OHBaseFuncUtils.generateIncrFieldErrMsg(e.getMessage()); |
| 1436 | + throw new DoNotRetryIOException(errMsg, e); |
| 1437 | + } else { |
| 1438 | + throw new IOException("increment table " + tableNameString + " error.", e); |
| 1439 | + } |
1433 | 1440 | } |
1434 | 1441 | } |
1435 | 1442 |
|
@@ -1473,7 +1480,13 @@ public long incrementColumnValue(byte[] row, byte[] family, byte[] qualifier, lo |
1473 | 1480 | return Bytes.toLong((byte[]) queryResult.getPropertiesRows().get(0).get(3).getValue()); |
1474 | 1481 | } catch (Exception e) { |
1475 | 1482 | logger.error(LCD.convert("01-00007"), tableNameString, e); |
1476 | | - throw new IOException("increment table " + tableNameString + " error.", e); |
| 1483 | + if (e instanceof ObTableException |
| 1484 | + && ((ObTableException) e).getErrorCode() == ResultCodes.OB_KV_HBASE_INCR_FIELD_IS_NOT_LONG.errorCode) { |
| 1485 | + String errMsg = OHBaseFuncUtils.generateIncrFieldErrMsg(e.getMessage()); |
| 1486 | + throw new DoNotRetryIOException(errMsg, e); |
| 1487 | + } else { |
| 1488 | + throw new IOException("increment table " + tableNameString + " error.", e); |
| 1489 | + } |
1477 | 1490 | } |
1478 | 1491 | } |
1479 | 1492 |
|
|
0 commit comments