@Override public Version find(Id id) { // XXX PatchLogBase.find(Id) FmtLog.warn(LOG, "Not implemented (yet). find(Id)"); return Version.UNSET; }
private static void exceptionSwitching(RuntimeException ex) { //System.err.printf("Switching: %s\n", ex.getMessage()); //ex.printStackTrace(); if ( ! silentSwitchOver ) FmtLog.warn(LOG, "HTTP failure switch over: %s", ex.getMessage()); }
public static void badPatchWarning(String fmt, Object...args) { FmtLog.warn(LOG, String.format(fmt, args)); }
/** Basic tests - not valid DataSource area but the skeleton of one. * Checks it is a directory and has a configuration files. */ /*package*/ static boolean isMinimalDataSource(Path path) { if ( ! Files.isDirectory(path) ) return false ; Path cfg = path.resolve(FileNames.DS_CONFIG); if ( ! Files.exists(cfg) ) return false ; if ( ! Files.isRegularFile(cfg) ) FmtLog.warn(Delta.DELTA_LOG, "Data source configuration file name exists but is not a file: %s", cfg); if ( ! Files.isReadable(cfg) ) FmtLog.warn(Delta.DELTA_LOG, "Data source configuration file exists but is not readable: %s", cfg); return true ; }
/** Release this {@code FileStore} - do not use again. */ public void release() { // Overlapping outstanding operations can continue. Path k = key(directory, basename); FileStore old = areas.remove(k); if ( old == null ) FmtLog.warn(LOG, "Releasing non-existent FileStore: (%s, %s)", directory, basename); }
public static void warn(Class<?> cls, String fmt, Object...args) { warn(log(cls), fmt, args) ; }
public static void warn(Class<?> cls, Throwable th, String fmt, Object...args) { warn(log(cls), th, fmt, args) ; }
private static List<String> scanForTmpFiles(Path directory) { List<String> tmpFiles = new ArrayList<>(); try (DirectoryStream<Path> stream = Files.newDirectoryStream(directory, "*."+tmpBasename)) { for ( Path f : stream ) { if ( Files.isRegularFile(f) ) tmpFiles.add(f.toAbsolutePath().toString()); } } catch (IOException ex) { FmtLog.warn(LOG, "Can't inspect directory: %s", directory); throw new PatchException(ex); } return tmpFiles; }
public static void warn(Class<?> cls, String fmt, Object...args) { warn(log(cls), fmt, args) ; }
public static void warn(Class<?> cls, Throwable th, String fmt, Object...args) { warn(log(cls), th, fmt, args) ; }
@Override protected void sync() { //FmtLog.debug(LOGZK, "[%s] Store sync", instance); try { List<String> logNames = activeLogs(); //FmtLog.debug(LOGZK, "[%s] Store sync : %s", instance, logNames); updateLogChanges(logNames, false); } catch (Exception ex) { FmtLog.warn(LOGZK, "Exception in sync: "+ex.getClass().getSimpleName()+" "+ex.getMessage()); } }
private final void check(NodeIdType type, int v1, long v2) { if ( type == PTR ) return; if ( type == SPECIAL ) return; // 64 bit NodeId. int x = ( type == XSD_DOUBLE ) ? (int)BitsLong.unpack(v2, 62, 64) // High two bits : (int)BitsLong.unpack(v2, 56, 64); // else if ( x != 0 ) FmtLog.warn(getClass(), "Type set in long: type=%s value=%016X", type, v2); }
@Override public Binding apply(List<String> row) { if ( row.size() != vars.size() ) FmtLog.warn(log, "Row %d: Length=%d: expected=%d", count, row.size(), vars.size()) ; BindingMap binding = BindingFactory.create() ; // Check. for (int i = 0 ; i < vars.size() ; i++ ) { Var v = vars.get(i) ; String field = (i<row.size()) ? row.get(i) : "" ; Node n = NodeFactory.createLiteral(field) ; binding.add(v, n); } count++ ; return binding ; }} ; Iterator<Binding> bindings = Iter.map(parser.iterator(), transform) ;
/** 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; }
@Override public RDFPatch fetch(Id key) { String p = Zk.zkPath(patches, key.asPlainString()); byte[] b = Zk.zkFetch(client, p); if ( b == null ) return null; if ( b.length == 0 ) FmtLog.warn(LOG, "fetch(%s) : Zero bytes", key); return RDFPatchOps.read(new ByteArrayInputStream(b)); }
/** Actively get the remote log latest id */ public Id getRemoteIdLatest() { checkDeltaConnection(); PatchLogInfo logInfo = dLink.getPatchLogInfo(datasourceId); if ( logInfo == null ) { // Can this happen? Deleted datasourceId? FmtLog.warn(LOG, "Failed to get remote latest patchId"); return null; } return logInfo.getLatestPatch(); }
public void shutdown() { if ( coordinatorLock == null ) return ; if ( countActive() > 0 ) FmtLog.warn(log, "Transactions active: W=%d, R=%d", countActiveWriter(), countActiveReaders()); components.forEach((id, c) -> c.shutdown()) ; shutdownHooks.forEach((h)-> h.shutdown()) ; coordinatorLock = null ; journal.close(); }
public void shutdown() { if ( coordinatorLock == null ) return ; if ( countActive() > 0 ) FmtLog.warn(log, "Transactions active: W=%d, R=%d", countActiveWriter(), countActiveReaders()); components.forEach((id, c) -> c.shutdown()) ; shutdownHooks.forEach((h)-> h.shutdown()) ; coordinatorLock = null ; journal.close(); }
public PatchLogInfo getPatchLogInfo() { checkDeltaConnection(); PatchLogInfo info = dLink.getPatchLogInfo(datasourceId); if ( info != null ) { if ( remote.get() != null ) { if ( Version.isValid(getRemoteVersionCached()) && info.getMaxVersion().value() < getRemoteVersionCached().value() ) { String dsName = dLink.getDataSourceName(datasourceId); FmtLog.warn(LOG, "[ds:%s %s] Remote version behind local tracking of remote version: [%d, %d]", datasourceId, dsName, info.getMaxVersion(), getRemoteVersionCached()); } } // Set the local copy whenever we get the remote latest. remote.set(info); } return info; }
/** Send a patch to log server. */ public synchronized void append(RDFPatch patch) { checkDeltaConnection(); Version ver = dLink.append(datasourceId, patch); if ( ! Version.isValid(ver) ) // Didn't happen. return ; Version ver0 = state.version(); if ( ver0.value() >= ver.value() ) FmtLog.warn(LOG, "[%s] Version did not advance: %d -> %d", datasourceId.toString(), ver0 , ver); state.updateState(ver, Id.fromNode(patch.getId())); }