Commit graph

22 commits

Author SHA1 Message Date
Roman Gershman
89b1d7d52a
chore: Introduce ShardArgs as a distinct type (#2952)
Done in preparation to make ShardArgs a smart iterable type,
but currently it's just a wrapper aroung ArgSlice.
Also refactored common.{h,cc} into tx_base.{h,cc}

In addition, fixed a bug in key tracking, where we wrongly created weak_ref
in a shard thread instead of doing this in the coordinator thread.
Finally, identified another bug (not fixed yet) where we track all the arguments
instead of tracking keys only.

Besides this, no functional changes around the moved code.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-04-24 13:36:34 +03:00
Vladislav
9c6e6a96b7
fix(transaction): Replace with armed sync point (#2708)
1. Replaces run_barrier as a synchronization point with is_armed + an embedded blocking counter for awaiting running jobs
2. Replaces IsArmedInShard + GetLocalMask + is_armed.exchange chain with a single DisarmInShard() / DisarmInShardWhen

Signed-off-by: Vladislav Oleshko <vlad@dragonflydb.io>
2024-03-14 14:40:32 +00:00
Vladislav
4a9f816106
chore(transaction): Don't call GetLocalMask from blocking controller (#2715)
chore: remove reliance on GetLocalMask in BlockingController
2024-03-12 11:53:41 +03:00
Roman Gershman
fa75360227
chore: get rid of object.c and robj* in cc code (#2610)
Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-02-18 16:52:23 +02:00
Roman Gershman
adeac6bd27
Pr1 (#2517)
* fix: Remove a stale reference to blocking watch queue

1. Remove the duplicated FinalizeWatched function
2. Identify the case where we delete the watched queue while we may still have awakedened_keys pointing to it.
3. Add a test reproducing the issue of having in awakened_keys an untangled key.

Properly fixes #2514

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
---------

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-02-01 14:19:08 +02:00
Roman Gershman
2b0310db32
fix: do not crash with inconsistent watch queue (#2515)
Output more info about the state of things.
Skip the non existent key and continue the execution.
Fixes #2514

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-02-01 09:48:42 +02:00
Borys
5b905452b3
fix: unblock transactions only if requirements are correct (#2345)
fixes #2294

bug: we unblock XREADGROUP cmd even if we don't have new values

fix: added check with custom requirements for blocking comands
2024-01-02 14:55:06 +02:00
Shahar Mike
0e4d76cc96
refactor(DbSlice): Replace FindExt() with FindMutable() and FindReadOnly (#2308)
* refactor(DbSlice): Replace `FindExt()` with `FindMutable()` and `FindReadOnly`

* fix

* `ExpireConstIterator`

* Don't update stats on FindMutable()

* auto&

* ReadOnly

* Remove redundant call

* move() before

* Remove redundant post_updater

* Update comment
2023-12-20 08:04:39 +02:00
Vladislav
6f78ae5073
fix: call NotifyPending only from tx queue invocations (#1439)
* fix: call NotifyPending only from tx queue invocations

---------

Signed-off-by: Vladislav Oleshko <vlad@dragonflydb.io>
2023-06-21 10:26:22 +03:00
Andy Dunstall
1cfeff21a4
feat(streams): Add support for XREAD BLOCK (#1291)
* feat(streams): Add support for XREAD BLOCK

---------

Signed-off-by: Andrew Dunstall <andydunstall@hotmail.co.uk>
2023-05-27 22:47:31 +03:00
Roy Jacobson
6697478a28
Feat bzpopmin (#1232)
* chore: Refactor out common code from BPop ops

* feat: Implement blocking ZSET commands

* Add tests for blocking ZSET commands.

* Refactor changes into container_utils
2023-05-21 03:48:45 +03:00
Vladislav
cb82680aca
Remove blpop FindFirst hop after wakeup (#1168)
Remove BLPOP hop after wake
2023-05-03 19:45:06 +03:00
Roman Gershman
f4081f3979 fix: improve consistency around brpop flow
1. Added a test that was breaking earlier.
2. Made sure that multiple waked brpop transaction would not
   snatch items from one another.
3. Fixed watched-queues clean-up logic inside blocking_controller that caused deadlocks.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2023-03-17 11:49:23 +02:00
Roman Gershman
c96f637f73 chore: some pytests and logging improvements
1. pytest extensions and fixes - allows running them
   with the existing local server by providing its port (--existing <port>).
2. Extend "DEBUG WATCHED" command to provide more information about watched state.
3. Improve debug/vlog printings around the code.

This noisy PR is a preparation before BRPOP fix that will follow later.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2023-03-17 10:52:20 +02:00
Vladislav
9536c0a645
Refactor transaction (#697)
* refactor(server): Transaction naming

Signed-off-by: Vladislav <vlad@dragonflydb.io>
2023-01-17 14:53:12 +02:00
Roman Gershman
613e3b8741
fix(server): Fix a bug with brpoplpush (#677)
fix(server): Fix a bug when an expired transaction stays in watched queue.

Now we remove the transaction from the watched queues in a consistent manner based on the
keys it was assigned to watch.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2023-01-14 20:18:28 +02:00
Roman Gershman
9ca636e49d feat(server): Implement brpoplpush for single shard case.
A simple case where both src and dest keys are located in the same shard.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2023-01-12 12:00:10 +02:00
Roman Gershman
0925829afb feat(server): Introduce transaction clock.
Partially implements #6.
Before, each shard lazily updated its clock used for the expiry evaluation.
Now, the clock value is set during the transaction scheduling phase and is assigned
to each transaction. From now on DbSlice methods use this value when checking whether
the entry is expired via passed DbContext argument.

Also, implemented transactionally consistent TIME command and
verify that time is the same during the transaction. See
https://ably.com/blog/redis-keys-do-not-expire-atomically for motivation.

Still have not implemented any lamport style updates for background processes
(not sure if it's the right way to proceed).
2022-09-25 23:53:08 +03:00
Roman Gershman
de9369f518
chore(server): update license text (#312) 2022-09-19 09:01:10 +03:00
Roman Gershman
114e8bec5d Fixes #41.
1. Found dangling transaction pointers that where left in the watch queue. Fix the state machine there.
2. Improved transaction code a bit, merged duplicated code into RunInShard function, got rid of RunNoop.
3. Improved BPopper::Run flow.
4. Added 'DEBUG WATCH' command. Also 'DEBUG OBJECT' now returns shard id and the lock status of the object.
2022-05-27 12:20:01 +03:00
Roman Gershman
afd52d5571 Clean-ups in transaction code. 2022-04-29 15:50:20 +03:00
Roman Gershman
72e90bb729 More work on blocking commands like BLPOP.
Fixes #1 and fixes #24.
2022-04-27 10:42:35 +03:00