Unified storage semantics #63
sreeja
started this conversation in
Ideas and new features
Replies: 1 comment
-
After an internal discussion, the changes are as follows:
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This discussion aims to define semantics for Zenoh storage irrespective of the backend technology used. We will also document the cases that the storage technology implementations should take care of.
Guarantees needed from a storage
Support for
PUT
,DEL
, andGET
, for a single key or a set of keysThe first two operations are updates and the last is a query. If an operation deals with a set of keys, instead of a single key, it will be referred to as a wildcard operation.
Deterministic behaviour
The behaviour of the storage upon receiving one or more concurrent or sequential operations must be deterministic.
The latest value is always retained
A storage must retain at least the latest value if it receives multiple updates on the same key. HLC timestamp is used as a tiebreaker. This guarantee is applicable per key.
Convergence
Consider more than one Zenoh storage storing the same key. A key in all the storages must have the same value if they receive the same set of updates. (Even though this is actually Strong Eventual Consistency, we will simply call this behaviour Eventual Consistency for the purpose of this document).
Consistent wildcard updates
A wildcard operation must consider all matching keys existing in the system. This means, if the updates are ordered (first using the partial order obtained from HLC and then using the device ID to obtain total order), all the updates concerning keys matching the key expression of the wild card update are considered.
Metadata required to maintain guarantees
Keeps track of the deletes that happened, with their timestamp
Design requirements
The database when read by an external application other than Zenoh, should maintain the expected behaviour
Find a sweet-spot in the tradeoff between memory consumption and computational/network usage
Parameters affecting the design choices
This parameter determines if we should store the data durably. The data should be recoverable even in case of a node crash as long as the hard disk is not corrupted.
This parameter decides if a storage wants to keep history or not. The option
All
keeps all updates, whileLatest
keeps only the latest update.To indicate whether a storage is hosted locally or if it is on a remote site, the latter case might incur costly data transfers.
Persistence
,History
andLocation
will belong toStorageConfig
.Current implementations
* under discussion
Architecture of the storage manager plugin
Traits
Internal information maintained
The first two are essential for correct functioning of the storage. The last two are only for optimising datastore hits. The key-timestamp map maintains the metadata which is useful to determine whether or not an incoming operation is outdated, and also for replication. The wildcard to key mapping can be included as part of the key-timestamp map if the key-timestamp map is stored as a trie of key chunks.
Design for each combination of storage
Along with the categories of storages defined earlier, we also have replication that requires metadata from the storage. Hence from now onwards, we consider 4 configurable parameters for a storage: Persistency - History_keeping - Location - Replication.
Volatile
, both tombstones and wildcard updates can be stored in memory. Otherwise, they have to be persisted on disk which brings in the problem of maintaining consistency with the different storages.All
we don’t have to maintain a cache with the latest timestamp per replica. (if not configured for replication)Remote
, we need to maintain a cache for optimization. This cache can be reused in case of replication.Additional storage specific warnings
If the storage is storing data exploiting the key expression hierarchy, it has to take care of conflicts in the following cases:
PUT a/b/c
followed byPUT a
PUT a
followed byPUT a/b/c
The hierarchical storage should have both keys
a
anda/b/c
, and nota/b
.Basically, keep in mind that each chunk in the hierarchy can be either an intermediate path in the key expression that doesn’t store any value, or it actually is the end-point and stores a value.
Further points to discuss
Interceptors
Currently we have a provision for declaring interceptors, both incoming and outgoing. Since it is not yet used anywhere, we may discard that for the time being.
If we decide to maintain interceptors, we need to keep the following in mind:
Beta Was this translation helpful? Give feedback.
All reactions