Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1543,7 +1543,7 @@ private void sendBackupAcknowledge(final IgniteBiTuple<Map<Integer, Long>, Set<A
for (ClusterNode node : ctx.discovery().cacheGroupAffinityNodes(cctx.groupId(), topVer)) {
if (!node.isLocal()) {
// Try to send the same message only once per node.
if (sentToNodes != null && !sentToNodes.add(nodeId))
if (sentToNodes != null && !sentToNodes.add(node.id()))
continue;

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package org.apache.ignite.internal.processors.cache.query.continuous;

import java.util.Map;
import org.apache.ignite.internal.processors.timeout.GridTimeoutProcessor;
import org.apache.ignite.internal.util.GridAtomicLong;

/** */
Expand All @@ -43,4 +44,9 @@ public static int backupQueueSize(CacheContinuousQueryEventBuffer buf) {
public static GridAtomicLong maxReceivedBackupAcknowledgeUpdateCounter(CacheContinuousQueryEventBuffer buf) {
return buf.maxReceivedBackupAckUpdCntr;
}

/** */
public static GridTimeoutProcessor.CancelableTask cancelableTask(CacheContinuousQueryManager<?, ?> mgr) {
return mgr.getCancelableTask();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
import static org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryHandler.DFLT_CONTINUOUS_QUERY_BACKUP_ACK_THRESHOLD;
import static org.apache.ignite.internal.processors.cache.query.continuous.TestCacheContinuousQueryUtils.backupQueueSize;
import static org.apache.ignite.internal.processors.cache.query.continuous.TestCacheContinuousQueryUtils.bufferedEntries;
import static org.apache.ignite.internal.processors.cache.query.continuous.TestCacheContinuousQueryUtils.cancelableTask;
import static org.apache.ignite.internal.processors.cache.query.continuous.TestCacheContinuousQueryUtils.maxReceivedBackupAcknowledgeUpdateCounter;
import static org.apache.ignite.internal.processors.cache.query.continuous.TestCacheContinuousQueryUtils.partitionContinuesQueryEntryBuffers;
import static org.apache.ignite.testframework.GridTestUtils.waitForCondition;
Expand Down Expand Up @@ -146,6 +147,32 @@ public void testContinuousQueryBuffersCleanup() throws Exception {
}
}

/** Checks that a backup acknowledgement covering several topology versions is sent to all backups. */
Comment thread
wernerdv marked this conversation as resolved.
Resolved
@Test
public void testBackupAcknowledgeCoveringSeveralTopologyVersions() throws Exception {
startGrids(3);

// Keys of the first node are in one partition, so backup CQ buffer exists before the acknowledgement.
IgniteCache<Object, Object> cache = grid(0).createCache(new CacheConfiguration<>(DEFAULT_CACHE_NAME)
.setAffinity(new GridCacheModuloAffinityFunction(3, 2))
.setWriteSynchronizationMode(FULL_SYNC)
.setBackups(2));

// Disable acknowledgement by timeout, so the single acknowledgement covers both topology versions.
cancelableTask(grid(0).cachex(DEFAULT_CACHE_NAME).context().continuousQueries()).close();

try (QueryCursor<?> ignored = cache.query(new ContinuousQuery<>().setLocalListener(evts -> {}))) {
for (int i = 0; i < DFLT_CONTINUOUS_QUERY_BACKUP_ACK_THRESHOLD; i++) {
if (i == DFLT_CONTINUOUS_QUERY_BACKUP_ACK_THRESHOLD / 2)
startClientGrid(3);

cache.put(keyForNode(grid(0)), i);
}

assertTrue(waitForCondition(() -> G.allGrids().stream().allMatch(this::isContinuesQueryBufferEmpty), 5_000));
}
}

/** */
private void checkBuffersCleared(int primaryNodeIdx, Function<Query<?>, QueryCursor<?>> queryExecutor) throws Exception {
IgniteEx primary = grid(primaryNodeIdx);
Expand Down
Loading