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

1756 commits

Author SHA1 Message Date
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
Yue Li
6f9107291e
test: Adding integration test using Relay benchmark (#2348)
Adding integration test using Relay benchmark
2024-01-02 12:44:22 -08:00
adiholden
8411ce71d1
fix(dash table): bucket count returns the number of buckets (#2359)
Signed-off-by: adi_holden <adi@dragonflydb.io>
2024-01-02 21:57:52 +02:00
Shahar Mike
4b2dd9e726
refactor(serializer): Move DUMP logic into RdbSerializer (#2363) 2024-01-02 19:05:00 +02:00
Shahar Mike
d9886024d3
refactor(rdb): Expose default compression mode without direct flag (#2360)
* refactor(rdb): Expose default compression mode without direct flag

* fixes
2024-01-02 13:48:50 +00: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
Borys
03f69ff6c3
feat: add SLOT-MIGRATION-STATUS cmd for source node (#2349)
* feat: add SLOT-MIGRATION-STATUS cmd for source node
implements #2232
add ability using SLOT-MIGRATION-STATUS without args
to print info about all migration processes for the current node
2024-01-02 12:10:06 +02:00
adiholden
c60e4accc6
feat(tiering): add max file size limit (#2344)
* add max file size flag

Signed-off-by: adi_holden <adi@dragonflydb.io>
2024-01-02 12:07:34 +02:00
Roman Gershman
fc1a70598d
fix "debug exec" command (#2354)
fix: fix "debug exec" command

It used mutex lock inside Await callback which is prohibited.

In addition, we improved loggings across the transaction code.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-01-01 18:29:20 +02:00
Roman Gershman
4c2d37f3c6
chore: add "send" state to client list (#2357)
chore: add send state to client list

This can be done only via a differrent fiber by inspecting SinkReplyBuilder state.
Also, get rid of awkward reply builder statistics and use instead thread local stats for that.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-01-01 17:13:27 +02:00
Shahar Mike
069625f23f
refactor(generic_family): Don't allocate StringSink on the heap (#2356)
refactor(generic_family): Don't allocate serializer on the heap
2024-01-01 14:57:59 +02:00
Shahar Mike
40f2a7190e
feat(getslotsinfo): Add memory usage per slot (#2355)
It's a good thing we waited with this feature until after the recent
refactors. Now it's trivial and safer!

Fixes #1478
2024-01-01 09:15:05 +02:00
Roman Gershman
1fb0a486ac
chore: transaction simplification (#2347)
chore: simplify transaction multi-locking

Also, add the ananlysis routine that determines whether the schewduled transaction is contended with other transaction in a
shard thread.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2023-12-31 17:02:12 +02:00
Roman Gershman
ddbdf63470
fix: relax the requirement for parsing successfully container limits (#2352)
We parse the container limits for heuristics that deduces memory/cpu capacities automatically.
It's ok if we fail on some less common systems since there are manual overrides that allows specifying these
limits explicitly.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2023-12-30 13:31:40 +02:00
Shahar Mike
c7093c40e5
fix(SimpleLruCounter): Correctly set bumped node's next (#2346) 2023-12-28 10:26:16 +00:00
Shahar Mike
69f269e808
feat(makefile): Build with full debug symbols and strip in make package (#2343)
Before this PR, using `make` for building releases used `-g1 -gz` to
provide some level of debug symbols (mostly function names in stack
traces).

We want to be able to have binaries with full debug symbols (for
coredumps etc), but not in the public releases.

This PR builds with full debug symbols, but changes `make package` to
strip most debug symbols, while keeping `.debug_line` (and keeping them
compressed as if with `-gz`). This will allow a single build command for
public releases as well as releases with full symbols.
2023-12-27 17:48:29 +02:00
Shahar Mike
20b7c22055
fix(server): Fix reply seconds & better metrics names (#2342) 2023-12-27 17:48:15 +02:00
Roman Gershman
5035d4e1e3
chore: expose the multi length in slowlog (#2339)
1. Fix AnalyzeTxQueue to stop crashing for various transaction types.
2. Pass exec command length to slowlog

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2023-12-27 16:11:14 +02:00
adiholden
5d67c95797
bug(server): reject replicaof while loading from snapshot (#2338)
fix #2337
The bug:
replicaof was not rejected while loading snapshot
The fix:
replicaof is allowed while server is in loading state to allow replicaof while replication in full sync mode
I now reject replicaof if the server is in loading state and it is master

Another bug fix:
allow cron snapshot if --replicaof flag was set

Signed-off-by: adi_holden <adi@dragonflydb.io>
2023-12-27 13:57:49 +02:00
Vladislav
8c873fd71c
fix: Invalid key lock strings with squashing (#2341)
* fix: clear shard data in squash preparation
2023-12-27 11:48:43 +02:00
Shahar Mike
16a0becea5
feat(server): Add reply count & latency metrics (#2340)
* feat(server): Add reply count & latency metrics

* fixes
2023-12-26 23:02:45 +02:00
Roman Gershman
5b81ccda18
feat: expose transaction types via /metrics (#2336)
Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2023-12-26 15:22:14 +02:00
Vladislav
1caa4ee0f1
feat(search): Aggregator, step 1 (#2332)
* feat(search): Aggregator, step 1

* feat: Add basic reducers

---------

Signed-off-by: Vladislav Oleshko <vlad@dragonflydb.io>
2023-12-25 15:57:16 +03:00
Roman Gershman
bd7a02d474
feat: track differrent patterns of multi/exec transactions (#2334)
* feat: track differrent patterns of multi/exec transactions

This information is exposed via "DEBUG EXEC" command.

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

* chore: address comments + add basic squasher stats

---------

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2023-12-25 12:22:24 +02:00
Roman Gershman
ce7497071c
feat: introduce 'debug tx' command and periodic overload logs (#2333)
This command shows the current state of transaction queues,
specifically how many armed (ready to run) transactions there,
how loaded these queue are and how many locks there are in each shard.

In addition, if a tx queue becomes too long, we will output warning logs about
the state of the queue, in order to be able to identify
the bottlenecks post-factum.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2023-12-25 11:48:55 +02:00
Shahar Mike
a360b308c9
refactor(server): Privatize PreUpdate() and PostUpdate() (#2322)
* refactor(server): Privatize `PreUpdate()` and `PostUpdate()`

While at it:
* Make `PreUpdate()` not decrease object size
* Remove redundant leftover call to `PreUpdate()` outside `DbSlice`

* Add pytest

* Test delete leads to 0 counters

* Improve test

* fixes

* comments
2023-12-25 07:49:57 +00:00
Roman Gershman
700a65ece5
chore: refactor VersionMonitor into a separate file (#2326)
* chore: refactor VersionMonitor into a separate file
---------

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2023-12-24 22:06:57 +02:00
Vladislav
d129674e17
chore(search): Block list (#2307)
chore(search): Block list

---------

Signed-off-by: Vladislav Oleshko <vlad@dragonflydb.io>
2023-12-24 17:42:03 +03:00
Roman Gershman
8bd43497f2
feat: expose tx_queue_len metric (#2330)
This metric shows how much the transaction queue of dragonfly is loaded.
Also, output free text, human intended replies as verbatim.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2023-12-24 11:31:50 +02:00
Roman Gershman
f90317a795
feat: add keyspace_mutations metric (#2329)
* feat: add keyspace_mutations metric

Currently we expose hits/misses for read only commands only (compatible with redis).
`keyyspace_mutations` complement this providing number of key operations for write commands.
It's interesting because now we can learn the number of key_ops vs API ops, where
key_ops = misses + hits + mutations

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

* chore: address fixes

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

---------

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2023-12-24 10:21:36 +02:00
Roman Gershman
4562fad737
chore: refactor slowlog code, no functionality changes (#2331)
Goal: to improve readability of the code.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2023-12-23 18:40:03 +02:00
Roman Gershman
bbe3d9303b
feat: introduce transaction statistics in the info output (#2328)
1. How many transactions we processed by type
2. How many transactions we processed by width (number of unique shards).

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2023-12-23 13:18:49 +02:00
Borys
1376295799
fix(stream): make fix for XREADBLOCK function (#2323)
partly fixes #2294
bug: id ">" means that the consumer want to receive only messages
that were never delivered to any other consumer

fix: added temporary tests results, the correct ones are commented out
until we fix the blocking mechanism. Fix requested range for blocking
operations
2023-12-22 13:57:14 +02:00
Roman Gershman
365cb439cf
chore: remove support for save_schedule flag (#2327)
Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2023-12-22 11:17:18 +02:00
Shahar Mike
34986fc52e
feat(server): Account for RObj concrete objects (#2324)
* feat(server): Account for RObj concrete objects

* proper `delete`
2023-12-22 09:20:41 +02:00
Shahar Mike
4929e3c777
feat(server): Better accounting of DenseSet memory (#2325) 2023-12-21 19:26:16 +02:00
Yue Li
6905389d60
feat(server): Support CLIENT TRACKING subcommand (2/2) (#2280)
fixes https://github.com/dragonflydb/dragonfly/issues/2139

This is part two that implements the logic which notifies tracking clients by sending invalidation messages:

- The client tracking state is set by CLIENT TRACKING subcommand as well
as upon client disconnection.

- Track the keys of a readonly command by maintaining mapping that maps
keys to the sets of tracking clients.

- Send invalidation messages to clients when their tracked keys are
updated.

- Make PerformDeletion a member function of DbSlice, and send 
invalidation message within the function.

- Mock the function for sending invalidation message to avoid test
crash due to lack of real listener in the testing framework.

- Add functional (some) tests for client tracking based on the mocked interfaces.

---------

Signed-off-by: Yue Li <61070669+theyueli@users.noreply.github.com>
2023-12-21 04:40:21 -08:00
Borys
fd76c51310
feat: add command flow for slot migration process (#2292)
* feat(cluster): add command flow for slot migration process
fixes #2295

DFLYMIGRATE FLOW command was added to establish
connections for every shard replication process.
Slow serialization step is the separate issue so
for now only eof_token is sent for reply to
DFLYMIGRATE FLOW command.
Expected state for START-SLOT-MIGRATION is FULL_SYNC now.
2023-12-20 18:47:11 +02:00
adiholden
6398a73942
fix(bug): access invalid prime table iterator (#2300)
The bug:
When running dragonfly in cache mode we bump up items on dash table when we find them. If we access few items on the callback that reside next to each other we will invalidate the first found iterator.

The fix:
After we bump up entry we insert the prime table ref to bump set. When checking if we can bump down an item we check the item is not in this set. Once we finish running the transaction callback we clear the set.

Signed-off-by: adi_holden <adi@dragonflydb.io>
2023-12-20 13:05:29 +02:00
Shahar Mike
6c32c8004d
refactor(server): Make FindFirst() read-only (#2317)
* refactor(DbSlice): Replace `FindExt()` with `FindMutable()` and `FindReadOnly`

* fix

* `ExpireConstIterator`

* Don't update stats on FindMutable()

* auto&

* FindFirst

* Remove old Find() method
2023-12-20 09:53:52 +02:00