Conversation
41cce0b to
b002506
Compare
|
this is one alternative approach to #6906 |
|
will add more details in #6831 |
|
It's not true that we need it only for replication with stream_journal. We may have interleaved streams if for example two fibers try to write values during backup. One of them is serializing a huge value and another - another entry, which it can slip in between the serialization of the huge value if we lift I wrote explicitly that the acceptance criteria is that rdb_tests (snapshotting) should pass with the new format. |
b002506 to
d300a9c
Compare
541cb7e to
cde5f4a
Compare
|
It might be better to tag on bucket ids (+ one fixed tag for journal) than just baseline. This way for example:
Now the serializer data looks like:
For this to work the loader has to now maintain one loader per bucket though (max number of loaders at a time = max number of buckets in stream at a time), and the end marker can tell when a bucket is done and the loader can be torn down or reused. |
|
but how come bucket ids are related to it? we just need to reassemble a single value. a bucket holds multiple values. we can have a unique tag per key. a key can be such a tag, for example. |
There are two reasons I thought of buckets
Looking at the loader side, because we already have support for incremental loading of keys using The main thing that will change in the loader is
So with key as tag (or a counter that maps to key) the end chunk marker is also not needed. The incremental parsing in |
|
Also if the baseline entries are tagged by key, journal entries do not need to be tagged. They are already defined by opcode and never split. So they will be treated distinctly from entries tagged on key by the loader correctly without chunk header. |
|
Changes for loader to do next in this PR, rough steps:
|
a5a81cb to
9efb38b
Compare
cbc4da0 to
b7d6925
Compare
|
The lower level read functions in rdb load (ReadSet etc) also need to stop at the payload size, not just "n" items. we already have the condition in loadkeyvalpair etc. The same conditions need to be pushed down into the lower layers too |
bb5d11f to
ebb14b3
Compare
0bb5174 to
eee8dc4
Compare
|
At this point the one crucial thing to add to this PR is tests that actually interleave data across keys/buckets ie preempt and write |
b56a290 to
28a50d1
Compare
|
in the latest version:
|
1f3b918 to
1d38527
Compare
Signed-off-by: Abhijat Malviya <abhijat@dragonflydb.io>
Signed-off-by: Abhijat Malviya <abhijat@dragonflydb.io>
1d38527 to
bf1687f
Compare
Signed-off-by: Abhijat Malviya <abhijat@dragonflydb.io>
Signed-off-by: Abhijat Malviya <abhijat@dragonflydb.io>
bf1687f to
debd811
Compare
|
new test interleaves multiple keys forcefully and inserts journal entries and offset commands around each chunk of key |
Signed-off-by: Abhijat Malviya <abhijat@dragonflydb.io>
Signed-off-by: Abhijat Malviya <abhijat@dragonflydb.io>
ee4617d to
d3e1760
Compare
Signed-off-by: Abhijat Malviya <abhijat@dragonflydb.io>
d3e1760 to
33136a3
Compare
WIP
Serializer on flush prefixes an envelope: opcode,tag,size to the chunk for baseline (key,value) entries.
The tag for baseline data is a monotonic increasing stream id of 4 bytes. A new one is assigned per SaveEntry call (so each key).
Journal and other non baseline types use a sentinel value and are not tagged but still stashed
To guard against interleaved (baseline - journal, baseline - baseline) entries caused by eg yield of large SaveEntry, a stash is added to serializer, and a new state:
current_stream_id_serialization_tagged_chunksThe compression of entries in stash is skipped. It might be possible to do this but currently the
number_of_chunks_field is saved and restored across stash, because the stash function usesPrepareFlushTODO in this PR: