Esempio n. 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);
                }
            }
        }
Esempio n. 2
0
        public override bool Equals(object o)
        {
            if (this == o)
            {
                return(true);
            }
            if (o == null || this.GetType() != o.GetType())
            {
                return(false);
            }

            TxPullResponse that = ( TxPullResponse )o;

            return((_storeId != null ? _storeId.Equals(that._storeId) : that._storeId == null) && (_tx != null ? _tx.Equals(that._tx) : that._tx == null));
        }
Esempio n. 3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldEncodeAndDecodePullResponseMessage()
        public virtual void ShouldEncodeAndDecodePullResponseMessage()
        {
            // given
            EmbeddedChannel channel = new EmbeddedChannel(new TxPullResponseEncoder(), new TxPullResponseDecoder());
            TxPullResponse  sent    = new TxPullResponse(new StoreId(1, 2, 3, 4), NewCommittedTransactionRepresentation());

            // when
            channel.writeOutbound(sent);
            object message = channel.readOutbound();

            channel.writeInbound(message);

            // then
            TxPullResponse received = channel.readInbound();

            assertNotSame(sent, received);
            assertEquals(sent, received);
        }
Esempio n. 4
0
 public override void onTxPullResponse(CompletableFuture <TxPullRequestResult> signal, TxPullResponse response)
 {
     this.lastTxIdReceived = response.Tx().CommitEntry.TxId;
     _txPullResponseListener.onTxReceived(response);
 }
Esempio n. 5
0
 public override void onTxPullResponse(CompletableFuture <TxStreamFinishedResponse> signal, TxPullResponse response)
 {
     outerInstance.handleTransaction(response.Tx());
 }