1
0
Fork 0
mirror of https://github.com/dragonflydb/dragonfly.git synced 2024-12-14 11:58:02 +00:00
Commit graph

2388 commits

Author SHA1 Message Date
Kostas Kyrimis
929222a7df
chore: add mem test for big values and default the flag (#3369)
* default serialization_max_chunk_size to 10 mb
* add test for big values
* small rename of enum to conform style guide

---------

Signed-off-by: kostas <kostas@dragonflydb.io>
2024-07-24 16:07:27 +03:00
Roman Gershman
03b3f86aed
chore: Track db_slice table memory instantly (#3375)
We update table_memory upon each deletion and insertion of an element.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-07-24 14:13:08 +03:00
Vladislav
f73c7d0e42
fix(transaction): Properly store block cancel status (#3371) 2024-07-24 14:05:00 +03:00
Stepan Bagritsevich
37cb247cd4
chore(replica): remove unused methods in the Replica class (#3374)
Signed-off-by: Stepan Bagritsevich <bagr.stepan@gmail.com>
2024-07-24 12:05:13 +02:00
Kostas Kyrimis
cd863b89b4
chore: disable cluster_fuzzymigration (#3373)
* mark cluster_fuzzymigration as skipped

Signed-off-by: kostas <kostas@dragonflydb.io>
2024-07-24 11:46:44 +03:00
Roman Gershman
499fa2268b
chore: simplify computation of used_mem_current (#3372)
* chore: simplify computation of used_mem_current

Before - each thread updated its own variable and then,
the global "used_mem_current" was updated by summing used memory from each thread.

Now, each thread updates used_mem_current directly. The code is simpler and also provides more precise
results more frequently.

---------

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-07-24 06:58:01 +00:00
Roman Gershman
eba722b774
chore: add a test for HeapSize() function (#3349) 2024-07-23 19:02:57 +03:00
Roman Gershman
c8a98fd110
chore: small fixes around tiering (#3368)
There are no changes in functionality here.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-07-23 16:00:50 +03:00
Roman Gershman
cd1f9d3923
chore: Introduce CoolQueue (#3365)
Also, add the according API to compact object.
Now external objects can be in two states: Cool and Offloaded.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-07-23 12:41:10 +03:00
Kostas Kyrimis
bcdfccc039
fix: protect OnJournalEntry with ConditionGuard (#3367)
* add ConditionGuard on JournalEntry such that the stream state stays consistent

Signed-off-by: kostas <kostas@dragonflydb.io>
2024-07-23 09:05:34 +00:00
Kostas Kyrimis
cd0e03a737
chore: disable compression on big values (#3358)
*  compression when we chunk big values

Signed-off-by: kostas <kostas@dragonflydb.io>
2024-07-23 08:57:21 +00:00
Vladislav
759631e9ed
fix(transaction): Fix namespace access (#3364)
Our area of attack during concurrent transaction access is the call to DisarmInShard and DisarmInShardWhen, which only access is_armed - an atomic varible. It is not safe to arbitrarily call GetNamespace() if we write to it in InitBase

Solution: Don't write to it post first initialization
2024-07-23 11:25:04 +03:00
Shahar Mike
76edd0d027
fix(server): Require >=1 args to GETEX (#3366)
Without this change, issuing `redis-cli getex` crashes Dragonfly
2024-07-23 08:17:23 +00:00
Roman Gershman
aac90f25b5
fix: failure in test_cluster_fuzzymigration (#3363) 2024-07-22 22:39:41 +03:00
Vladislav
f81a893368
chore(tiering): Range functions + small refactoring (#3207) 2024-07-22 18:36:11 +03:00
Roman Gershman
7df6771eaa
fix: do not upload offload values on a first hit (#3360) 2024-07-22 16:23:22 +03:00
Vladislav
3ffd30f193
chore(server): Introduce StringSetWrapper (#3347)
chore: use StringSetWrapper

Signed-off-by: Vladislav Oleshko <vlad@dragonflydb.io>
2024-07-22 15:51:19 +03:00
Roman Gershman
4b1574b5c8
chore: fix test_parser_memory_stats flakiness (#3354)
* chore: fix test_parser_memory_stats flakiness

1. Added a robust assert_eventually decorator for pytests
2. Improved the assertion condition in TieredStorageTest.BackgroundOffloading
3. Added total_uploaded stats for tiering that tells how many times offloaded values
   were promoted back to RAM.

* chore: skip test_cluster_fuzzymigration
2024-07-22 10:41:26 +00:00
Roman Gershman
1fc226b03c
chore: fixes to dfly_bench (#3353)
1. Moved CommandGenerator to thread scope - there is no need to maintain separate command generator per connection.
2. Added "done" metric - to know how much was done so far.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-07-22 12:38:51 +03:00
Borys
8a1038647d
refactor: reduce number of logs for cluster (#3357) 2024-07-22 09:19:30 +00:00
Kostas Kyrimis
93ae2ef0e6
chore: small rename and add dcheck on LocalBlockingCounter (#3356)
* add suffix _ to members
* add dcheck in destructor

Signed-off-by: kostas <kostas@dragonflydb.io>
2024-07-22 06:40:57 +00:00
Shahar Mike
2f9dc29dc6
chore: Log connection context when issuing dangerous cmds (#3352)
* chore: Log connection context when issuing dangerous cmds

* raise VLOG level
2024-07-21 15:33:03 +03:00
Roman Gershman
feb9bc266a
chore: pull helio (#3350)
* chore: pull helio

---------

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-07-21 15:26:25 +03:00
Roman Gershman
c46d95db2f
chore: clean up TaskQueue since we do not need multiple fibers for it (#3348)
* chore: clean up TaskQueue since we do not need multiple fibers for it

Implement TaskQueue as a wrapper around FiberQueue.

---------

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-07-21 07:27:53 +00:00
Roman Gershman
7b2603aa46
fix: corruption in replication stream (#3344)
Before it was possible to issue several concurrent AsyncWrite requests.
But these are not atomic, which leads to replication stream corruption.
Now we wait for the previous request to finish before sending the next one.

ThrottleIfNeeded is now takes into account pending buffer size for throttling.

Fixes #3329

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-07-20 13:50:21 -04:00
Roman Gershman
fb7782bcce
chore: remove redundant metrics from memory stats (#3345)
Leave only connection memory usage in memory stats.
We should think how we can move it also to /metrics.
In addition, added a test verifying that redis parser memory
usage is tracked.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-07-20 06:02:55 -04:00
Roman Gershman
4e8c6ce515
fix: AllocationTracker::Remove return value was reversed (#3341) 2024-07-19 15:47:24 +00:00
Vladislav
be59b5eeb4
chore: Make KeyIndex iterable (#3326) 2024-07-19 14:23:46 +03:00
Shahar Mike
2b54fd985f
fix: Cancel outgoing migration when retrying / closing (#3339) 2024-07-19 07:49:49 +00:00
Kostas Kyrimis
8a2d6ad1f4
fix: ub in RegisterOnChange and regression tests for big values (#3336)
* fix replication test flag name for big values
* fix a bug that triggers ub when RegisterOnChange is called on flows that iterate over the callbacks and preempt
* add a stress test for big value serialization

Signed-off-by: kostas <kostas@dragonflydb.io>
2024-07-19 07:03:17 +00:00
Borys
cad62679a4
Fix blocking commands moved error (#3334)
* fix: BLPOP BZPOP(MIN|MAX) moved error
2024-07-18 20:38:13 +03:00
Stepan Bagritsevich
d648e3ddd1
feat(hset_family): Add NX option to HSETEX (#3295)
* feature(hset_family): Add NX option to HSETEX

fixes dragonflydb#3265

Signed-off-by: Stepan Bagritsevich <bagr.stepan@gmail.com>

* refactor(hset_family): Fix returned value in the HSETEX command

Signed-off-by: Stepan Bagritsevich <bagr.stepan@gmail.com>

* refactor: Revert the changes of the returned value for the HSETEX command

Signed-off-by: Stepan Bagritsevich <bagr.stepan@gmail.com>

---------

Signed-off-by: Stepan Bagritsevich <bagr.stepan@gmail.com>
2024-07-18 16:09:04 +04:00
Kostas Kyrimis
bfa5df5d6c
feat: add an option to flush serialized entries on threshold limit (#3241)
* serialize big slots in chunks
* allow preemption on large slots
* disable big entries serialization for RDB files
* add test

Signed-off-by: kostas <kostas@dragonflydb.io>
2024-07-18 10:15:41 +00:00
Roman Gershman
37b992f27d
chore: implement sequential pass whithout the overlapping traffic (#3335)
We divide the keyspace between connections in advance.
This allows easily cover chunks of a key space in a predictable manner without having overlapping traffic.
Excess traffic will just wrap around.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-07-18 13:02:02 +03:00
Roman Gershman
c670ffd09e
chore: Add coordinated omission mode (#3332)
* chore: Add coordinated omission mode

* chore: implement sequential mode in dfly_bench
2024-07-18 05:11:27 -04:00
Roman Gershman
b9f8671df9
chore(tiering): add protection against overruning memory budget (#3327)
chore(tiering): Introduce second chance replacement strategy

Introduce hot/cold replacement strategy https://www.geeksforgeeks.org/second-chance-or-clock-page-replacement-policy/

Also, add protection against overruning memory budget
Finally, cancel in-flight offloading requests for entries that were looked up.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-07-18 03:52:43 -04:00
Stepan Bagritsevich
d51fea09e2
fix(json_family): fix JSON.STRAPPEND command for JSON legacy mode (#3264)
* fix(json_family): fix JSON.STRAPPEND command for JSON legacy mode

Signed-off-by: Stepan Bagritsevich <bagr.stepan@gmail.com>

* fix(json_family): add tests

Signed-off-by: Stepan Bagritsevich <bagr.stepan@gmail.com>

* refactor(json_family): address comments

Signed-off-by: Stepan Bagritsevich <bagr.stepan@gmail.com>

* refactor(json_family): code clean up

Signed-off-by: Stepan Bagritsevich <bagr.stepan@gmail.com>

* refactor(json_family): address comments 2

Signed-off-by: Stepan Bagritsevich <bagr.stepan@gmail.com>

* refactor(json_family_test): remove map_single_element_vector_ flag

Signed-off-by: Stepan Bagritsevich <bagr.stepan@gmail.com>

* fix(json_family_test): add more tests

Signed-off-by: Stepan Bagritsevich <bagr.stepan@gmail.com>

---------

Signed-off-by: Stepan Bagritsevich <bagr.stepan@gmail.com>
2024-07-18 09:30:27 +04:00
Borys
1acc824eff
fix(test): copy logs for failed test during TEARDOWN phase (#3331)
* fix(test): copy logs for failed test during TEARDOWN phase
2024-07-17 22:16:08 +03:00
Shahar Mike
4898b25b49
fix: Proper shutdown sequence with Namespaces (#3333)
This removes a race between periodic fiber and namespaces during
shutdown.
2024-07-17 16:58:22 +03:00
adiholden
e3eb8518fd
feat(test): Improve benchmark workflow (#3330)
Signed-off-by: adi_holden <adi@dragonflydb.io>
2024-07-17 14:34:48 +03:00
Vladislav
dc193931c9
chore: remove replace_deleted flag from hnswlib (#3323)
Signed-off-by: Vladislav Oleshko <vlad@dragonflydb.io>
2024-07-17 13:04:29 +03:00
Roman Gershman
ece095b6c5
chore: improve dfly_bench stats (#3320)
* chore: improve dfly_bench stats

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

* Update src/server/dfly_bench.cc

Co-authored-by: Shahar Mike <chakaz@users.noreply.github.com>
Signed-off-by: Roman Gershman <romange@gmail.com>

---------

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
Signed-off-by: Roman Gershman <romange@gmail.com>
Co-authored-by: Shahar Mike <chakaz@users.noreply.github.com>
2024-07-16 20:02:11 +03:00
Shahar Mike
18ca61d29b
feat(namespaces): Initial support for multi-tenant (#3260)
* feat(namespaces): Initial support for multi-tenant #3050

This PR introduces a way to create multiple, separate and isolated
namespaces in Dragonfly. Each user can be associated with a single
namespace, and will not be able to interact with other namespaces.

This is still experimental, and lacks some important features, such as:
* Replication and RDB saving completely ignores non-default namespaces
* Defrag and statistics either use the default namespace or all
  namespaces without separation

To associate a user with a namespace, use the `ACL` command with the
`TENANT:<namespace>` flag:

```
ACL SETUSER user TENANT:namespace1 ON >user_pass +@all ~*
```

For more examples and up to date info check
`tests/dragonfly/acl_family_test.py` - specifically the
`test_namespaces` function.
2024-07-16 19:34:49 +03:00
Borys
3891efac2c
fix: forbid DFLYCLUSTER commads set for emulated cluster mode (#3307)
* fix: forbid DFLYCLUSTER commads set for emulated cluster mode
* feat: add CLUSTER MYID and remove DFLYCLUSTER MYID
* fix(test): __del__ method in python can't be async
* fix: crash and test_replicate_disconnect_cluster
2024-07-16 14:17:28 +03:00
Vladislav
22756eeb81
fix(migration): Use transactions! (#3266)
Signed-off-by: Vladislav Oleshko <vlad@dragonflydb.io>
2024-07-16 14:06:34 +03:00
Vladislav
cdd8d50e70
chore(tiering): Fixes (#3225)
Don't run offloading and stashing if we know ahead that there won't be enough space left
2024-07-16 11:30:21 +03:00
Kostas Kyrimis
e1b03d605c
refactor: acl helpers and global tables (#3309)
* remove helper.h and helper.cc and move them to AclFamily class
* remove global tables from acl_commands_def and move them to AclFamily

Signed-off-by: kostas <kostas@dragonflydb.io>
2024-07-15 15:41:13 +03:00
Roman Gershman
35ef143200
chore: bypass decoding/encoding of the data when performing offloading (#3315)
It's more efficient to offload raw blobs kept in CompactObject than decoded strings.
Unfortunately, it's also more complicated. The complexity arises around Read/Modify operations
that must convert a raw blob into a processed string. Moreover, Modify decodes the raw string, therefore
subsequent callbacks already see the decoded string.

Finally, this PR fixes the logic in NotifyFetched flow:
before it could skip uploading the modified value back to memory, which breaks correctness.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-07-15 13:16:43 +03:00
adiholden
f20318d88a
fix (pytest): generate unique random dbfilename for tests (#3317)
Signed-off-by: adi_holden <adi@dragonflydb.io>
2024-07-15 11:01:02 +03:00
Kostas Kyrimis
bf1b6cef6e
chore: skip test_cluster_flushall_during_migration (#3316)
* skip failing test on ci

Signed-off-by: kostas <kostas@dragonflydb.io>
2024-07-15 09:48:28 +03:00