use of org.neo4j.causalclustering.identity.StoreId in project neo4j by neo4j.
the class CoreStateDownloaderTest method shouldNotOverwriteNonEmptyMismatchingStore.
@Test
public void shouldNotOverwriteNonEmptyMismatchingStore() throws Exception {
// given
when(localDatabase.isEmpty()).thenReturn(false);
StoreId remoteStoreId = new StoreId(5, 6, 7, 8);
when(remoteStore.getStoreId(remoteMember)).thenReturn(remoteStoreId);
// when
try {
downloader.downloadSnapshot(remoteMember, coreState);
fail();
} catch (StoreCopyFailedException e) {
// expected
}
// then
verify(remoteStore, never()).copy(any(), any(), any());
verify(remoteStore, never()).tryCatchingUp(any(), any(), any());
}
use of org.neo4j.causalclustering.identity.StoreId in project neo4j by neo4j.
the class CatchupPollingProcess method pullTransactions.
private void pullTransactions() {
MemberId upstream;
try {
upstream = selectionStrategyPipeline.bestUpstreamDatabase();
} catch (UpstreamDatabaseSelectionException e) {
log.warn("Could not find upstream database from which to pull.", e);
return;
}
StoreId localStoreId = localDatabase.storeId();
boolean moreToPull = true;
int batchCount = 1;
while (moreToPull) {
moreToPull = pullAndApplyBatchOfTransactions(upstream, localStoreId, batchCount);
batchCount++;
}
}
use of org.neo4j.causalclustering.identity.StoreId in project neo4j by neo4j.
the class CatchupPollingProcess method copyStore.
private void copyStore() {
MemberId upstream;
try {
upstream = selectionStrategyPipeline.bestUpstreamDatabase();
} catch (UpstreamDatabaseSelectionException e) {
log.warn("Could not find upstream database from which to copy store", e);
return;
}
StoreId localStoreId = localDatabase.storeId();
downloadDatabase(upstream, localStoreId);
}
use of org.neo4j.causalclustering.identity.StoreId in project neo4j by neo4j.
the class TxPullRequestDecoder method decode.
@Override
protected void decode(ChannelHandlerContext ctx, ByteBuf msg, List<Object> out) throws Exception {
long txId = msg.readLong();
StoreId storeId = StoreIdMarshal.INSTANCE.unmarshal(new NetworkReadableClosableChannelNetty4(msg));
out.add(new TxPullRequest(txId, storeId));
}
use of org.neo4j.causalclustering.identity.StoreId in project neo4j by neo4j.
the class TxPullResponseDecoder method decode.
@Override
protected void decode(ChannelHandlerContext ctx, ByteBuf msg, List<Object> out) throws Exception {
NetworkReadableClosableChannelNetty4 logChannel = new NetworkReadableClosableChannelNetty4(msg);
StoreId storeId = StoreIdMarshal.INSTANCE.unmarshal(logChannel);
LogEntryReader<NetworkReadableClosableChannelNetty4> reader = new VersionAwareLogEntryReader<>(new RecordStorageCommandReaderFactory());
PhysicalTransactionCursor<NetworkReadableClosableChannelNetty4> transactionCursor = new PhysicalTransactionCursor<>(logChannel, reader);
transactionCursor.next();
CommittedTransactionRepresentation tx = transactionCursor.get();
if (tx != null) {
out.add(new TxPullResponse(storeId, tx));
}
}
Aggregations