예제 #1
0
        public override void OnTxReceived(TxPullResponse txPullResponse)
        {
            lock (this)
            {
                CommittedTransactionRepresentation tx = txPullResponse.Tx();
                long receivedTxId = tx.CommitEntry.TxId;

                // neo4j admin backup clients pull transactions indefinitely and have no monitoring mechanism for tx log rotation
                // Other cases, ex. Read Replicas have an external mechanism that rotates independently of this process and don't need to
                // manually rotate while pulling
                if (_rotateTransactionsManually && _logFiles.LogFile.rotationNeeded())
                {
                    RotateTransactionLogs(_logFiles);
                }

                if (receivedTxId != _expectedTxId)
                {
                    throw new Exception(format("Expected txId: %d but got: %d", _expectedTxId, receivedTxId));
                }

                _lastTxId = receivedTxId;
                _expectedTxId++;

                try
                {
                    _writer.append(tx.TransactionRepresentation, _lastTxId);
                }
                catch (IOException e)
                {
                    _log.error("Failed when appending to transaction log", e);
                }
            }
        }
예제 #2
0
 public override void onTxPullResponse(CompletableFuture <TxPullRequestResult> signal, TxPullResponse response)
 {
     this.lastTxIdReceived = response.Tx().CommitEntry.TxId;
     _txPullResponseListener.onTxReceived(response);
 }
예제 #3
0
 public override void onTxPullResponse(CompletableFuture <TxStreamFinishedResponse> signal, TxPullResponse response)
 {
     outerInstance.handleTransaction(response.Tx());
 }