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

1795 commits

Author SHA1 Message Date
Shahar Mike
5586798e90
fix(server): Use custom journal for multi-key PFMERGE cmd (#2437)
While at it, also fix `PFCOUNT` to say that it's a readonly cmd.

Fixed #2421
2024-01-18 12:30:21 +02:00
Shahar Mike
2f0287429d
fix(replication): Correctly replicate commands even when OOM (#2428)
* fix(replication): Correctly replicate commands even when OOM

Before this change, OOM in shard callbacks could have led to data
inconsistency between the master and the replica. For example, commands
which mutated data on 1 shard but failed on another, like `LMOVE`.

After this change, callbacks that result in an OOM will correctly
replicate their work (none, partial or complete) to replicas.

Note that `MSET` and `MSETNX` required special handling, in that they are
the only commands that can _create_ multiple keys, and so some of them
can fail.

Fixes #2381

* fixes

* test fix

* RecordJournal

* UNDO idiotnessness

* 2 shards

* fix pytest
2024-01-18 12:29:59 +02:00
Shahar Mike
b66db852f9
fix: Invalid memory access (#2435)
The (subtle) bug is that the previous code uses an `initializer_list` c'tor, which copies the
`string_view` locally. Then it keeps that reference to the `string_view`,
but it goes out of scope in the next line
2024-01-17 23:23:44 +02:00
Yue Li
d1db48d9d4
feat(server): Tracking memory usage for client tracking table (#2431)
Tracking memory usage for client tracking table using C++ memory resource and polymorphic allocator.
2024-01-17 13:20:23 -08:00
Roman Gershman
e06b736c02
chore: add both df tree impelementations to memory usage test (#2430)
Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-01-17 17:55:10 +02:00
Vladislav
bf89c7eac2
chore(transaction): Clean up scheduling code (#2422)
* chore(transction): Clean scheduling code
2024-01-17 17:33:48 +03:00
adiholden
9f3b118b87
server(tiering): load data on read (#2415)
* server(tiering): load data on read

Signed-off-by: adi_holden <adi@dragonflydb.io>
2024-01-17 16:13:56 +02:00
Roman Gershman
8eda8226b2
fix: release.sh (#2432) 2024-01-17 12:51:31 +00:00
Shahar Mike
b7b97452c4
fix(info): Reply with correct redis_mode in `INFO (#2429)
* fix(info): Reply with correct `redis_mode` in `INFO

Fixes #2400

* `HELLO` `HELLO` `HELLO`!

* Fix test
2024-01-17 11:10:24 +02:00
Kostas Kyrimis
3031e7a3ee
fix: non reset fields in command config resetstat (#2425) 2024-01-17 08:21:39 +02:00
Kostas Kyrimis
c8871896d7
fix: access to wrong thread local after command migrates fiber to a different thread (#2410)
* fix: access to wrong thread local after command migrates fiber to a different
thread
2024-01-17 08:19:10 +02:00
Vladislav
1fb3c74933
fix(rdb): Remove transaction from pre/post load search index rebuild (#2419) 2024-01-16 10:08:16 +03:00
Vladislav
de817098a7
feat(transaction): Single hop blocking, callback flags (#2393)
* feat(transaction): Single hop blocking, callback flags
2024-01-15 21:13:22 +03:00
Roman Gershman
b6f4370ae7
feat: allow throttling tiered writes (#2414)
* feat: allow throttling tiered writes

The throttling is controlled by tiered_storage_throttle_us flag
and can be disabled by passing `--tiered_storage_throttle_us=0`.
This introduces a soft back-pressure during writes.

On my machine `debug POPULATE 10000000 key 1000 RAND` with tiered_storage_throttle_us=0
offloads 12% of all the entries, but with tiered_storage_throttle_us=1 it offloads
almost 100% by prolonging the operation from 0.96s to 1.72s.
---------

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-01-15 13:21:23 +02:00
Shahar Mike
f4c1e33d48
cleanup: Remove unused PerformDeletion() overloads (#2418) 2024-01-15 11:15:35 +00:00
Vladislav
078db5caae
fix(tx): guard parallel writes to local result (#2417) 2024-01-15 13:51:30 +03:00
Kostas Kyrimis
39e7e5ad87
fix: missing error reply to client after AddOrFind throw std::bad_alloc (#2411)
* Handle properly and reply on execution paths that throw std::bad_alloc within AddOrFind
2024-01-15 10:13:10 +02:00
Shahar Mike
13718699d8
feat(server): Implement CLIENT KILL (#2404)
* feat(server): Implement `CLIENT KILL`

Currently, it supports the following syntax:

* `CLIENT KILL <addr>:<port>`
* `CLIENT KILL ID <id>`
* `CLIENT KILL ADDR <addr>:<port>`
* `CLIENT KILL LADDR <addr>:<port>`

It will not allow killing an admin-connection from a non-admin port.

There are a few parameters of `CLIENT KILL` that Redis supports but this
PR does not yet add. Let's add them as needed.

Fixes #1614

* Add tests

* fixes
2024-01-15 09:49:23 +02:00
Roman Gershman
01a9e6d1f0
feat: introduce segment merge operation (#2412)
Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-01-15 04:02:12 +02:00
Roman Gershman
b3e0722d01
chore: fix our release pipeline (#2408)
* chore: fix our release pipeline

Also remove alpine prod.wip file that has not been used and unlikely will be for prod.

---------

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-01-14 17:31:59 +02:00
Roman Gershman
7054fc56b1
chore: remove atomic<> from ReplicaInfo::state (#2409)
* chore: remove atomic<> from ReplicaInfo::state

This field is protected by ReplicaInfo::mu so non-protected access to it shows a design problem.
Indeed, it was done for being able to access this field without a mutex inside ReplicationLags() function.

I moved the access to this field to GetReplicasRoleInfo where we need to lock ReplicaRoleInfo anyways.
Also, done some cleanups in the file.

Finally, raised a threshold for "tx queue too long" warnings.

---------

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-01-13 18:03:29 +02:00
Vladislav
484b4de216
Fix flush when migrating connection (#2407)
fix: don't miss flush for control messages
2024-01-13 09:57:33 +03:00
adiholden
b3e36b0caa
fix(server): call OnCbFinish after debug populate (#2358)
Signed-off-by: adi_holden <adi@dragonflydb.io>
2024-01-12 09:16:27 +02:00
Roman Gershman
6e6dc2c3c8
fix: do not return an error in memory-usage command (#2405)
Fixes #2399

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-01-11 21:30:37 +02:00
Roman Gershman
148073dbce
feat: allow checking the compressability of the data (#2370)
Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-01-11 15:59:26 +02:00
Shahar Mike
409d22b1e6
feat(cluster): Add params to slot migration full sync cut (#2403) 2024-01-11 10:56:09 +00:00
Borys
7b61268533
feat(info): add new persistence section fields (#2396)
* feat(info): add new persistence section fields
implement #2386
added fields:
1) last_failed_save
2) last_error
3) last_failed_save_duration_sec
4) saving
5) current_save_duration_sec
2024-01-11 12:36:43 +02:00
Yue Li
8d09478474
bug(server): log evicted keys in journal in PrimeEvictionPolicy. (#2302)
fixes #2296

added a regression test that tests both policy based eviction as well as heart beat eviction.

---------

Signed-off-by: Yue Li <61070669+theyueli@users.noreply.github.com>
2024-01-11 01:45:29 -08:00
Roman Gershman
9fe7d038b7
feat: add os string (#2401)
* feat: add os string

Adding it both to the info log and the INFO response in the server section, similarly
to how it's reported by redis.

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

* Update src/server/server_family.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-01-11 11:29:34 +02:00
Roman Gershman
f6533af7d9
chore: server_family cleanups (#2398)
1. Move helper functions to cc anonymous scope
2. Remove dead code.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-01-11 10:47:34 +02:00
zixuan zhao
d7f4265e61
feat: Store and diststore for GeoRadiusByMember (#2350)
* feat: Store and diststore for GeoRadiusByMember

---------

Signed-off-by: azuredream <zhaozixuan67@gmail.com>
2024-01-11 09:32:02 +02:00
Roman Gershman
e84bc7586a
chore: reduce Makefile for release procedures only (#2397)
Also, change its build directory to build-release.
Simplify a bit its configuration steps as well. No change in functionality is expected.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-01-11 06:35:57 +02:00
Shahar Mike
4874da8b5b
feat(cluster): Add RestoreStreamer. (#2390)
* feat(cluster): Add `RestoreStreamer`.

`RestoreStreamer`, like `JournalStreamer`, streams journal changes to a
sink. However, in addition, it traverses the DB like `RdbSerializer` and
sends existing entries as `RESTORE` commands.

Adding it required a bit of plumbing to get all journal changes to be
slot-aware.

In a follow-up PR I will remove the now unneeded `SerializerBase`.

* Fix build

* Fix bug

* Remove unimplemented function

* Iterate DB, drop support for db1+

* Send FULL-SYNC-CUT
2024-01-10 15:10:21 +02:00
Vladislav
f4ea42f2f6
chore: simple traffic logger (#2378)
* feat: simple traffic logger

Controls: 
```
DEBUG TRAFFIC <base_path> | [STOP]
```
---------

Signed-off-by: Vladislav Oleshko <vlad@dragonflydb.io>
Signed-off-by: Roman Gershman <roman@dragonflydb.io>
Co-authored-by: Roman Gershman <roman@dragonflydb.io>
2024-01-10 12:56:56 +00:00
Roman Gershman
e9453e62e4
fix: ignore unexpected contents for /sys/fs/cgroup/cpu.max (#2394)
Fixes #2391

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-01-10 11:17:37 +02:00
Vladislav
b8af49cfe5
chore(transaction): Avoid COORD_SCHED_EXEC ambiguity with multi transactions (#2392)
* chore(transaction): Avoid COORD_SCHED_EXEC ambiguity

Signed-off-by: Vladislav Oleshko <vlad@dragonflydb.io>
2024-01-10 11:31:11 +03:00
Kostas Kyrimis
0c96f83d1d
fix(regTests): assertion failure during load in cancel_replication_immediately (#2371)
* replace DispatchBrief with Await in SetMasterFlagOnAllThreads
2024-01-09 16:18:40 +02:00
Roman Gershman
1cab6695d7
chore: improvements in dash code (#2387)
chore: cosmetic improvements in dash code

1. Better naming
2. Improve improving the interface of ForEachSlot command
3. Wrap the repeating code of updating the bucket version into the UpdateVersion function

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-01-08 20:21:52 +02:00
Kostas Kyrimis
25d906bce7
feat: allow round robin sharding in non cluster mode (#2364) 2024-01-08 10:51:15 +02:00
adiholden
014a86fc88
feat(lru): add generic lru class (#2351)
Signed-off-by: adi_holden <adi@dragonflydb.io>
2024-01-07 21:51:46 +02:00
adiholden
a1d85b7cb2
feat(server): allow running memory commands under script (#2382)
Signed-off-by: adi_holden <adi@dragonflydb.io>
2024-01-07 16:16:57 +02:00
Borys
d119ee8915
refactor(cluster): remove SYNC cmd and do data transferring during FLOW (#2369)
feat(cluster): remove SYNC cmd and do data transfering during FLOW
2024-01-07 16:10:49 +02:00
adiholden
f37c57c704
fix(server): crash on rename save command on background save (#2375)
* fix(server): crash on rename save command on baground save

Signed-off-by: adi_holden <adi@dragonflydb.io>
2024-01-07 12:21:09 +02:00
Shahar Mike
2d46a584a3
refactor(SerializerBase): Move some logic from RdbSerializer to SerializerBase (#2373)
* refactor(SerializerBase): Move some logic from RdbSerializer to SerializerBase

Specifically SendFullSyncCut and WriteJournalEntry

* gh review
2024-01-07 07:48:29 +02:00
Shahar Mike
13c2e672b0
feat(server): Add RestoreSerializer (#2366)
* feat(server): Add `RestoreSerializer`

This utility class serializes `CompactObj`s as `RESTORE` commands, and
has a similar interface (and a common base class) as `RdbSerializer`

* RETURN_ON_ERR

* fixes
2024-01-04 15:03:14 +02:00
Shahar Mike
b15109d4d2
fix(test): Fix flaky test (#2372)
Issue was that in `ServerFamilyTest.SlowLogLen` we set the threshold to
be 0 microseconds and make sure that all commands are logged as slow.
However, in opt, some commands sometimes take 0 microseconds, which
fails the test.

Confirmed via:

```
./server_family_test --gtest_repeat=100 --gtest_filter=ServerFamilyTest.SlowLogLen
```
2024-01-04 11:23:17 +00:00
Roman Gershman
0e72846457
chore: consolidate facade stats under a single struct (#2368)
* chore: consolidate facade stats under a single struct

Remove connection stats from server state and move them under FacadeStats.

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

* chore: fixing comments

---------

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-01-03 08:09:00 +00:00
Roman Gershman
e063180c8d
chore: add memory usage test for skiplist encoding (#2367) 2024-01-03 10:03:39 +02:00
Kostas Kyrimis
aec097701a
chore: add comment for c_rehash in ca_cert_dir flag description (#2365) 2024-01-03 09:48:05 +02:00
Roman Gershman
cb3e366459
feat: introduce user timeout (#2361)
* feat: introduce user timeout

* feat: introduce tcp_user_timeout flag.

See TCP_USER_TIMEOUT flag in tcp(7) man page.
This linux-only setting allows fail faster during the send operation
if for some reason the remote socket is unresponsive and does not send ACKs for
the transmitted segments.

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

* Update src/facade/dragonfly_listener.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-01-03 08:06:25 +02:00