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

2133 commits

Author SHA1 Message Date
Shahar Mike
779bba71f9
fix: Fix test_network_disconnect_during_migration test (#4224)
There are actually a few failures fixed in this PR, only one of which is a test bug:

* `db_slice_->Traverse()` can yield, causing `fiber_cancelled_`'s value to change
* When a migration is cancelled, it may never finish `WaitForInflightToComplete()` because it has `in_flight_bytes_` that will never reach destination due to the cancellation
* `IterateMap()` with numeric key/values overrode the key's buffer with the value's buffer

Fixes #4207
2024-12-02 15:55:23 +02:00
Roman Gershman
dcee9a9874
fix: bugs in stream code (#4239)
* fix: bugs in stream code

1. Memory leak in streamGetEdgeID
2. Addresses CVE-2022-31144
3. Fixes XAUTOCLAIM bugs and adds tests.
4. Limits the count argument in XAUTOCLAIM command to 2^18 (CVE-2022-35951)

Also fixes #3830

---------

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-12-02 15:12:14 +02:00
Roman Gershman
91aff49fcd
chore: fix bugs in stream_family (#4237)
1. Use transaction time in streams code, similarly to how we do it in other commands.
   Stop using mstime() and delete unused redis code.
2. Check for sequence overflow issue when passing huge sequence ids.
   Add a test.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-12-02 11:57:31 +02:00
Roman Gershman
c857ff98ad
chore: update command interface for bitops, bloom, zset families (#4235) 2024-12-02 00:25:37 +02:00
Roman Gershman
4a85c69db1
chore: support qlist compression when accounting for memory (#4233)
Also fix "debug objhist" so that its value histogram will show effective malloc
used distributions for all types.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-12-01 21:52:11 +02:00
Kostas Kyrimis
872e49b0b8
fix: command docs (#4229)
Signed-off-by: kostas <kostas@dragonflydb.io>
2024-11-30 16:53:22 +02:00
Roman Gershman
a4b3724929
chore: change the interface of hll, generic and list commands (#4227) 2024-11-29 14:02:51 +02:00
Roman Gershman
3ad5b387bd
chore: Track QList memory (#4226)
After running `debug POPULATE 100 list 100 rand type list elements 10000`
with `--list_experimental_v2=false`:

```
type_used_memory_list:16512800
used_memory:105573120
```

When running with `--list_experimental_v2=true`:

```
used_memory:105573120
type_used_memory_list:103601700
```

TODO: does not yet handle compressed entries correctly but we do not enable compression by default.

Fixes #3800

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-11-29 13:13:23 +02:00
Roman Gershman
68b7baf6a7
chore: qlist code clean ups (#4223)
Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-11-29 10:52:01 +02:00
Roman Gershman
183bfaeb67
chore: remove tail field from qlist (#4220)
Also update license's change date.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-11-28 18:27:48 +00:00
Kostas Kyrimis
4aece00aac
chore: add noop docs subcmd (#4214)
* add noop subcommand DOCS to COMMAND
2024-11-28 19:03:04 +02:00
Roman Gershman
010bd8add4
chore: change the interface of stream and server commands (#4219) 2024-11-28 18:44:01 +02:00
Roman Gershman
c9654d4050
chore: Add more qlist tests (#4217)
* chore: Add more qlist tests

Also fix a typo bug in NodeAllowMerge.

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

* chore: fix build

---------

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-11-28 14:54:13 +00:00
Borys
dc04b196d5
test: fix and unskip test_migration_timeout_on_sync (#4216) 2024-11-28 14:54:17 +02:00
adiholden
90b4fea0d9
bug(replication): snapshot cleanup fix in transition to stable sync (#4211)
Signed-off-by: adi_holden <adi@dragonflydb.io>
2024-11-28 08:38:36 +02:00
Roman Gershman
57fd5f16a7
chore: update command interface for hset/set families (#4209) 2024-11-27 14:00:30 +00:00
Stepan Bagritsevich
bd143e4b81
fix(search_family): Fix crash when no SEPARATOR is specified in the FT.CREATE command (#4205)
fix(search_family): fix(search_family): Fix crash when no SEPARATOR is specified in the FT.CREATE command

Signed-off-by: Stepan Bagritsevich <stefan@dragonflydb.io>
2024-11-27 16:30:36 +04:00
Roman Gershman
a87d6aecef
chore: fully support qlist in all list_family commands (#4201)
Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-11-27 13:56:56 +02:00
Kostas Kyrimis
66e0fd0908
fix: stream memory tracking (#4067)
* add object memory usage for streams
* add test
2024-11-27 12:41:08 +02:00
Roman Gershman
065a63cab7
chore: qlist improvements (#4194)
fix: qlist improvements + bug fix in Erase

1. Reduce code duplication.
2. Expose qlist node count via "debug object"
3. Add more tests to qlist_test
4. Fix a bug in QList::Erase

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-11-27 11:28:40 +02:00
Roman Gershman
45f8e8446f
chore: get back on the decision to put a hard limit on command interface (#4203)
* chore: get back on the decision to put a hard limit on command interface

Limiting commands to only Transaction* and SinkReplyBuilder does not hold.
We need sometimes to access context fields for multitude of reasons.

But I do not want to pass the huge ConnectionContext object because, it's hard
then to track unusual access patterns.

The compromise: to introduce CommandContext that currently has tx, rb and extended fields.
It will be relatively easy to identify irregular access patterns by tracking the extended field.

This commit is the first one in series of probably 10-15 commits. No functional changes here.

---------

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-11-27 11:28:02 +02:00
Borys
3327e1a908
feat: add ability reading stream_listpacks_2/3 rdb types (#4192)
* feat: add ability reading stream_listpacks_2/3 rdb types

* refactor: address comments
2024-11-26 16:43:30 +02:00
Roman Gershman
f84e1eeac8
fix: debug object encoding names (#4188)
Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-11-26 16:11:18 +02:00
Kostas Kyrimis
2f748c24dd
chore: fix false positives sanitizers (#4190)
* disable false positive

Signed-off-by: kostas <kostas@dragonflydb.io>
2024-11-26 11:49:20 +02:00
Roman Gershman
1709061ae6
chore: stop periodic task earlier during the shutdown process (#4187)
Fixes #4151

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-11-26 10:02:15 +02:00
Roman Gershman
7ac1631424
fix: deduplicate mget response (#4175)
* fix: deduplicate mget response

In case of duplicate mget keys, skips fetching the same key twice.
The optimization is straighforward - we just copy the response for the original key,
since the response is a shallow object, we potentially save lots of memory with this
deduplication. Always deduplicate inside OpMGet.

---------

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-11-25 17:29:53 +02:00
Borys
43c83d29fa
feat: cluster migrations restarts immediately if timeout happens (#4081)
* feat: cluster migrations restarts immediately if timeout happens

* feat: add DEBUG MIGRATION PAUSE command
2024-11-25 16:02:22 +02:00
Shahar Mike
3c65651c69
feat: Huge values breakdown in cluster migration (#4144)
* feat: Huge values breakdown in cluster migration

Before this PR we used `RESTORE` commands for transferring data between
source and target nodes in cluster slots migration.

While this _works_, it has a side effect of consuming 2x memory for huge
values (i.e. if a single key's value takes 10gb, serializing it will
take 20gb or even 30gb).

With this PR we break down huge keys into multiple commands (`RPUSH`,
`HSET`, etc), respecting the existing `--serialization_max_chunk_size`
flag.

Part of #4100
2024-11-25 15:58:18 +02:00
Stepan Bagritsevich
2b3c182cc9
fix(search_family): Fix LOAD fields parsing in the FT.AGGREGATE and FT.SEARCH commands (#4012)
* fix(search_family): Fix LOAD fields parsing in the FT.AGGREGATE and FT.SEARCH commands

fixes dragonflydb#3989

Signed-off-by: Stsiapan Bahrytsevich <stefan@dragonflydb.io>

* refactor: address comments

Signed-off-by: Stepan Bagritsevich <stefan@dragonflydb.io>

* refactor(search_family): Address comments 2

Signed-off-by: Stepan Bagritsevich <stefan@dragonflydb.io>

* refactor(search_family): address comments 3

Signed-off-by: Stepan Bagritsevich <stefan@dragonflydb.io>

* refactor(search_family): address comments 4

Signed-off-by: Stepan Bagritsevich <stefan@dragonflydb.io>

* refactor(search_family): address comments 5

Signed-off-by: Stepan Bagritsevich <stefan@dragonflydb.io>

---------

Signed-off-by: Stsiapan Bahrytsevich <stefan@dragonflydb.io>
Signed-off-by: Stepan Bagritsevich <stefan@dragonflydb.io>
2024-11-25 09:50:31 +00:00
Roman Gershman
872d5e2d7d
chore: more parser improvements (#4177)
The long-term goal is to make the parser to consume the whole input when
it returns INPUT_PENDING. It requires several baby step PRs.

This PR:
1. Adds more invariant checks
2. Avoids calling RedisParser::Parse with an empty buffer.
3. In bulk string parsing - remove redundant "optimization" of rejecting partial strings of less than 32 bytes,
   in other words consume small parts as well. The unit test adjusted accordingly.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-11-25 09:15:29 +02:00
Shahar Mike
6a7f345bc5
chore: Hide replicas from CLUSTER subcmds in managed mode (#4174)
* chore: Hide replicas from `CLUSTER` subcmds in managed mode

Part of #4173 (see for context)

* server.client()
2024-11-24 13:10:32 +00:00
Andy Dunstall
e05363995f
feat(server): add eval_ro and evalsha_ro (#4091) 2024-11-24 11:53:06 +00:00
Roman Gershman
91caa940b9
chore: fix shutdown sequence in Dragonfly server (#4168)
1. Better logging in regtests
2. Release resources in dfly_main in more controlled manner.
3. Switch to ignoring signals when unregister signal handlers during the shutdown.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-11-24 10:35:00 +02:00
Kostas Kyrimis
a012539f2c
fix: remove DenseSet::IteratorBase::TraverseApply (#4170)
Signed-off-by: kostas <kostas@dragonflydb.io>
2024-11-23 18:21:50 +02:00
Roman Gershman
b8c2dd888a
chore: log exit code of failing dragonfly in tests (#4166)
Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-11-22 11:40:10 +02:00
Roman Gershman
a694bf46b8
chore: fix a regression build break (#4162) 2024-11-21 10:40:18 +00:00
Roman Gershman
581cfbf6c5
chore: allow slow and precise memory measurement of an object (#4160)
Specifically fixes "MEMORY USAGE" for lists.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-11-21 09:21:48 +02:00
Shahar Mike
24a1ec6ab2
fix: Huge entries fail to load outside RDB / replication (#4154)
* fix: Huge entries fail to load outside RDB / replication

We have an internal utility tool that we use to deserialize values in
some use cases:

* `RESTORE`
* Cluster slot migration
* `RENAME`, if the source and target shards are different

We [recently](https://github.com/dragonflydb/dragonfly/issues/3760)
changed this area of the code, which caused this regression as it only
handled RDB / replication streams.

Fixes #4143
2024-11-20 14:00:07 +00:00
Roman Gershman
36135f516f
fix: test_replication_all failure (#4155)
Fixes #4150. The failure can be reproduced with high probability on ARM via
`pytest dragonfly/replication_test.py -k test_replication_all[df_factory0-mode0-8-t_replicas3-seeder_config3-2000-False]`

Not sure why this barrier is needed but #4146 removes the barrier
which breaks a gentle balance in the code in unexpected way.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-11-20 14:00:28 +02:00
Roman Gershman
0e7ae34fe4
fix: enforce load limits when loading snapshot (#4136)
* fix: enforce load limits when loading snapshot

Prevent loading snapshots with used memory higher than max memory limit.

1. Store the used memory metadata only inside the summary file
2. Load the summary file before loading anything else, and if the used-memory is higher,
   abort the load.
---------

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-11-20 06:12:47 +02:00
Borys
4e7800f94f
fix: UB during cmd squashing reply size calculation (#4149)
* fix: UB during cmd squashing reply size calculation

* feat: add promtheus metric commands_squashing_replies_bytes
2024-11-19 13:40:30 +02:00
Roman Gershman
794bd1cdb3
chore: tune logs and improve restrict denied error (#4145)
1. Now error stats show "restrict_denied" instead of "Cannot execute restricted command ..." error.
2. Increased verbosity level when loading a key with expired timestamp.
3. pulled helio with better logs coverage of tls_socket.cc code.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-11-18 23:14:14 +02:00
Roman Gershman
d467a348ac
fix: allow SELECT in multi/exec if it's a noop (#4146)
Fixes #4120

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-11-18 22:27:34 +02:00
Borys
e16ef838e4
feat: add INFO memory section for squashing replies memory consuming (#4147)
* feat: add INFO memory section for squashing replies memory consuming

* refactor: address comments
2024-11-18 21:16:41 +02:00
Borys
5e2b48c3f3
fix: migration ACK response processing (#4140) 2024-11-18 09:28:07 +02:00
Roman Gershman
ee01dc4fb5
chore: fix a potential crash during client list (#4141) 2024-11-18 06:32:30 +02:00
adiholden
59c81fb98a
fix server: fix write to slowlog on squashing flow (#4138)
Signed-off-by: adi_holden <adi@dragonflydb.io>
2024-11-17 16:03:30 +02:00
Roman Gershman
8bd2b9ed3e
chore: optimize info command (#4137)
* chore: optimize info command

    Info command has a large latency when returning all the sections.
    But often a single section is required. Specifically,
    SERVER and REPLICATION sections are often fetched by clients
    or management components.

    This PR:
    1. Removes any hops for "INFO SERVER" command.
    2. Removes some redundant stats.
    3. Prints latency stats around GetMetrics command if it took to much.

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>

* chore: remove GetMetrics dependency from the REPLICATION section

Also, address comments

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

* fix: clang build

---------

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-11-17 13:33:29 +02:00
Roman Gershman
2ff6bf35c1
chore: improve the state machine of RedisParser (#4085)
1. Simplify conditions inside the main loop.
2. Improve the logic inside ConsumeBulk() function.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-11-15 11:14:50 +02:00
Roman Gershman
c46cb2514f
chore: fix plain node insertion (#4134)
The blob allocation had invalid size and the value has never been copied.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-11-14 23:53:34 +02:00