public static ConflictDetectionManager createWithNoConflictDetection() { return new ConflictDetectionManager( new CacheLoader<TableReference, ConflictHandler>() { @Override public ConflictHandler load(TableReference tableReference) throws Exception { return ConflictHandler.IGNORE_ALL; } }); }
protected ConflictHandler getConflictHandlerForTable(TableReference tableRef) { return Preconditions.checkNotNull(conflictDetectionManager.get(tableRef), "Not a valid table for this transaction. Make sure this table name exists or has a valid namespace: %s", tableRef); }
private Map<TableReference, ConflictHandler> getConflictHandlerWithOverrides() { Map<TableReference, ConflictHandler> conflictHandlersWithOverrides = new HashMap<>(); conflictHandlersWithOverrides.putAll(conflictDetectionManager.getCachedValues()); conflictHandlersWithOverrides.putAll(conflictHandlerOverrides); return conflictHandlersWithOverrides; } }
private static ConflictDetectionManager create(KeyValueService kvs, boolean warmCache) { ConflictDetectionManager conflictDetectionManager = new ConflictDetectionManager( new CacheLoader<TableReference, ConflictHandler>() { @Override conflictDetectionManager.warmCacheWith( Maps.transformValues(kvs.getMetadataForTables(), metadata -> { if (metadata == null) {
private static ConflictDetectionManager create(KeyValueService kvs, boolean warmCache) { ConflictDetectionManager conflictDetectionManager = new ConflictDetectionManager( new CacheLoader<TableReference, ConflictHandler>() { @Override conflictDetectionManager.warmCacheWith( Maps.transformValues(kvs.getMetadataForTables(), metadata -> { if (metadata == null) {
@VisibleForTesting static ConflictDetectionManager createWithStaticConflictDetection( Map<TableReference, ConflictHandler> staticMap) { return new ConflictDetectionManager( new CacheLoader<TableReference, ConflictHandler>() { @Override public ConflictHandler load(TableReference tableReference) throws Exception { return staticMap.getOrDefault( tableReference, ConflictHandler.RETRY_ON_WRITE_WRITE); } }); } }
boolean isSerializableTable(TableReference table) { // If the metadata is null, we assume that the conflict handler is not SERIALIZABLE. // In that case the transaction will fail on commit if it has writes. ConflictHandler conflictHandler = conflictDetectionManager.get(table); return conflictHandler.checkReadWriteConflicts(); }
private Map<TableReference, ConflictHandler> getConflictHandlerWithOverrides() { Map<TableReference, ConflictHandler> conflictHandlersWithOverrides = new HashMap<>(); conflictHandlersWithOverrides.putAll(conflictDetectionManager.getCachedValues()); conflictHandlersWithOverrides.putAll(conflictHandlerOverrides); return conflictHandlersWithOverrides; } }
public static ConflictDetectionManager createWithNoConflictDetection() { return new ConflictDetectionManager( new CacheLoader<TableReference, ConflictHandler>() { @Override public ConflictHandler load(TableReference tableReference) throws Exception { return ConflictHandler.IGNORE_ALL; } }); }
protected ConflictHandler getConflictHandlerForTable(TableReference tableRef) { return Preconditions.checkNotNull(conflictDetectionManager.get(tableRef), "Not a valid table for this transaction. Make sure this table name exists or has a valid namespace: %s", tableRef); }
@VisibleForTesting static ConflictDetectionManager createWithStaticConflictDetection( Map<TableReference, ConflictHandler> staticMap) { return new ConflictDetectionManager( new CacheLoader<TableReference, ConflictHandler>() { @Override public ConflictHandler load(TableReference tableReference) throws Exception { return staticMap.getOrDefault( tableReference, ConflictHandler.RETRY_ON_WRITE_WRITE); } }); } }
boolean isSerializableTable(TableReference table) { // If the metadata is null, we assume that the conflict handler is not SERIALIZABLE. // In that case the transaction will fail on commit if it has writes. ConflictHandler conflictHandler = conflictDetectionManager.get(table); return conflictHandler.checkReadWriteConflicts(); }