* chore: improve reply latency of SendScoredArray
Use SendStringArrInternal that reduces dramatically number of socket calls for long arrays.
---------
Signed-off-by: Roman Gershman <roman@dragonflydb.io>
For high connection rate cases it can be significant.
In addition, refactor reply_builder so we could use SendStringArrInternal
for more cases like SendScoredArray that also has high latency overhead for replies.
Signed-off-by: Roman Gershman <roman@dragonflydb.io>
Co-authored-by: romange <romange@users.noreply.github.com>
The main change here is introduction of the strong type LockTag
that differentiates from a string_view key.
Also, some testing improvements to improve the footprint of the next PR.
Signed-off-by: Roman Gershman <roman@dragonflydb.io>
* feat(server): Allow configuration of hashtag extraction
Before this PR: Hashtags, if enabled, meant the text between `{` and `}`
in the key (if exists and non-empty).
After this PR:
* Hashtags can _still_ be enabled / disabled
* Hashtag open / close char can be specified (and can be the same), like `:` popular with BullMQ
* Hashtag can include `N` closing tags to skip, like `{a}b}c}d` with `2` will return `a}b}c`.
This will allow some existing systems to migrate without code changes in
client code.
* chore: clean up REPLTAKEOVER flow
1. Factor out the catchup function.
2. Simplify the flow and make the second parameters - integer.
3. Return OK if the server is already a master (and do nothing underneath).
---------
Signed-off-by: Roman Gershman <roman@dragonflydb.io>
* Going to rewrite hllSparseSet
* Add support to sparse hll
* Add support for PFAdd Sparse
* Add support for PFAdd Sparse
* Add support for PFAdd Sparse
* Add support for Sparse HLL PFADD
Signed-off-by: azuredream <zhaozixuan67@gmail.com>
* Add support for Sparse HLL PFADD
Signed-off-by: azuredream <zhaozixuan67@gmail.com>
* Add support for Sparse HLL PFADD
Signed-off-by: azuredream <zhaozixuan67@gmail.com>
* Add support for Sparse HLL PFADD
Signed-off-by: azuredream <zhaozixuan67@gmail.com>
* Add support for Sparse HLL PFADD
Signed-off-by: azuredream <zhaozixuan67@gmail.com>
* Add support for Sparse HLL PFADD
Signed-off-by: azuredream <zhaozixuan67@gmail.com>
* Add support for Sparse HLL PFADD
Signed-off-by: azuredream <zhaozixuan67@gmail.com>
* Add support for Sparse HLL PFADD
Signed-off-by: azuredream <zhaozixuan67@gmail.com>
---------
Signed-off-by: azuredream <zhaozixuan67@gmail.com>
* chore: LockTable tracks fingerprints of keys
It's a first step that will probably simplify dependencies in many places
where we need to keep key strings for that. A second step will be to reduce the CPU load
of multi-key operations like MSET and precompute Fingerprints once.
---------
Signed-off-by: Roman Gershman <roman@dragonflydb.io>
A self-laundering iterator will enable us to, eventually, yield from fibers while holding an iterator. For example:
```cpp
auto it1 = db_slice.Find(...);
Yield(); // Until now - this could have invalidated `it1`
auto it2 = db_slice.Find(...);
```
Why is this a good idea? Because it will enable yielding inside PreUpdate() which will allow breaking down of writing huge entries in small quantities to disk/network, eliminating the need to allocate huge chunks of memory just for serialization.
Also, it'll probably unlock future developments as well, as yielding can be useful in other contexts.
* Migrate might fail if dispatch_fiber is active. In that case do no crash but return false to indicate that the migration was not successful.
* After we migrate, we might find ourselves with the socket closed (because of the shutdown signal process/flow). We need to check that the socket is open. If it's not, it means that it was shutdown by the signal flow (because after we finish with DispatchTracker, we start iterating over all of the connections in all of the shards and shut them down.
The number of keys in an _incoming_ migration indicates how many keys
were received, while for _outgoing_ it shows the total number. Combining
the two can provide the control plane with percentage.
This slightly modified the format of the response.
Fixes#2756