private static void logOne(Logger log, String property) { FmtLog.info(log, " %-20s = %s", property, System.getProperty(property)); }
private void log(String fmt, Object... args) { if ( TRACKING ) FmtLog.debug(log, fmt, args); } }
@Override public Version find(Id id) { // XXX PatchLogBase.find(Id) FmtLog.warn(LOG, "Not implemented (yet). find(Id)"); return Version.UNSET; }
/** Sync until some version */ private void syncToVersion(Version version) { //long remoteVer = getRemoteVersionLatestOrDefault(VERSION_UNSET); if ( ! Version.isValid(version) ) { FmtLog.debug(LOG, "Sync: Asked for no patches to sync"); return; } Version localVer = getLocalVersion(); // // -1 ==> no entries, uninitialized. // if ( DeltaConst.versionUninitialized(localVer) ) { // FmtLog.info(LOG, "Sync: No log entries"); // localVer = DeltaConst.VERSION_INIT; // setLocalState(localVer, (Node)null); // return; // } if ( localVer.value() > version.value() ) FmtLog.info(LOG, "[%s] Local version ahead of remote : [local=%d, remote=%d]", datasourceId, getLocalVersion(), getRemoteVersionCached()); if ( localVer.value() >= version.value() ) return; // bring up-to-date. FmtLog.info(LOG, "Sync: Versions [%s, %s]", localVer, version); playPatches(localVer.value()+1, version.value()) ; //FmtLog.info(LOG, "Now: Versions [%d, %d]", getLocalVersion(), remoteVer); }
private void newState(long newVersion, Id patch, Id prev) { synchronized(lock) { FmtLog.debug(LOG, "newVersion %d -> %d", version, newVersion); //FmtLog.info(LOG, "[%s] newState %s -> %s", instance, Version.str(version), Version.str(newVersion)); if ( newVersion <= version ) { if ( newVersion == version ) { if ( ! Objects.equals(patch, current) || ! Objects.equals(prev,previous) ) FmtLog.error(LOG, "Same version but different ids: current=(%s,%s), proposed=(%s,%s)", current, previous, patch, prev); } return ; } //FmtLog.debug(LOG, "-- [%d] State: [%s] (%s, %s, %s)", instance, dsd.getName(), version, current, previous); if ( newVersion == DeltaConst.VERSION_FIRST && ! earliestVersion.isValid() ) { // If going no patch -> patch, set the start. earliestVersion = Version.FIRST; earliestId = patch; } // newVersion > version this.version = newVersion; this.current = patch; this.previous = prev; } }
/** Find the indexes of files in this FileStore. Return sorted, low to high. */ private static boolean deleteTmpFiles(Path directory) { boolean found = false; try (DirectoryStream<Path> stream = Files.newDirectoryStream(directory, tmpBasename + "*")) { for ( Path f : stream ) { found = true; Files.delete(f); if ( Files.exists(f) ) FmtLog.error(LOG, "Failed to delete tmp file: %s", f); } } catch (IOException ex) { FmtLog.warn(LOG, "Can't check directory for tmp files: %s", directory); throw new PatchException(ex); } return found; }
public static void badPatchError(String fmt, Object...args) { FmtLog.error(LOG, String.format(fmt, args)); }
public static void debug(Logger log, String fmt, Object...args) { if ( log.isDebugEnabled() ) log.debug(format(fmt, args)) ; }
private void jsonSetState(JsonObject obj) { try { FmtLog.debug(LOG, "jsonToState %s",JSON.toStringFlat(obj)); long ver = obj.get(fVersion).getAsNumber().value().longValue(); if ( ver == version ) return ; Id newCurrent = getIdOrNull(obj, fId); Id newPrevious = getIdOrNull(obj, fPrevious); newState(ver, newCurrent, newPrevious); } catch (RuntimeException ex) { FmtLog.error(this.getClass(), "Failed to load the patch log index state", ex); } }
private void checkReplaySafe() { if ( ! checking ) return ; long x = activeTransactions.get(); if ( x == 0 ) return ; // Not a consistent view. long r = activeReaders.get(); long w = activeWriters.get(); FmtLog.error(log, "checkReplaySafe: There are currently active transactions. C=%d (R=%d, W=%d)", x, r, w) ; }
public static void debug(Logger log, Throwable th, String fmt, Object...args) { if ( log.isDebugEnabled() ) log.debug(format(fmt, args), th) ; }
private static void logOne(Logger log, String property) { FmtLog.info(log, " %-20s = %s", property, System.getProperty(property)); }