Esempio n. 1
0
 public LogTailScanner(LogFiles logFiles, LogEntryReader <ReadableClosablePositionAwareChannel> logEntryReader, Monitors monitors, bool failOnCorruptedLogFiles)
 {
     this._logFiles                = logFiles;
     this._logEntryReader          = logEntryReader;
     this._monitor                 = monitors.NewMonitor(typeof(LogTailScannerMonitor));
     this._failOnCorruptedLogFiles = failOnCorruptedLogFiles;
 }
 public PhysicalLogicalTransactionStore(LogFiles logFiles, TransactionMetadataCache transactionMetadataCache, LogEntryReader <ReadableClosablePositionAwareChannel> logEntryReader, Monitors monitors, bool failOnCorruptedLogFiles)
 {
     this._logFiles = logFiles;
     this._logFile  = logFiles.LogFile;
     this._transactionMetadataCache = transactionMetadataCache;
     this._logEntryReader           = logEntryReader;
     this._monitors = monitors;
     this._failOnCorruptedLogFiles = failOnCorruptedLogFiles;
 }
Esempio n. 3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: ReversedSingleFileTransactionCursor(org.neo4j.kernel.impl.transaction.log.ReadAheadLogChannel channel, org.neo4j.kernel.impl.transaction.log.entry.LogEntryReader<org.neo4j.kernel.impl.transaction.log.ReadableClosablePositionAwareChannel> logEntryReader, boolean failOnCorruptedLogFiles, ReversedTransactionCursorMonitor monitor) throws java.io.IOException
        internal ReversedSingleFileTransactionCursor(ReadAheadLogChannel channel, LogEntryReader <ReadableClosablePositionAwareChannel> logEntryReader, bool failOnCorruptedLogFiles, ReversedTransactionCursorMonitor monitor)
        {
            this._channel = channel;
            this._failOnCorruptedLogFiles = failOnCorruptedLogFiles;
            this._monitor = monitor;
            // There's an assumption here: that the underlying channel can move in between calls and that the
            // transaction cursor will just happily read from the new position.
            this._transactionCursor = new PhysicalTransactionCursor <>(channel, logEntryReader);
            this._offsets           = SketchOutTransactionStartOffsets();
        }
Esempio n. 4
0
 internal TransactionLogFilesContext(AtomicLong rotationThreshold, LogEntryReader logEntryReader, System.Func <long> lastCommittedTransactionIdSupplier, System.Func <long> committingTransactionIdSupplier, LogFileCreationMonitor logFileCreationMonitor, System.Func <LogVersionRepository> logVersionRepositorySupplier, FileSystemAbstraction fileSystem)
 {
     this._rotationThreshold = rotationThreshold;
     this._logEntryReader    = logEntryReader;
     this._lastCommittedTransactionIdSupplier = lastCommittedTransactionIdSupplier;
     this._committingTransactionIdSupplier    = committingTransactionIdSupplier;
     this._logVersionRepositorySupplier       = logVersionRepositorySupplier;
     this._logFileCreationMonitor             = logFileCreationMonitor;
     this._fileSystem = fileSystem;
 }
Esempio n. 5
0
 public HaRequestType210(LogEntryReader <ReadableClosablePositionAwareChannel> entryReader, ObjectSerializer <LockResult> lockResultObjectSerializer)
 {
     RegisterAllocateIds();
     RegisterCreateRelationshipType();
     RegisterAcquireExclusiveLock(lockResultObjectSerializer);
     RegisterAcquireSharedLock(lockResultObjectSerializer);
     RegisterCommit(entryReader);
     RegisterPullUpdates();
     RegisterEndLockSession();
     RegisterHandshake();
     RegisterCopyStore();
     RegisterNewLockSession();
     RegisterCreatePropertyKey();
     RegisterCreateLabel();
 }
Esempio n. 6
0
        public Client(string destinationHostNameOrIp, int destinationPort, string originHostNameOrIp, LogProvider logProvider, StoreId storeId, int frameLength, long readTimeout, int maxConcurrentChannels, int chunkSize, ResponseUnpacker responseUnpacker, ByteCounterMonitor byteCounterMonitor, RequestMonitor requestMonitor, LogEntryReader <ReadableClosablePositionAwareChannel> entryReader)
        {
            this._entryReader = entryReader;
            Debug.Assert(byteCounterMonitor != null);
            Debug.Assert(requestMonitor != null);

            this._byteCounterMonitor = byteCounterMonitor;
            this._requestMonitor     = requestMonitor;
            assertChunkSizeIsWithinFrameSize(chunkSize, frameLength);

            this._msgLog      = logProvider.getLog(this.GetType());
            this._storeId     = storeId;
            this._frameLength = frameLength;
            this._readTimeout = readTimeout;
            // ResourcePool no longer controls max concurrent channels. Use this value for the pool size
            this._maxUnusedChannels   = maxConcurrentChannels;
            this._comExceptionHandler = NoOpComExceptionHandler;

            if (destinationHostNameOrIp.Equals("0.0.0.0"))
            {
                // So it turns out that on Windows, connecting to 0.0.0.0 when specifying
                // an origin address will not succeed. But since we know we are
                // connecting to ourselves, and that we are listening on everything,
                // replacing with localhost is the proper thing to do.
                this._destination = new InetSocketAddress(LocalAddress, destinationPort);
            }
            else
            {
                // An explicit destination address is always correct
                this._destination = new InetSocketAddress(destinationHostNameOrIp, destinationPort);
            }

            if (string.ReferenceEquals(originHostNameOrIp, null) || originHostNameOrIp.Equals("0.0.0.0"))
            {
                _origin = null;
            }
            else
            {
                _origin = new InetSocketAddress(originHostNameOrIp, 0);
            }

            ProtocolVersion protocolVersion = ProtocolVersion;

            this._protocol         = CreateProtocol(chunkSize, protocolVersion.ApplicationProtocol);
            this._responseUnpacker = responseUnpacker;

            _msgLog.info(this.GetType().Name + " communication channel created towards " + _destination);
        }
Esempio n. 7
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: TransactionLogFilesContext buildContext() throws java.io.IOException
        internal virtual TransactionLogFilesContext BuildContext()
        {
            if (_logEntryReader == null)
            {
                _logEntryReader = new VersionAwareLogEntryReader();
            }
            if (_logFileCreationMonitor == null)
            {
                _logFileCreationMonitor = LogFileCreationMonitor_Fields.NoMonitor;
            }
            requireNonNull(_fileSystem);
            System.Func <LogVersionRepository> logVersionRepositorySupplier = LogVersionRepositorySupplier;
            System.Func <long> lastCommittedIdSupplier         = lastCommittedIdSupplier();
            System.Func <long> committingTransactionIdSupplier = CommittingIdSupplier();

            // Register listener for rotation threshold
            AtomicLong rotationThreshold = RotationThresholdAndRegisterForUpdates;

            return(new TransactionLogFilesContext(rotationThreshold, _logEntryReader, lastCommittedIdSupplier, committingTransactionIdSupplier, _logFileCreationMonitor, logVersionRepositorySupplier, _fileSystem));
        }
Esempio n. 8
0
        private void RegisterCommit(LogEntryReader <ReadableClosablePositionAwareChannel> entryReader)
        {
            TargetCaller <Master, long> commitTarget = (master, context, input, target) =>
            {
                readString(input);                   // Always neostorexadatasource

                TransactionRepresentation tx;
                try
                {
                    Deserializer <TransactionRepresentation> deserializer = new Protocol.TransactionRepresentationDeserializer(entryReader);
                    tx = deserializer.read(input, null);
                }
                catch (IOException e)
                {
                    throw new Exception(e);
                }

                return(master.commit(context, tx));
            };

            Register(HaRequestTypes_Type.Commit, commitTarget, LONG_SERIALIZER);
        }
Esempio n. 9
0
 public virtual LogFilesBuilder WithLogEntryReader(LogEntryReader logEntryReader)
 {
     this._logEntryReader = logEntryReader;
     return(this);
 }
Esempio n. 10
0
 public LogEntryCursor(LogEntryReader <ReadableClosablePositionAwareChannel> logEntryReader, ReadableClosablePositionAwareChannel channel)
 {
     this._logEntryReader = logEntryReader;
     this._channel        = channel;
 }
Esempio n. 11
0
 internal FirstTxIdConfigurableTailScanner(long txId, LogFiles logFiles, LogEntryReader <ReadableClosablePositionAwareChannel> logEntryReader, Monitors monitors) : base(logFiles, logEntryReader, monitors)
 {
     this.TxId = txId;
 }
Esempio n. 12
0
 public SlaveClient(InstanceId machineId, string destinationHostNameOrIp, int destinationPort, string originHostNameOrIp, LogProvider logProvider, StoreId storeId, int maxConcurrentChannels, int chunkSize, ByteCounterMonitor byteCounterMonitor, RequestMonitor requestMonitor, LogEntryReader <ReadableClosablePositionAwareChannel> entryReader) : base(destinationHostNameOrIp, destinationPort, originHostNameOrIp, logProvider, storeId, Protocol.DEFAULT_FRAME_LENGTH, HaSettings.read_timeout.apply(from->null).toMillis(), maxConcurrentChannels, chunkSize, NO_OP_RESPONSE_UNPACKER, byteCounterMonitor, requestMonitor, entryReader)
Esempio n. 13
0
 internal TransactionLogFileTimestampMapper(LogFiles logFiles, LogEntryReader <ReadableLogChannel> logEntryReader)
 {
     this.LogFiles       = logFiles;
     this.LogEntryReader = logEntryReader;
 }
Esempio n. 14
0
 public MasterClient214(string destinationHostNameOrIp, int destinationPort, string originHostNameOrIp, LogProvider logProvider, StoreId storeId, long readTimeoutMillis, long lockReadTimeoutMillis, int maxConcurrentChannels, int chunkSize, ResponseUnpacker responseUnpacker, ByteCounterMonitor byteCounterMonitor, RequestMonitor requestMonitor, LogEntryReader <ReadableClosablePositionAwareChannel> entryReader) : base(destinationHostNameOrIp, destinationPort, originHostNameOrIp, logProvider, storeId, MasterServer.FRAME_LENGTH, readTimeoutMillis, maxConcurrentChannels, chunkSize, responseUnpacker, byteCounterMonitor, requestMonitor, entryReader)
 {
     this._lockReadTimeoutMillis  = lockReadTimeoutMillis;
     this._requestTypes           = new HaRequestType210(entryReader, CreateLockResultSerializer());
     this._lockResultDeserializer = CreateLockResultDeserializer();
 }
Esempio n. 15
0
 public MasterServer(Master requestTarget, LogProvider logProvider, Configuration config, TxChecksumVerifier txVerifier, ByteCounterMonitor byteCounterMonitor, RequestMonitor requestMonitor, ConversationManager conversationManager, LogEntryReader <ReadableClosablePositionAwareChannel> entryReader) : base(requestTarget, config, logProvider, FrameLength, CURRENT, txVerifier, Clocks.systemClock(), byteCounterMonitor, requestMonitor)
 {
     this._conversationManager = conversationManager;
     this._requestTypes        = new HaRequestType210(entryReader, MasterClient320.LOCK_RESULT_OBJECT_SERIALIZER);
 }
Esempio n. 16
0
 public LogTailScanner(LogFiles logFiles, LogEntryReader <ReadableClosablePositionAwareChannel> logEntryReader, Monitors monitors) : this(logFiles, logEntryReader, monitors, false)
 {
 }
Esempio n. 17
0
 public TransactionRepresentationDeserializer(LogEntryReader <ReadableClosablePositionAwareChannel> reader)
 {
     this.Reader = reader;
 }
Esempio n. 18
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public <PAYLOAD> Response<PAYLOAD> deserializeResponse(org.jboss.netty.handler.queue.BlockingReadHandler<org.jboss.netty.buffer.ChannelBuffer> reader, ByteBuffer input, long timeout, Deserializer<PAYLOAD> payloadDeserializer, ResourceReleaser channelReleaser, final org.neo4j.kernel.impl.transaction.log.entry.LogEntryReader<org.neo4j.kernel.impl.transaction.log.ReadableClosablePositionAwareChannel> entryReader) throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected:
        public virtual Response <PAYLOAD> DeserializeResponse <PAYLOAD>(BlockingReadHandler <ChannelBuffer> reader, ByteBuffer input, long timeout, Deserializer <PAYLOAD> payloadDeserializer, ResourceReleaser channelReleaser, LogEntryReader <ReadableClosablePositionAwareChannel> entryReader)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final DechunkingChannelBuffer dechunkingBuffer = new DechunkingChannelBuffer(reader, timeout, internalProtocolVersion, applicationProtocolVersion);
            DechunkingChannelBuffer dechunkingBuffer = new DechunkingChannelBuffer(reader, timeout, _internalProtocolVersion, _applicationProtocolVersion);

            PAYLOAD response = payloadDeserializer.Read(dechunkingBuffer, input);
            StoreId storeId  = ReadStoreId(dechunkingBuffer, input);

            // Response type is what previously was a byte saying how many data sources there were in the
            // coming transaction stream response. For backwards compatibility we keep it as a byte and we introduce
            // the transaction obligation response type as -1
            sbyte responseType = dechunkingBuffer.ReadByte();

            if (responseType == TransactionObligationResponse.RESPONSE_TYPE)
            {
                // It is a transaction obligation response
                long obligationTxId = dechunkingBuffer.ReadLong();
                return(new TransactionObligationResponse <PAYLOAD>(response, storeId, obligationTxId, channelReleaser));
            }

            // It's a transaction stream in this response
            TransactionStream transactions = visitor =>
            {
                NetworkReadableClosableChannel channel = new NetworkReadableClosableChannel(dechunkingBuffer);

                using (PhysicalTransactionCursor <ReadableClosablePositionAwareChannel> cursor = new PhysicalTransactionCursor <ReadableClosablePositionAwareChannel>(channel, entryReader))
                {
                    while (cursor.next() && !visitor.visit(cursor.get()))
                    {
                    }
                }
            };

            return(new TransactionStreamResponse <PAYLOAD>(response, storeId, transactions, channelReleaser));
        }
Esempio n. 19
0
 internal BackupClient(string destinationHostNameOrIp, int destinationPort, string originHostNameOrIp, LogProvider logProvider, StoreId storeId, long timeout, ResponseUnpacker unpacker, ByteCounterMonitor byteCounterMonitor, RequestMonitor requestMonitor, LogEntryReader <ReadableClosablePositionAwareChannel> reader) : base(destinationHostNameOrIp, destinationPort, originHostNameOrIp, logProvider, storeId, FRAME_LENGTH, timeout, Client.DEFAULT_MAX_NUMBER_OF_CONCURRENT_CHANNELS_PER_CLIENT, FRAME_LENGTH, unpacker, byteCounterMonitor, requestMonitor, reader)
 {
 }
Esempio n. 20
0
 private LogTailScanner GetTailScanner(LogFiles logFiles, LogEntryReader <ReadableClosablePositionAwareChannel> reader)
 {
     return(new LogTailScanner(logFiles, reader, _monitors, false));
 }
Esempio n. 21
0
 public MasterClient310(string destinationHostNameOrIp, int destinationPort, string originHostNameOrIp, LogProvider logProvider, StoreId storeId, long readTimeoutMillis, long lockReadTimeout, int maxConcurrentChannels, int chunkSize, ResponseUnpacker unpacker, ByteCounterMonitor byteCounterMonitor, RequestMonitor requestMonitor, LogEntryReader <ReadableClosablePositionAwareChannel> entryReader) : base(destinationHostNameOrIp, destinationPort, originHostNameOrIp, logProvider, storeId, readTimeoutMillis, lockReadTimeout, maxConcurrentChannels, chunkSize, unpacker, byteCounterMonitor, requestMonitor, entryReader)
 {
 }
 internal TransactionPositionLocator(long startTransactionId, LogEntryReader <ReadableClosablePositionAwareChannel> logEntryReader)
 {
     this.StartTransactionId = startTransactionId;
     this.LogEntryReader     = logEntryReader;
 }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: CheckPointCollector(java.io.File directory, org.neo4j.io.fs.FileSystemAbstraction fileSystem) throws java.io.IOException
            internal CheckPointCollector(File directory, FileSystemAbstraction fileSystem)
            {
                this.LogEntryReader = new VersionAwareLogEntryReader <ReadableClosablePositionAwareChannel>();
                this.LogFiles       = LogFilesBuilder.logFilesBasedOnlyBuilder(directory, fileSystem).withLogEntryReader(LogEntryReader).build();
            }
Esempio n. 24
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public PhysicalTransactionCursor(T channel, org.neo4j.kernel.impl.transaction.log.entry.LogEntryReader<T> entryReader) throws java.io.IOException
        public PhysicalTransactionCursor(T channel, LogEntryReader <T> entryReader)
        {
            this._channel = channel;
            channel.GetCurrentPosition(_lastGoodPositionMarker);
            this._logEntryCursor = new LogEntryCursor((LogEntryReader <ReadableClosablePositionAwareChannel>)entryReader, channel);
        }