tkalkirill commented on code in PR #3414:
URL: https://github.com/apache/ignite-3/pull/3414#discussion_r1529661113
##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/raft/snapshot/FullStateTransferIndexChooser.java:
##########
@@ -238,21 +260,36 @@ private static List<Integer>
mergeWithoutDuplicates(List<Integer> l0, List<Integ
private void addListenersBusy() {
catalogService.listen(INDEX_CREATE,
fromConsumer(this::onIndexCreated));
catalogService.listen(INDEX_REMOVED,
fromConsumer(this::onIndexRemoved));
+
+ lowWatermark.addUpdateListener(this::onLwmChanged);
}
private void onIndexRemoved(RemoveIndexEventParameters parameters) {
inBusyLock(busyLock, () -> {
int indexId = parameters.indexId();
int catalogVersion = parameters.catalogVersion();
- CatalogIndexDescriptor index = indexBusy(indexId, catalogVersion -
1);
+ lowWatermark.getLowWatermarkSafe(lwm -> {
+ int lwmCatalogVersion =
catalogService.activeCatalogVersion(hybridTimestampToLong(lwm));
- if (index.status() == AVAILABLE) {
- // On drop table event.
- readOnlyIndexes.add(new ReadOnlyIndexInfo(index,
catalogActivationTimestampBusy(catalogVersion)));
- } else if (index.status() == STOPPING) {
- readOnlyIndexes.add(new ReadOnlyIndexInfo(index,
findStoppingActivationTsBusy(indexId, catalogVersion - 1)));
- }
+ if (catalogVersion <= lwmCatalogVersion) {
+ // There is no need to add a read-only indexes, since the
index should be destroyed under the updated low watermark.
+ tableVersionByIndexId.remove(indexId);
+ } else {
+ CatalogIndexDescriptor index = indexBusy(indexId,
catalogVersion - 1);
+
+ if (index.status() == AVAILABLE) {
+ // On drop table event.
+ readOnlyIndexes.add(new ReadOnlyIndexInfo(index,
catalogActivationTimestampBusy(catalogVersion), catalogVersion));
+ } else if (index.status() == STOPPING) {
+ readOnlyIndexes.add(
+ new ReadOnlyIndexInfo(index,
findStoppingActivationTsBusy(indexId, catalogVersion - 1), catalogVersion)
+ );
+ } else {
+ tableVersionByIndexId.remove(indexId);
Review Comment:
Try fix it
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]