Perform recovery on a list of commit log files.

@param clogs   the list of commit log files to replay
@return the number of mutations replayed
496694
public int recover(File... clogs) throws IOException
    {
        CommitLogReplayer recovery = new CommitLogReplayer();
        recovery.recover(clogs);
        return recovery.blockForWrites();
    }
554062
private void recover(Connection conn) throws SQLException, RecoverableUnitSectionExistsException, InternalLogException {
        if (tc.isEntryEnabled())
            Tr.entry(tc, "recover", conn);

        Statement recoveryStmt = null;
        ResultSet recoveryRS = null;

        try {
            recoveryStmt = conn.createStatement();
            String queryString = "SELECT RU_ID, RUSECTION_ID, RUSECTION_DATA_INDEX, DATA" +
                                 " FROM " + _recoveryTableName + _logIdentifierString + _recoveryTableNameSuffix +
                                 " WHERE SERVER_NAME='" + _serverName +
                                 "' AND SERVICE_ID=" + _recoveryAgent.clientIdentifier();
            if (tc.isDebugEnabled())
                Tr.debug(tc, "Retrieve all rows from table using - " + queryString);

            recoveryRS = recoveryStmt.executeQuery(queryString);

            while (recoveryRS.next()) {
                final long ruId = recoveryRS.getLong(1);
                if (ruId != -1) {
                    SQLRecoverableUnitImpl ru = (SQLRecoverableUnitImpl) _recoverableUnits.get(ruId);
                    if (ru == null) {
                        if (tc.isDebugEnabled())
                            Tr.debug(tc, "Creating ru with id: " + ruId);
                        ru = new SQLRecoverableUnitImpl(this, ruId, _failureScope, true);
                    }

                    final long sectId = recoveryRS.getLong(2);
                    final int index = recoveryRS.getInt(3);
                    final byte[] data = recoveryRS.getBytes(4);

                    if (tc.isEventEnabled()) {
                        Tr.event(tc, "sql tranlog: read ruId: " + ruId);
                        Tr.event(tc, "sql tranlog: read sectionId: " + sectId);
                        Tr.event(tc, "sql tranlog: read item: " + index);
                        Tr.event(tc, "sql tranlog: read data: " + RLSUtils.toHexString(data, RLSUtils.MAX_DISPLAY_BYTES));
                    }

                    SQLRecoverableUnitSectionImpl sect = (SQLRecoverableUnitSectionImpl) ru.lookupSection((int) sectId);
                    if (sect == null) {
                        sect = (SQLRecoverableUnitSectionImpl) ru.createSection((int) sectId, index == 0);
                    }

                    sect.addData(index, data);
                } else if (tc.isDebugEnabled())
                    Tr.debug(tc, "Bypass locking row with id: " + ruId);
            }
        } finally {
            if (recoveryRS != null && !recoveryRS.isClosed())
                recoveryRS.close();
            if (recoveryStmt != null && !recoveryStmt.isClosed())
                recoveryStmt.close();
        }

        if (tc.isEntryEnabled())
            Tr.exit(tc, "recover");
    }
297169
public boolean recover(RecoveryManager recoveryManager, ClassLoader cl, Xid[] xids) {
        boolean success = true; // flag to indicate that we recovered all RMs

        if (tc.isEntryEnabled())
            Tr.entry(tc, "recover", new Object[] { this, _failureScopeController.serverName() });

        final int restartEpoch = recoveryManager.getCurrentEpoch();
        final byte[] cruuid = recoveryManager.getApplId();

        for (PartnerLogData pld : _partnerLogTable) {
            if (!pld.recover(cl, xids, null, cruuid, restartEpoch)) {
                success = false;
            }

            // Determine if shutdown processing started on another thread. 
            // If it has, no further action can be taken.
            if (recoveryManager.shutdownInProgress()) {
                success = false;
                break;
            }
        }

        if (tc.isEntryEnabled())
            Tr.exit(tc, "recover", success);
        return success;
    }
752865
public static List<CloneGroup> detect(CloneIndex cloneIndex, Collection<Block> fileBlocks) {
    if (fileBlocks.isEmpty()) {
      return Collections.emptyList();
    }
    OriginalCloneDetectionAlgorithm reporter = new OriginalCloneDetectionAlgorithm(cloneIndex);
    reporter.findClones(fileBlocks);
    return reporter.filter.getResult();
  }
499082
public static void cleanObsolete() {
        HandlerThreadFactory.getWriteLogThreadHandler().post(new Runnable() {
            @Override
            public void run() {
                long now = System.currentTimeMillis();
                File[] f = BlockCanaryInternals.getLogFiles();
                if (f != null && f.length > 0) {
                    synchronized (SAVE_DELETE_LOCK) {
                        for (File aF : f) {
                            if (now - aF.lastModified() > OBSOLETE_DURATION) {
                                aF.delete();
                            }
                        }
                    }
                }
            }
        });
    }
1326663
def get_log_entries(self):
        
        if self.retrieved:
            raise errors.IllegalState('List has already been retrieved.')
        self.retrieved = True
        return objects.LogEntryList(self._results, runtime=self._runtime)
61188
def get_last_commit_modifying_files(repo: Repo, *files) -> str:
    
    return repo.git.log(*files, n=1, format="%H")
877089
public static void reset(
		final Collection<MasterTriggerRestoreHook<?>> hooks,
		final Logger log) throws FlinkException {

		for (MasterTriggerRestoreHook<?> hook : hooks) {
			final String id = hook.getIdentifier();
			try {
				hook.reset();
			}
			catch (Throwable t) {
				ExceptionUtils.rethrowIfFatalErrorOrOOM(t);
				throw new FlinkException("Error while resetting checkpoint master hook '" + id + '\'', t);
			}
		}
	}
875779
int loadFSEdits(EditLogInputStream edits, long lastAppliedTxId) 
  throws IOException {
    long startTime = now();
    this.lastAppliedTxId = lastAppliedTxId;
    int numEdits = loadFSEdits(edits, true);
    FSImage.LOG.info("Edits file " + edits.toString() 
        + " of size: " + edits.length() + ", # of edits: " + numEdits 
        + " loaded in: " + (now()-startTime)/1000 + " seconds.");
    return numEdits;
  }
1073104
@RequestMapping(value = "changelog/{uuid}/commits", method = RequestMethod.GET)
    public GitChangeLogCommits changeLogCommits(@PathVariable String uuid) {
        // Gets the change log
        GitChangeLog changeLog = getChangeLog(uuid);
        // Cached?
        GitChangeLogCommits commits = changeLog.getCommits();
        if (commits != null) {
            return commits;
        }
        // Loads the commits
        GitChangeLogCommits loadedCommits = changeLog.loadCommits(gitService::getChangeLogCommits);
        // Stores in cache
        logCache.put(uuid, changeLog);
        // OK
        return loadedCommits;
    }
416394
def commitreturn(self, cursor, qstring, vals=()):
    ""
    cursor.execute(qstring, vals)
    return cursor.fetchall()[0]
1315539
def get_logs(self):
        
        if self.retrieved:
            raise errors.IllegalState('List has already been retrieved.')
        self.retrieved = True
        return objects.LogList(self._results, runtime=self._runtime)
1205483
private RetriesExhaustedWithDetailsException getExceptions()
      throws RetriesExhaustedWithDetailsException {
    if (!hasExceptions.get()) {
      return null;
    }

    ArrayList<MutationException> mutationExceptions = null;
    synchronized (globalExceptions) {
      hasExceptions.set(false);
      if (globalExceptions.isEmpty()) {
        return null;
      }

      mutationExceptions = new ArrayList<>(globalExceptions);
      globalExceptions.clear();
    }

    List<Throwable> problems = new ArrayList<>(mutationExceptions.size());
    ArrayList<String> hostnames = new ArrayList<>(mutationExceptions.size());
    List<Row> failedMutations = new ArrayList<>(mutationExceptions.size());

    if (!mutationExceptions.isEmpty()) {
      LOG.warn("Exception occurred in BufferedMutator", mutationExceptions.get(0).throwable);
    }
    for (MutationException mutationException : mutationExceptions) {
      problems.add(mutationException.throwable);
      failedMutations.add(mutationException.mutation);
      hostnames.add(host);
      LOG.debug("Exception occurred in BufferedMutator", mutationException.throwable);
    }

    return new RetriesExhaustedWithDetailsException(problems, failedMutations, hostnames);
  }
199115
void forceRecycleAll(Iterable<UUID> droppedCfs)
    {
        List<CommitLogSegment> segmentsToRecycle = new ArrayList<>(activeSegments);
        CommitLogSegment last = segmentsToRecycle.get(segmentsToRecycle.size() - 1);
        advanceAllocatingFrom(last);

        // wait for the commit log modifications
        last.waitForModifications();

        // make sure the writes have materialized inside of the memtables by waiting for all outstanding writes
        // on the relevant keyspaces to complete
        Set<Keyspace> keyspaces = new HashSet<>();
        for (UUID cfId : last.getDirtyCFIDs())
        {
            ColumnFamilyStore cfs = Schema.instance.getColumnFamilyStoreInstance(cfId);
            if (cfs != null)
                keyspaces.add(cfs.keyspace);
        }
        for (Keyspace keyspace : keyspaces)
            keyspace.writeOrder.awaitNewBarrier();

        // flush and wait for all CFs that are dirty in segments up-to and including 'last'
        Future<?> future = flushDataFrom(segmentsToRecycle, true);
        try
        {
            future.get();

            for (CommitLogSegment segment : activeSegments)
                for (UUID cfId : droppedCfs)
                    segment.markClean(cfId, segment.getContext());

            // now recycle segments that are unused, as we may not have triggered a discardCompletedSegments()
            // if the previous active segment was the only one to recycle (since an active segment isn't
            // necessarily dirty, and we only call dCS after a flush).
            for (CommitLogSegment segment : activeSegments)
                if (segment.isUnused())
                    recycleSegment(segment);

            CommitLogSegment first;
            if ((first = activeSegments.peek()) != null && first.id <= last.id)
                logger.error("Failed to force-recycle all segments; at least one segment is still in use with dirty CFs.");
        }
        catch (Throwable t)
        {
            // for now just log the error and return false, indicating that we failed
            logger.error("Failed waiting for a forced recycle of in-use commit log segments", t);
        }
    }
464662
private void remainChangesBack(PlainChangesLog cLog)
   {
      changesLog.addAll(cLog.getAllStates());
      if (LOG.isDebugEnabled())
      {
         LOG.debug(" ----- rollback ----- \n" + cLog.dump());
      }
   }
906806
CommitLogSegment allocatingFrom()
    {
        CommitLogSegment r = allocatingFrom;
        if (r == null)
        {
            advanceAllocatingFrom(null);
            r = allocatingFrom;
        }
        return r;
    }
106416
def retry_failed_logs_action(self, request, queryset):
        """"""
        count = 0
        for trigger_log in queryset:
            retried = _retry_failed_log(trigger_log)
            if retried:
                count += 1
        self.message_user(
            request,
            _('{count} failed trigger logs retried.').format(count=count),
        )