|
56 | 56 | import org.apache.doris.cloud.proto.Cloud.MetaServiceCode;
|
57 | 57 | import org.apache.doris.cloud.proto.Cloud.PrecommitTxnRequest;
|
58 | 58 | import org.apache.doris.cloud.proto.Cloud.PrecommitTxnResponse;
|
| 59 | +import org.apache.doris.cloud.proto.Cloud.RemoveDeleteBitmapUpdateLockRequest; |
| 60 | +import org.apache.doris.cloud.proto.Cloud.RemoveDeleteBitmapUpdateLockResponse; |
59 | 61 | import org.apache.doris.cloud.proto.Cloud.SubTxnInfo;
|
60 | 62 | import org.apache.doris.cloud.proto.Cloud.TableStatsPB;
|
61 | 63 | import org.apache.doris.cloud.proto.Cloud.TabletIndexPB;
|
@@ -648,7 +650,13 @@ private void calcDeleteBitmapForMow(long dbId, List<OlapTable> tableList, long t
|
648 | 650 | Map<Long, List<TCalcDeleteBitmapPartitionInfo>> backendToPartitionInfos = getCalcDeleteBitmapInfo(
|
649 | 651 | backendToPartitionTablets, partitionVersions, baseCompactionCnts, cumulativeCompactionCnts,
|
650 | 652 | cumulativePoints);
|
651 |
| - sendCalcDeleteBitmaptask(dbId, transactionId, backendToPartitionInfos); |
| 653 | + try { |
| 654 | + sendCalcDeleteBitmaptask(dbId, transactionId, backendToPartitionInfos); |
| 655 | + } catch (UserException e) { |
| 656 | + LOG.warn("failed to sendCalcDeleteBitmaptask for txn=" + transactionId + ",exception=" + e.getMessage()); |
| 657 | + removeDeleteBitmapUpdateLock(tableToPartitions, transactionId); |
| 658 | + throw e; |
| 659 | + } |
652 | 660 | }
|
653 | 661 |
|
654 | 662 | private void getPartitionInfo(List<OlapTable> tableList,
|
@@ -869,6 +877,33 @@ private void getDeleteBitmapUpdateLock(Map<Long, Set<Long>> tableToParttions, lo
|
869 | 877 | }
|
870 | 878 | }
|
871 | 879 |
|
| 880 | + private void removeDeleteBitmapUpdateLock(Map<Long, Set<Long>> tableToParttions, long transactionId) { |
| 881 | + for (Map.Entry<Long, Set<Long>> entry : tableToParttions.entrySet()) { |
| 882 | + RemoveDeleteBitmapUpdateLockRequest.Builder builder = RemoveDeleteBitmapUpdateLockRequest.newBuilder(); |
| 883 | + builder.setTableId(entry.getKey()) |
| 884 | + .setLockId(transactionId) |
| 885 | + .setInitiator(-1); |
| 886 | + final RemoveDeleteBitmapUpdateLockRequest request = builder.build(); |
| 887 | + RemoveDeleteBitmapUpdateLockResponse response = null; |
| 888 | + try { |
| 889 | + response = MetaServiceProxy.getInstance().removeDeleteBitmapUpdateLock(request); |
| 890 | + if (LOG.isDebugEnabled()) { |
| 891 | + LOG.debug("remove delete bitmap lock, transactionId={}, Request: {}, Response: {}", |
| 892 | + transactionId, request, response); |
| 893 | + } |
| 894 | + Preconditions.checkNotNull(response); |
| 895 | + Preconditions.checkNotNull(response.getStatus()); |
| 896 | + if (response.getStatus().getCode() != MetaServiceCode.OK) { |
| 897 | + LOG.warn("remove delete bitmap lock failed, transactionId={}, response:{}", |
| 898 | + transactionId, response); |
| 899 | + } |
| 900 | + } catch (Exception e) { |
| 901 | + LOG.warn("ignore get delete bitmap lock exception, transactionId={}, exception={}", |
| 902 | + transactionId, e); |
| 903 | + } |
| 904 | + } |
| 905 | + } |
| 906 | + |
872 | 907 | private void sendCalcDeleteBitmaptask(long dbId, long transactionId,
|
873 | 908 | Map<Long, List<TCalcDeleteBitmapPartitionInfo>> backendToPartitionInfos)
|
874 | 909 | throws UserException {
|
|
0 commit comments