use of org.neo4j.kernel.impl.transaction.log.TransactionIdStore.BASE_TX_ID in project neo4j by neo4j.
the class StoreCopyResponsePacker method packTransactionStreamResponse.
@Override
public <T> Response<T> packTransactionStreamResponse(RequestContext context, T response) {
final long toStartFrom = mandatoryStartTransactionId;
final long toEndAt = transactionIdStore.getLastCommittedTransactionId();
TransactionStream transactions = visitor -> {
if (toStartFrom > BASE_TX_ID && toStartFrom <= toEndAt) {
monitor.startStreamingTransactions(toStartFrom);
extractTransactions(toStartFrom, filterVisitor(visitor, toEndAt));
monitor.finishStreamingTransactions(toEndAt);
}
};
return new TransactionStreamResponse<>(response, storeId.get(), transactions, ResourceReleaser.NO_OP);
}
use of org.neo4j.kernel.impl.transaction.log.TransactionIdStore.BASE_TX_ID in project neo4j by neo4j.
the class ResponsePacker method packTransactionStreamResponse.
public <T> Response<T> packTransactionStreamResponse(RequestContext context, T response) {
final long toStartFrom = context.lastAppliedTransaction() + 1;
final long toEndAt = transactionIdStore.getLastCommittedTransactionId();
TransactionStream transactions = visitor -> {
if (toStartFrom > BASE_TX_ID && toStartFrom <= toEndAt) {
extractTransactions(toStartFrom, filterVisitor(visitor, toEndAt));
}
};
return new TransactionStreamResponse<>(response, storeId.get(), transactions, ResourceReleaser.NO_OP);
}
use of org.neo4j.kernel.impl.transaction.log.TransactionIdStore.BASE_TX_ID in project neo4j by neo4j.
the class SwitchToSlave method copyStoreFromMaster.
void copyStoreFromMaster(MasterClient masterClient, CancellationRequest cancellationRequest, MoveAfterCopy moveAfterCopy) throws Throwable {
try {
userLog.info("Copying store from master");
StoreCopyClient.StoreCopyRequester requester = new StoreCopyClient.StoreCopyRequester() {
@Override
public Response<?> copyStore(StoreWriter writer) {
return masterClient.copyStore(new RequestContext(0, config.get(ClusterSettings.server_id).toIntegerIndex(), 0, BASE_TX_ID, 0), writer);
}
@Override
public void done() {
// Nothing to clean up here
}
};
MoveAfterCopy moveAfterCopyWithLogging = (moves, fromDirectory, toDirectory) -> {
userLog.info("Copied store from master to " + fromDirectory);
msgLog.info("Starting post copy operation to move store from " + fromDirectory + " to " + storeDir);
moveAfterCopy.move(moves, fromDirectory, toDirectory);
};
storeCopyClient.copyStore(requester, cancellationRequest, moveAfterCopyWithLogging);
startServicesAgain();
userLog.info("Finished copying store from master");
} catch (Throwable t) {
// Delete store so that we can copy from master without conflicts next time
cleanStoreDir();
throw t;
}
}
Aggregations