Resume i/o to the recovery log files
322067
private static void resumeRLS(RLSSuspendToken token) throws  RLSInvalidSuspendTokenException
    {
        if (tc.isEntryEnabled()) Tr.entry(tc, "resumeRLS", token);
        
        synchronized(SUSPEND_LOCK)
        {
            try
            {
            	_tokenManager.registerResume(token);
            }
            catch (RLSInvalidSuspendTokenException exc)
            {
                FFDCFilter.processException(exc, "com.ibm.ws.recoverylog.spi.RecoveryLogService.resume", "120");
                if (tc.isEventEnabled()) Tr.event(tc, "Rethrow RLSInvalidSuspendTokenException - attempt to resume an invalid token", token);
                if (tc.isEntryEnabled()) Tr.exit(tc, "resumeRLS", exc);
                throw exc;
            }
                
            // Check if there are any outstanding suspends
            if (_tokenManager.isResumable())
            {
                if (tc.isEventEnabled()) Tr.event(tc, "There are no outstanding suspends - resuming recovery log service");
                
                Tr.info(tc, "CWRLS0002_RESUME_RLS", token);
                
                _isSuspended = false;
                
                // Notify all waiting threads that
                // normal service is resumed
                SUSPEND_LOCK.notifyAll();
            }
            else
            {
            	Tr.info(tc, "CWRLS0021_RESUME_ATTEMPT_RLS", token);
                if (tc.isEventEnabled()) Tr.event(tc, "There are still outstanding suspensions - recovery log service remains suspended");   
            }
        }
        
        if (tc.isEntryEnabled()) Tr.exit(tc, "resumeRLS");
    }
375934
def resume(self, data):
        ''
        if not hasattr(data, 'read'):
            data = six.BytesIO(data)#StringIO(data)

        #Check that we actually know from what byte to resume.
        #If self.size === -1, it means we never got the value from the server.
        #This is perfectly normal if the file was instatiated via e.g. a file listing,
        #and not directly via JFS.getObject()
        if self.size == -1:
            log.debug('%r is an incomplete file, but .size is unknown. Refreshing the file object from server', self.path)
            self.f = self.jfs.get(self.path)

        #check if what we're asked to upload is actually the right file
        md5 = calculate_md5(data)
        if md5 != self.md5:
            raise JFSError('''MD5 hashes don't match! Are you trying to resume with the wrong file?''')
        log.debug('Resuming %s from offset %s', self.path, self.size)
        return self.jfs.up(self.path, data, resume_offset=self.size)
651245
def _resume(self):
        # type: (Descriptor) -> int
        
        if self._resume_mgr is None or self._offset > 0 or self._finalized:
            return None
        # check if path exists in resume db
        rr = self._resume_mgr.get_record(self._ase)
        if rr is None:
            logger.debug('no resume record for {}'.format(self.final_path))
            return None
        # ensure lengths are the same
        if rr.length != self._ase.size:
            logger.warning('resume length mismatch {} -> {}'.format(
                rr.length, self._ase.size))
            return None
        # calculate current chunk and offset
        if rr.next_integrity_chunk == 0:
            logger.debug('nothing to resume for {}'.format(self.final_path))
            return None
        curr_chunk = rr.next_integrity_chunk
        # set offsets if completed and the final path exists
        if rr.completed and self.final_path.exists():
            with self._meta_lock:
                logger.debug('{} download already completed'.format(
                    self.final_path))
                self._offset = self._ase.size
                self._chunk_num = curr_chunk
                self._chunk_size = rr.chunk_size
                self._total_chunks = self._compute_total_chunks(rr.chunk_size)
                self._next_integrity_chunk = rr.next_integrity_chunk
                self._outstanding_ops = 0
                self._finalized = True
            return self._ase.size
        # encrypted files are not resumable due to hmac requirement
        if self._ase.is_encrypted:
            logger.debug('cannot resume encrypted entity {}'.format(
                self._ase.path))
            return None
        self._allocate_disk_space()
        # check if final path exists
        if not self.final_path.exists():  # noqa
            logger.warning('download path {} does not exist'.format(
                self.final_path))
            return None
        if self.hmac is not None:
            raise RuntimeError(
                'unexpected hmac object for entity {}'.format(self._ase.path))
        # re-hash from 0 to offset if needed
        _fd_offset = 0
        _end_offset = min((curr_chunk * rr.chunk_size, rr.length))
        if self.md5 is not None and curr_chunk > 0:
            _blocksize = blobxfer.util.MEGABYTE << 2
            logger.debug(
                'integrity checking existing file {} offset {} -> {}'.format(
                    self.final_path,
                    self.view.fd_start,
                    self.view.fd_start + _end_offset)
            )
            with self._hasher_lock:
                with self.final_path.open('rb') as filedesc:
                    filedesc.seek(self.view.fd_start, 0)
                    while _fd_offset < _end_offset:
                        if (_fd_offset + _blocksize) > _end_offset:
                            _blocksize = _end_offset - _fd_offset
                        _buf = filedesc.read(_blocksize)
                        self.md5.update(_buf)
                        _fd_offset += _blocksize
            del _blocksize
            # compare hashes
            hexdigest = self.md5.hexdigest()
            if rr.md5hexdigest != hexdigest:
                logger.warning(
                    'MD5 mismatch resume={} computed={} for {}'.format(
                        rr.md5hexdigest, hexdigest, self.final_path))
                # reset hasher
                self.md5 = blobxfer.util.new_md5_hasher()
                return None
        # set values from resume
        with self._meta_lock:
            self._offset = _end_offset
            self._chunk_num = curr_chunk
            self._chunk_size = rr.chunk_size
            self._total_chunks = self._compute_total_chunks(rr.chunk_size)
            self._next_integrity_chunk = rr.next_integrity_chunk
            self._outstanding_ops = (
                self._total_chunks - self._next_integrity_chunk
            )
            logger.debug(
                ('resuming file {} from byte={} chunk={} chunk_size={} '
                 'total_chunks={} next_integrity_chunk={} '
                 'outstanding_ops={}').format(
                     self.final_path, self._offset, self._chunk_num,
                     self._chunk_size, self._total_chunks,
                     self._next_integrity_chunk, self._outstanding_ops))
        return _end_offset
448125
def saveLogs(self, filename) :
		""""""
		f = open(filename, 'wb')
		cPickle.dump(self.logs, f)
		f.close()
798640
def _resume(self):
        """"""
        try:
            self._cursor.close()
        except PyMongoError:
            pass
        self._cursor = self._create_cursor()
1142661
def reset(self):
        
        logger.debug('DUT> reset')
        self._log and self.pause()
        self._sendline('reset')
        self._read()
        self._log and self.resume()
496694
public int recover(File... clogs) throws IOException
    {
        CommitLogReplayer recovery = new CommitLogReplayer();
        recovery.recover(clogs);
        return recovery.blockForWrites();
    }
929106
def do_over():
    ''''''
    path = sys.executable
    args = [path] + sys.argv

    # And the rest, after a sudden wet thud, was silence.
    os.execv(path, args)
828615
def resume(self, obj):
        """"""
        if isinstance(obj, str):
            savefile = open(obj, 'rb')
        else:
            savefile = obj
        game = pickle.loads(zlib.decompress(savefile.read()))
        if savefile is not obj:
            savefile.close()
        # Reinstate the random number generator.
        game.random_generator = random.Random()
        game.random_generator.setstate(game.random_state)
        del game.random_state
        return game
1141675
def load_progress(self, resume_step):
        
        resume_step = Status[resume_step]
        progress_path = self.get_restore_path(resume_step)

        # If progress is corrupted, revert to step before
        while not self.check_for_session(resume_step):
            config.LOGGER.error("Ricecooker has not reached {0} status. Reverting to earlier step...".format(resume_step.name))
            # All files are corrupted or absent, restart process
            if resume_step.value - 1 < 0:
                self.init_session()
                return self
            resume_step = Status(resume_step.value - 1)
            progress_path = self.get_restore_path(resume_step)
        config.LOGGER.error("Starting from status {0}".format(resume_step.name))

        # Load manager
        with open(progress_path, 'rb') as handle:
            manager = pickle.load(handle)
            if isinstance(manager, RestoreManager):
                return manager
            else:
                return self
647469
function _fireResume()
        {
            exec(
                    function ()
                    {
                        window.console.log(JS_HANDLE
                                + ": fired resume event to native plugin");
                    },
                    _logError,
                    CDV_HANDLE,
                    CDV_HANDLE_ACTIONS.APP_RESUMED,
                    []
            );
        }
375657
public void doRecovery(){
        try {
            boolean toRestart = Boolean.getBoolean("cloudslang.worker.restart.on.recovery");
            //If we are configured to restart on recovery - do shutdown
            if(toRestart){
                logger.warn("Worker is configured to restart on recovery and since internal recovery is needed the process is exiting...");
                System.exit(EXIT_STATUS);
            }

            synchronized (this){
                //If already in recovery - then return and do nothing
                if(inRecovery){
                    return;
                }
                inRecovery = true;

            }
            syncManager.startRecovery();

            logger.warn("Worker internal recovery started");

            for (WorkerRecoveryListener listener : listeners){
                try {
                    listener.doRecovery();
                } catch (Exception ex) {
                    logger.error("Failed on worker internal recovery", ex);
                }
            }
            if (logger.isDebugEnabled()) logger.debug("Listeners recovery is done");

            retryTemplate.retry(RetryTemplate.INFINITELY, 30*1000L, new RetryTemplate.RetryCallback() {
                @Override
                public void tryOnce() {
					if(logger.isDebugEnabled()) logger.debug("sending worker UP");
                    String newWrv = workerNodeService.up(System.getProperty("worker.uuid"), workerVersionService.getWorkerVersion(), workerVersionService.getWorkerVersionId());
                    setWRV(newWrv);
                    if(logger.isDebugEnabled()) logger.debug("the worker is UP");
                }
            });
            inRecovery = false;
            logger.warn("Worker recovery is done");
        } finally {
            syncManager.finishRecovery();
		}
	}
1248520
private synchronized void recover() {

		try {

			// close all reopen dataRecorders
			this.close();

			Set<String> loggerNames = this.dataLoggerFactory.findLoggerNames();

			// recover all logs
			for (String loggerName : loggerNames) {

				IDataLogger dataLogger = this.dataLoggerFactory.instanciateLogger(loggerName);
				XADataLogger xaLogger = new XADataLogger(dataLogger);

				PhynixxXADataRecorder phynixxXADataRecorder = PhynixxXADataRecorder.recoverDataRecorder(xaLogger, this);
				this.addXADataRecorder(phynixxXADataRecorder);

			}
		} catch (Exception e) {
			throw new DelegatedRuntimeException(e);
		}

	}
194401
def restart(self, offset: int):
        '''
        '''
        yield from self._control_stream.write_command(Command('REST', str(offset)))

        reply = yield from self._control_stream.read_reply()

        self.raise_if_not_match('Restart', ReplyCodes.requested_file_action_pending_further_information, reply)
6809
def cli(env, volume_id, snapshot_id):
    """"""
    block_manager = SoftLayer.BlockStorageManager(env.client)
    success = block_manager.restore_from_snapshot(volume_id, snapshot_id)

    if success:
        click.echo('Block volume %s is being restored using snapshot %s'
                   % (volume_id, snapshot_id))
101508
void checkpoint(boolean defrag) {

        if (filesReadOnly) {
            return;
        }

        database.logger.appLog.logContext(SimpleLog.LOG_NORMAL, "start");
        deleteNewAndOldFiles();
        writeScript(false);

        if (cache != null) {
            if (forceDefrag()) {
                defrag = true;
            }

            if (defrag) {
                try {
                    cache.defrag();
                } catch (Exception e) {}
            } else {
                cache.close(true);

                try {
                    cache.backupFile();
                } catch (Exception e1) {
                    deleteNewBackup();
                    cache.open(false);

                    return;
                }

                cache.open(false);
            }
        }

        properties.setDBModified(HsqlDatabaseProperties.FILES_NEW);
        closeLog();
        deleteLog();
        renameNewScript();
        renameNewBackup();
        properties.setDBModified(HsqlDatabaseProperties.FILES_MODIFIED);

        if (dbLogWriter == null) {
            return;
        }

        openLog();

        Session[] sessions = database.sessionManager.getAllSessions();

/*
        try {
            for (int i = 0; i < sessions.length; i++) {
                Session session = sessions[i];

                if (session.isAutoCommit() == false) {
                    dbLogWriter.writeLogStatement(session, session.getAutoCommitStatement());
                }
            }
        } catch (IOException e) {
            throw Error.error(ErrorCode.FILE_IO_ERROR, logFileName);
        }
*/
        database.logger.appLog.logContext(SimpleLog.LOG_NORMAL, "end");
    }
1169088
def resume_all(self):
        """"""
        for alias, service in self._service_objects.items():
            with expects.expect_no_raises(
                    'Failed to pause service "%s".' % alias):
                service.resume()