Esempio n. 1
0
        /// <returns> RecoveryStatus containing the previously active and previously inactive files. The previously active
        /// file contains the latest readable log index (though it may also contain some garbage) and the inactive file is
        /// safe to become the new state holder. </returns>
        /// <exception cref="IOException"> if any IO goes wrong. </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public RecoveryStatus<STATE> recover(java.io.File fileA, java.io.File fileB) throws java.io.IOException
        public virtual RecoveryStatus <STATE> Recover(File fileA, File fileB)
        {
            Debug.Assert(fileA != null && fileB != null);

            STATE a = ReadLastEntryFrom(fileA);
            STATE b = ReadLastEntryFrom(fileB);

            if (a == default(STATE) && b == default(STATE))
            {
                throw new System.InvalidOperationException("no recoverable state");
            }

            if (a == default(STATE))
            {
                return(new RecoveryStatus <STATE>(fileA, b));
            }
            else if (b == default(STATE))
            {
                return(new RecoveryStatus <STATE>(fileB, a));
            }
            else if (_marshal.ordinal(a) > _marshal.ordinal(b))
            {
                return(new RecoveryStatus <STATE>(fileB, a));
            }
            else
            {
                return(new RecoveryStatus <STATE>(fileA, b));
            }
        }
Esempio n. 2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void recover() throws java.io.IOException
        private void Recover()
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.causalclustering.core.state.StateRecoveryManager.RecoveryStatus<STATE> recoveryStatus = recoveryManager.recover(fileA, fileB);
            StateRecoveryManager.RecoveryStatus <STATE> recoveryStatus = _recoveryManager.recover(_fileA, _fileB);

            this._currentStoreFile    = recoveryStatus.ActiveFile();
            this._currentStoreChannel = ResetStoreFile(_currentStoreFile);
            this._initialState        = recoveryStatus.RecoveredState();

            _log.info("%s state restored, up to ordinal %d", _name, _marshal.ordinal(_initialState));
        }