Skip to content
Open
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 @@ -686,7 +686,8 @@ else if (NULL_VALUE == correlationId && consensusPublicationGroup.isConnected())
ctx.consensusStreamId(),
AeronCluster.Configuration.PROTOCOL_SEMANTIC_VERSION,
ctx.consensusChannel(),
ctx.credentialsSupplier().encodedCredentials()))
ctx.credentialsSupplier().encodedCredentials(),
NULL_VALUE))
{
timeOfLastBackupQueryMs = nowMs;
this.correlationId = correlationId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package io.aeron.cluster;

import io.aeron.Aeron;
import io.aeron.CommonContext;
import io.aeron.ExclusivePublication;
import io.aeron.Publication;
Expand Down Expand Up @@ -454,7 +455,8 @@ boolean backupQuery(
final int responseStreamId,
final int version,
final String responseChannel,
final byte[] encodedCredentials)
final byte[] encodedCredentials,
final long logPosition)
{
if (null == publication)
{
Expand All @@ -466,6 +468,8 @@ boolean backupQuery(
.correlationId(correlationId)
.responseStreamId(responseStreamId)
.version(version)
.logPosition(Aeron.NULL_VALUE ==
logPosition ? BackupQueryEncoder.logPositionNullValue() : logPosition)
.responseChannel(responseChannel)
.putEncodedCredentials(encodedCredentials, 0, encodedCredentials.length);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import org.junit.jupiter.params.provider.ValueSource;

import java.util.List;
//import java.util.function.IntFunction;

import static io.aeron.cluster.ClusterBackup.Configuration.ReplayStart.LATEST_SNAPSHOT;
import static io.aeron.test.SystemTestWatcher.UNKNOWN_HOST_FILTER;
Expand Down Expand Up @@ -664,6 +665,22 @@ void shouldResumeBackupIfStopped(final int catchupPort)
cluster.awaitBackupLiveLogPosition(cluster.findLeader().service().cluster().logPosition());
}

// @Test
// @InterruptAfter(5)
// void shouldQueryForSnapshotsWithLogPositionAndGetServiceEntries()
// {
// final IntFunction<TestNode.TestService[]> serviceSupplier =
// (index) -> new TestNode.TestService[]
// {
// new TestNode.TestService()
// };
// final TestCluster cluster = aCluster().withStaticNodes(3).withServiceSupplier(serviceSupplier).start();
// systemTestWatcher.cluster(cluster);
// final TestNode leader = cluster.awaitLeader();
//
// cluster.connectClient();
// }

@Test
@InterruptAfter(5)
void shouldQueryForSnapshotsWithLogPosition()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2459,6 +2459,19 @@ public List<SnapshotRecord> snapshots(final TestNode testNode)
}
}

public List<SnapshotRecord> snapshotsIncludingServices(final TestNode testNode)
{
final File file = testNode.consensusModule().context().clusterDir();
try (RecordingLog recordingLog = new RecordingLog(file, false))
{
return recordingLog.entries().stream()
.filter((entry) -> RecordingLog.ENTRY_TYPE_SNAPSHOT == entry.type)
.map(entry -> new SnapshotRecord(entry.recordingId, entry.logPosition))
.sorted(Comparator.comparingLong(SnapshotRecord::logPosition))
.toList();
}
}

public static final class Builder
{
private int clusterId;
Expand Down