Class DcrStorage
java.lang.Object
org.gridgain.internal.dcr.metastorage.DcrStorage
Replication storage based on metastorage
MetaStorageManager.-
Constructor Summary
ConstructorsConstructorDescriptionDcrStorage(org.apache.ignite.internal.metastorage.MetaStorageManager manager) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionfindByNode(String nodeName) Find all replications by worker node.forceUpdate(String name, Function<ReplicationEntry, ReplicationEntry> func) Force-update an entry even when the new value equals the current one.Returns stored replication options by provided identifier.getAll()Returns all stored replication entries.CompletableFuture<Map<String,byte[]>> getWatermarks(String name) Reads every saved watermark for the given replication.put(String name, ReplicationEntry entry) Persists replication to storage.putWatermark(String name, String tableName, byte[] watermarkBytes) Persists the latest CQ watermark for(name, tableName)under a separate metastorage key.org.gridgain.internal.lang.DisposableregisterStoreListener(DcrStorageListener listener) Registers storage listener.Removes replication from storage.remove(String name, Predicate<ReplicationEntry> checker) Removes replication from storage if it satisfies the supplied predicate.removeWatermark(String name, String tableName) Removes the saved watermark for a single(name, tableName)pair.removeWatermarks(String name) Removes every saved watermark for the given replication.update(String name, Function<ReplicationEntry, ReplicationEntry> func, boolean withRetry) Update entry.
-
Constructor Details
-
DcrStorage
public DcrStorage(org.apache.ignite.internal.metastorage.MetaStorageManager manager) Constructor.- Parameters:
manager- Meta storage manager.
-
-
Method Details
-
registerStoreListener
Registers storage listener.- Parameters:
listener- Store listener to register.
-
put
Persists replication to storage.- Parameters:
name- Replication name.entry- Replication options.- Returns:
- Future with
trueresult if status updated successfully.
-
findByNode
Find all replications by worker node.- Parameters:
nodeName- Worker node name.- Returns:
- Future with list of replications which hosted on provided node.
-
get
Returns stored replication options by provided identifier.- Parameters:
name- Replication name.- Returns:
- Future with options result or
nullin case when replication with provided identifier doesn't exist.
-
getAll
Returns all stored replication entries.- Returns:
- Future with list of replication entries.
-
remove
Removes replication from storage.- Parameters:
name- Replication name.- Returns:
- Future with
trueresult if status updated successfully.
-
remove
Removes replication from storage if it satisfies the supplied predicate.- Parameters:
name- Replication name.checker- Predicate to apply to the replication to determine if it should be deleted.- Returns:
- Future with
trueresult if status updated successfully.
-
update
public CompletableFuture<Boolean> update(String name, Function<ReplicationEntry, ReplicationEntry> func, boolean withRetry) Update entry.- Parameters:
name- Replication name.func- Update function.withRetry- Whether to retry on CAS failure.- Returns:
- Future with
trueresult if status updated successfully.
-
forceUpdate
public CompletableFuture<Boolean> forceUpdate(String name, Function<ReplicationEntry, ReplicationEntry> func) Force-update an entry even when the new value equals the current one. This creates a new metastorage revision which triggers watch listeners.- Parameters:
name- Replication name.func- Update function.- Returns:
- Future with
trueresult if entry was written.
-
putWatermark
Persists the latest CQ watermark for(name, tableName)under a separate metastorage key. Last-write-wins semantics — no CAS — because watermarks only move forward.- Parameters:
name- Replication name.tableName- Fully-qualified table name.watermarkBytes- Serialized watermark.
-
getWatermarks
Reads every saved watermark for the given replication.- Parameters:
name- Replication name.- Returns:
- Map of
tableName -> watermarkBytes; empty when nothing is saved yet.
-
removeWatermarks
Removes every saved watermark for the given replication. Called when the replication itself is removed. -
removeWatermark
Removes the saved watermark for a single(name, tableName)pair. Used when a table's watermark is no longer trustworthy (e.g. CQ rejected it as too old) and the table is about to be truncated and re-FST'd. Removing the watermark first guarantees that a crash mid-truncate cannot leave the system trying to resume from a stale watermark on a partially-truncated table.
-