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

2159 commits

Author SHA1 Message Date
Kostas Kyrimis
c5a8008348
chore: add defrag logic for zsets (#3836)
* add defrag logic for zsets
* add tests

---------

Signed-off-by: kostas <kostas@dragonflydb.io>
2024-10-23 10:56:56 +03:00
Stepan Bagritsevich
ea9dc9c454
chore(fakeredis): Enable JSON tests in the Fakeredis tests (#3773)
* chore(fakeredis): Enable JSON tests in the Fakeredis tests

fixes dragonflydb#3671

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

* refactor: address comments

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

* tmp commit

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

* refactor: address comments 2

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

---------

Signed-off-by: Stsiapan Bahrytsevich <stefan@dragonflydb.io>
2024-10-23 08:53:14 +02:00
Stepan Bagritsevich
e96a99a868
fix(search_family): Temporary remove the error when a field name does not have the '@' sign at the beginning in the FT.AGGREGATE command (#3956) 2024-10-21 18:35:23 +02:00
Roman Gershman
3028314701
chore: pass SinkReplyBuilder and Transaction explicitly. Part1 (#3946)
For some of our commands we need to inject another transaction and another SinkReplyBuilder.
This results into error-prone injections of temporary objects into ConnectionContext.
Most commands just need Transaction and SinkReplyBuilder, so lets pass them explicitly.
The final goal will be to remove Transaction and reply_builder fields from ConnectionContext.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-10-20 19:54:50 +03:00
Roman Gershman
f0c30a6d59
feat: track request sizes histograms (#3951)
This PR introduces "DEBUG RECVSIZE ENABLE|DISABLE|tid"
command that allows tracking of request sizes.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-10-20 19:54:34 +03:00
Vladislav
32a31cf1d8
chore(facade): Fix bad new IO glue (#3940)
* chore(facade): Fix bad new IO glue

---------

Signed-off-by: Vladislav Oleshko <vlad@dragonflydb.io>
2024-10-18 23:25:56 +03:00
Roman Gershman
14220a6a20
chore: get rid of ToUpper/ToLower mutations on arguments (#3950)
Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-10-18 23:23:59 +03:00
Roman Gershman
84e22aa658
chore: remove ToUpper calls in main_service (#3947)
* chore: remove ToUpper calls in main_service

Also, test for IsPaused() first to avoid doing more checks for common-case.

---------

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-10-18 14:04:47 +00:00
Roman Gershman
a7c9fde38e
chore: get rid of ToUpper call and use AsciiStrToUpper (#3944)
Also remove std:: in bitops family to reduce noise.
No functional changes.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-10-18 12:47:40 +03:00
Roman Gershman
5ab32b97d9
chore(refactoring): header clean ups (#3943)
Move privately used header code to cc files. Remove redunandant includes.
No functional changes.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-10-18 12:47:26 +03:00
Borys
ef814f6670
chore: ignore applying the same cluster config twice (#3932) 2024-10-16 09:07:01 +03:00
Vladislav
7870f59466
chore(search): Fix deprecated functions (#3933)
Signed-off-by: Vladislav Oleshko <vlad@dragonflydb.io>
2024-10-15 22:50:22 +03:00
Roman Gershman
e9e169d074
fix: dragonfly_connection should only access the original reply_builder (#3924)
ConnectionContext.reply_builder can be injected and replaced by the service logic.
before - dragonfly_connection accessed it via cc_->reply_builder in some places,
which led it to access the injected object. Moreover, EVAL commands can be offloaded
to another thread and that thread could inject the object, making the access to cc_->reply_builder_
non thread-safe.

Now dragonfly_connection copies aside the replier_builder_ pointer, and uses only this pointer for communicating with client.

Also, remove redundant arguments.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-10-15 15:37:50 +03:00
adiholden
a1830e1b5e
feat(server): use listpack node encoding for list (#3914)
Signed-off-by: adi_holden <adi@dragonflydb.io>
2024-10-15 13:55:26 +03:00
Shahar Mike
c868b27bbe
fix: Support replicating Valkey and Redis 7.2 (#3927)
Until now, we only tested Dragonfly against Redis 6.2.  It appears that
something has changed in the way Redis sends stable sync commands, and
now they also forward `MULTI` and `EXEC` as part of their replication.

Since we do not allow all commands to run under `MULTI`/`EXEC`,
specifically `SELECT`, a Dragonfly replica of such servers failed these
commands and became inconsistent with the data on the master.

The proposed fix is to simply ignore (i.e. not execute) `MULTI`/`EXEC`
coming from a Redis/Valkey master, and run the commands within those
transactions individually, like we do for other transactions.

To test this we randomly choose a redis/valkey server based on 3
available installed binaries and test against them.
2024-10-15 13:12:16 +03:00
Vladislav
f455981927
feat(search): Prefix search* (#3913) 2024-10-14 13:54:07 +03:00
Shahar Mike
cf2e94f374
chore: Add --allocator_tracker for default tracking (#3901)
* chore: Add `--allocator_tracker` for default tracking

Before, in order to use allocation tracker, one had to issue a `MEMORY
TRACK` command. This flag is identical to that, but allows starting
Dragonfly with certain ranges without issuing a command.

While here, fix a bug. Apparently, `absl::InlinedVector<>` has a bug in
the implementation of `max_size()` and so in practice we did not limit
the number of trackers. I switched to use `capacity()` instead, which I
tested and it works well.

Notes:
1. Currently the flag always add 100% "sampling", we can extend that in
   the future if need be
2. I added the flag in `dfly_main.cc` with custom initialization,
   because it's low level, and I couldn't get it reasonably working with
   changes only to `allocation_tracker.cc`

* fixes
2024-10-13 12:50:05 +03:00
Vladislav
92217b6045
chore(search): Rax TreeMap (#3909)
RaxTreeMap based on redis rax.h
2024-10-13 09:18:54 +03:00
Roman Gershman
04a29bfafa
fix: macos build (#3912)
It has been failing due to OVERFLOW constant, which is predefined
as a define macro on MacOS.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-10-12 22:50:42 +03:00
Roman Gershman
4012ad1855
fix: prevents Dragonfly from blocking in epoll during snapshotting (#3911)
The problem - we used file write in non-direct mode when writing snapshots in epoll mode.
As a result - lots of data was cached into OS memory. But then during the rename operation,
when we rename "xxx.dfs.tmp" into "xxx.dfs", the OS flushes the file caches and the thread
is stuck in OS system call rename for a long time.

The fix - to use DIRECT mode and to avoid caching the data into OS caches at all.
Fixes #3895

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-10-12 18:26:12 +03:00
Diskein
ba57145c53
fix!: fix BITPOS command responses (#3893) (#3910)
BITPOS returns 0 for non-existent keys according to Redis's
implmentation.

BITPOS allows only 0 and 1 as the bit mode argument.

Signed-off-by: Denis K <kalantaevskii@gmail.com>
2024-10-12 10:55:01 +03:00
Roman Gershman
5d2c308c99
chore: schedule chains (#3819)
Use intrusive queue that allows batching of scheduling calls instead of handling each call separately.
This optimizations improves latency and throughput by 3-5%
In addition, we expose batching statistics in info transaction block.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-10-11 22:41:31 +03:00
Vladislav
e71f083f34
feat(search): STOPWORDS (#3851)
Adds support for STOPWORDS option
2024-10-10 21:58:12 +03:00
Kostas Kyrimis
0cea5fe2ff
chrore: parse cgroup v2 (#3857)
* chrore: parse cgroup v2

* small parsing logic
2024-10-10 19:15:26 +03:00
Andy Dunstall
1e429c8e59
fix(cluster): fix unknown migration error (#3899) 2024-10-10 10:14:15 +01:00
Shahar Mike
50a7f2bcb1
fix: Do not kill Dragonfly on failed DFLY LOAD (#3892)
Today, some of the failures to load an RDB file passed via
`--dbfilename` cause Dragonfly to terminate with an error code. This is
ok and works as expected.

The problem is that the same code path is used for `DFLY LOAD`, which
means that if there's an error loading the file (such as corrupted
file), Dragonfly will exit instead of returning an error code to the
client.

This change fixes that, by only exiting in the code path which loads on
init.

Note to reviewer: apparently we can't call `Future::Get()` more than
once, as the first call resets the state of the future and drops the
previously saved value, so we use a Fiber here instead.
2024-10-08 14:47:31 +03:00
Shahar Mike
b2ebfd05d4
fix: Do not publish to connections without context (#3873)
* fix: Do not publish to connections without context

This is a rare case where a closed connection is kept alive while the
handling fiber yields, therefore leaving `cc_` (the connection context)
pointing to null for other fibers to see.

As far as I can see, this can only happen during server shutdown, but
there could be other cases that I have missed.

The test on its own does _not_ reproduce the crash, however with added
`ThisFiber::SleepFor()`s I could reproduce the crash:

* Right before `DispatchBrief()`
  [here](e3214cb603/src/server/channel_store.cc (L154))
* Right after connection context `reset()`
  [here](2ab480e160/src/facade/dragonfly_connection.cc (L750))

In any case, calling `SendPubMessageAsync()` to a connection where `cc_`
is null is a bug, and we fix that here.

* rewording
2024-10-08 14:45:57 +03:00
Kostas Kyrimis
c1e9d510a3
chore: lock keys for optimistic transactions (#3865)
We do not acquire any locks for transactions that are executing optimistically. However, this is problematic for callbacks that need to preempt (e.g. because a journal is active).

---------

Signed-off-by: kostas <kostas@dragonflydb.io>
2024-10-08 14:25:36 +03:00
Kostas Kyrimis
dac1b0f3ca
chore: allow rdb version 12 (#3860)
We currently support rdb files up to version 11. This is a blocker for people who want to migrate to dragonfly with newer versions of the format. As of now, there is only v12 and it only includes the addition of RDB_OPCODE_SLOT_INFO.

* adds support to load rdb files up to version 12
* reads and discards with a warning the contents of RDB_OPCODE_SLOT_INFO if found in the rdb file

---------

Signed-off-by: kostas <kostas@dragonflydb.io>
2024-10-07 07:14:11 +00:00
Shahar Mike
5efc8f11d2
opt: Optimize AllocationTracker to be efficient when enabled (#3875)
Today there's a cost to enabling AllocationTracker, even for rarely used
memory bands.

This PR slightly optimizes the "happy path" (i.e. allocations outside
the tracked range), and also for the case where we track 100% of the
allocations.

Also, add a unit test for this class.
2024-10-06 22:00:57 +03:00
Roman Gershman
45aba139b6
chore: reduce usage of ToUpper (#3874)
We would like to stop passing MutableSlice as arguments and removing ToUpper
is the first step to it.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-10-06 21:45:11 +03:00
Kostas Kyrimis
129ff0b0f7
chore: run memory decommit after snapshot load/save (#3828)
Sometimes for large values during snapshot loading/saving we allocate a lot of extra memory. For that, we might need to manually run memory decommit for mimalloc to release memory pages back to the OS. This PR addresses that by manually running memory decommit after each shard finishes loading or saving a snapshot.

---------

Signed-off-by: kostas <kostas@dragonflydb.io>
2024-10-06 08:19:24 +03:00
Roman Gershman
612c75c67b
chore: Refactor AddMany (#3869)
Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-10-05 19:27:48 +03:00
Andy Dunstall
4dbed3f8dd
feat(rdb_load): add support for loading huge streams (#3855)
* chore: remove RdbLoad Ltrace::arr nested vector

* feat(rdb_load): add support for loading huge streams
2024-10-05 07:19:03 +03:00
Roman Gershman
07e0b9db4b
chore: ClearInternal now can clear partially (#3867)
* chore: ClearInternal now can clear partially

Intended for future use - to deallocate large objects gradually.
Currently nothing is changed in the functionality besides some cleanups.
---------

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-10-04 22:50:43 +03:00
Roman Gershman
bd972b6384
chore: Implement AddMany method (#3866)
* chore: Implement AddMany method

1. Fix a performance bug in Find2 that made redundant comparisons
2. Provide a method to StringSet that adds several items in a batch
3. Use AddMany inside set_family

Before:
```
BM_Add        4253939 ns      4253713 ns          991
```

After:
```
BM_Add        3482177 ns      3482050 ns         1206
BM_AddMany    3101622 ns      3101507 ns         1360
```

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

* chore: fixes

---------

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-10-04 22:50:05 +03:00
Roman Gershman
a86fcf80be
chore: Remove DenseSet::AddOrFindDense and AddSds (#3864)
Clean up interface a bit. AddOrFindDense does not make much sense as a single function
because it does not provide any performance benefits - we still must perform a lookup
before inserting. AddSds should have been removed a long time ago.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-10-04 17:14:49 +03:00
Roman Gershman
2e1d81ac80
chore: improve performance of ClearInternal (#3863)
Before:
`BM_Clear/elements:32000     418763 ns       418749 ns         9965`

After:
`BM_Clear/elements:32000     323252 ns       323239 ns        12790`

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-10-04 14:26:25 +03:00
Joakim Rishaug
0f972a0ec6
feat: add HEXPIRE and FIELDEXPIRE (#3842)
* add hexpire
* add fieldexpire
* add tests
2024-10-04 14:24:16 +03:00
Roman Gershman
819f6e125d
chore: simplify CloneBatch code (#3862)
Remove awkward fetch_tail case and streamline the code.
Fix invalid prefetch adresses. Performance improved a little.

Before:
`BM_Fill/elements:32000     874677 ns       874647 ns         4774`

After:
`BM_Fill/elements:32000     831786 ns       831761 ns         5111`

Also added a benchmark for Clear() operation.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-10-04 12:08:41 +03:00
Andy Dunstall
44fbe09108
fix(rdb_load): fix partial reads dropping elements (#3853) 2024-10-03 11:28:24 +03:00
Andy Dunstall
a066579930
feat(rdb_load): add support for loading huge lists (#3850)
* feat(rdb_load): add support for loading huge lists

* feat(rdb_load): add EnsureObjEncoding
2024-10-02 15:24:39 +03:00
Roman Gershman
a01dfcb5b6
chore: extend RobjWrapper::sz_ to 2^56 (#3849)
Also remove unused quicklist function.
Relates to #3800

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-10-02 11:20:34 +03:00
Kostas Kyrimis
a3abf41f4e
chore: add defrag logic for sets (#3833)
* add defrag logic for sets
* add small test


---------

Signed-off-by: kostas <kostas@dragonflydb.io>
2024-10-02 10:00:15 +03:00
Vladislav
beb2ec2b29
chore: WrapSds from family_utils.h (#3818)
* chore: WrapSds from family_utils.h
---------

Signed-off-by: Roman Gershman <romange@gmail.com>
Signed-off-by: Kostas Kyrimis  <kostaskyrim@gmail.com>
Co-authored-by: Roman Gershman <romange@gmail.com>
Co-authored-by: Kostas Kyrimis <kostaskyrim@gmail.com>
2024-10-01 15:29:22 +03:00
Joakim Rishaug
2ab480e160
add dense_set.SetExpiryTime in preparation for fieldexpire (#3780)
* feat: add DenseSet::IteratorBase::SetExpiryTime

This commit is in preparation for adding FIELDEXPIRE and HEXPIRE.

* fix: 0 is a valid input for MakeSetSds
2024-10-01 08:36:00 +00:00
Andy Dunstall
e3214cb603
feat(rdb_load): add support for loading huge hmaps and zsets (#3823)
* feat(rdb_load): add support for loading huge hmaps

* feat(rdb_load): add support for loading huge zsets

* feat(rdb_load): log DFATAL when append fails
2024-10-01 09:52:52 +03:00
Roman Gershman
2d11a046be
chore: add pending_ops to disk stats (#3837) 2024-10-01 09:51:53 +03:00
Borys
843adf85a6
refactor: remove CmdArgParser::ToUpper() (#3831) 2024-09-30 14:17:44 +00:00
Roman Gershman
14c94e41d7
chore: optimize element removal for integer lists (#3827)
Fixes #3806

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-09-30 15:19:01 +03:00
Andy Dunstall
820431605e
fix(rdb_load): fix appending to an expired key (#3829) 2024-09-30 11:07:06 +00:00
Kostas Kyrimis
ed11c8d3a4
chore: allow config set notify_keyspace_events (#3790)
We do not allow notify_keyspace_events to be set at runtime via config set command.

* allow notify_keyspace_events in config set command
* add tests

---------

Signed-off-by: kostas <kostas@dragonflydb.io>
2024-09-30 09:54:02 +03:00
Andy Dunstall
5d64e1471a
fix(rdb_load): fix loading huge hmaps with ttl (#3825) 2024-09-30 08:34:28 +03:00
Roman Gershman
ee2f00de27
chore: now it's not needed to allocate quicklistIter on heap (#3814) 2024-09-29 12:46:57 +03:00
Andy Dunstall
520dea06bf
feat(rdb_load): add support for loading huge sets (#3807)
* feat(rdb_load): add support for loading huge sets
2024-09-29 10:25:30 +03:00
Roman Gershman
73002dc048
chore: add a benchmark comparing lpStringToInt64 to SimpleAtoi (#3815)
Seems that lpStringToInt64 is fairly optimized.
On c7g:

```
BM_LpString2Int/1      27383 ns        27381 ns       204149
BM_LpString2Int/2      24535 ns        24534 ns       227981
```

so SimpleAtoi has only ~10% improvement.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-09-29 09:04:25 +03:00
Roman Gershman
a3cabd10d3
chore: introduce an optimized integer compare algorithm for lists (#3813)
* chore: introduce an optimized integer compare algorithm for lists

Problem: when lists are long OpRem will spend lots of time comparing an element with records in the list.
For integer-based lists, most of the time is spent in lpCompare.
In addition, lpGet has lots of branches that penalize integers use-cases.

This PR:
1. Introduces lpGet2 - the improved version with less branches.
2. Benchmarks lpCompare vs an algorithm that compares records to an integer.
3. Benchmarks lpGet vs lpGet2

```
----------------------------------------------------------
Benchmark                Time             CPU   Iterations
----------------------------------------------------------
BM_LpCompare          1187 ns         1187 ns      4715144
BM_LpCompareInt        371 ns          371 ns     15216611
BM_LpGet/1             265 ns          265 ns     21473149
BM_LpGet/2             214 ns          214 ns     26075164
```

There are no functional changes to the Dragonfly code.

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

* chore: fixes

---------

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-09-29 09:04:01 +03:00
Vladislav
753a7808d3
chore: singlehop XREAD (#3817)
Signed-off-by: Vladislav Oleshko <vlad@dragonflydb.io>
2024-09-28 20:22:05 +03:00
Vladislav
55699a9bb9
chore: refactor XRead (#3775)
Previously XREAD:
- Fetched group consumer info (with a hop)
- Looked up last stream ids (with a hop)
- Determined if there are entries to read (on coordinator)
- Dispatched a hop to read entries or retired to blocking mode

Instead we can merge steps (1), (2) and (3) into a single step, optionally with step (4) for single shard operations that can avoid concluding (we had this optimization before)
2024-09-27 18:47:20 +00:00
Borys
895567f3b9
fix: empty strings and Nan in the sort command (#3809)
* fix: empty strings and Nan in the SORT command
2024-09-27 14:17:05 +03:00
Roman Gershman
8ae71411bd
chore: reformat listpack according to valkey 8 (#3810)
Also add benchmarks for lpCompare code when list contains integers.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-09-27 09:22:08 +00:00
Roman Gershman
6a13329523
fix: make sure dfly_bench reliably connects (#3802)
1. Issue ping upon connect, add a comment why.
2. log error if dfly_bench disconnects before all the requests were processed.
3. Refactor memcache parsing code into ParseMC function.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-09-26 23:28:20 +03:00
Roman Gershman
3945b7e4fa
chore: tune TieredStorageTest.MemoryPressure (#3805)
* chore: tune TieredStorageTest.MemoryPressure

* chore: print more stats on failure
2024-09-26 15:42:28 +00:00
adiholden
fbf12e9abb
chore: cleanup not used opcodes in replication (#3804)
feat server: cleanup not used opcodes in replication

Signed-off-by: adi_holden <adi@dragonflydb.io>
2024-09-26 14:51:57 +00:00
Stepan Bagritsevich
c2da601f6b
fix(generic_family): Update indexes in the RESTORE and RENAME commands (#3803) 2024-09-26 14:04:09 +00:00
Borys
cd279af6d4
fix: bitcount invalid range (#3792) 2024-09-26 16:31:09 +03:00
Roman Gershman
70ad113e4b
chore: ScheduleInternal refactoring (#3794)
A small refactoring to improve the flow of ScheduleInternal() as well as
to prepare it for the next change that will reduce the CPU load from the shard queue.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-09-26 08:14:26 +03:00
Kostas Kyrimis
a5d34adc4c
chore: remove goto statements (#3791)
* replace goto statements with lambda calls

Signed-off-by: kostas <kostas@dragonflydb.io>
2024-09-25 16:08:31 +03:00
Lakshya Garg
fb2ee90b2d
chore(acl_family): add allcomands and nocommands (#3783)
* add allcommands alias for acl
* add nocommands alias for acl
* add test
2024-09-25 10:58:33 +03:00
Kostas Kyrimis
105c2bd761
fix: bitop do not add dst key if result is empty (#3751)
* fix bitiop creating the dst key if result is empty
* fix replicating dst with the wrong type
* make bitop a blind update (similar to set command)

---------

Signed-off-by: kostas <kostas@dragonflydb.io>
2024-09-25 09:45:20 +03:00
Borys
987e6feaa5
fix: GETRANGE params validation (#3781)
fix: getrange params validation
2024-09-24 13:54:35 +00:00
Shahar Mike
526bce4222
chore: Forbid replicating a replica (#3779)
* chore: Forbid replicating a replica

We do not support connecting a replica to a replica, but before this PR
we allowed doing so. This PR disables that behavior.

Fixes #3679

* `replicaof_mu_`
2024-09-24 13:42:22 +00:00
Borys
3804076ea9
fix: setrange with empty value doesn't modify the DB (#3771) 2024-09-23 19:09:53 +03:00
Roman Gershman
b7b4cabacc
chore: some renames + fix a typo in RETURN_ON_BAD_STATUS (#3763)
* chore: some renames + fix a typo in RETURN_ON_BAD_STATUS

Renames in transaction.h - no functional changes.
Fix a typo in error.h following  #3758
---------

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-09-23 13:16:50 +03:00
Borys
9303591010
fix: mark pubusb commands as unsupported for cluster (#3767) 2024-09-23 09:59:13 +00:00
Roman Gershman
9c49aee43d
chore: give up on InlinedVector due to spurious warnings with optional (#3765) 2024-09-23 11:34:39 +03:00
adiholden
7df95dfb6e
fix server: fix last error reply (#3728)
fix 1: in multi command squasher error message was not set therefore it was not printed to log on the relevant command only on exec, fixed by setting the last error in CapturingReplyBuilder::SendError
fix 2: non clearing cached error replies before the command is Invoked

---------

Signed-off-by: adi_holden <adi@dragonflydb.io>
Co-authored-by: kostas <kostas@dragonflydb.io>
2024-09-23 11:34:13 +03:00
Andy Dunstall
45ffc605bd
feat(zset_family): add ZRANGESTORE (#3757) 2024-09-23 11:28:12 +03:00
Borys
6185617949
fix: substr/getrange result for invalid range (#3766) 2024-09-23 08:20:08 +00:00
Roman Gershman
0a049ab631
chore: add more error logs around ziplist parsing checks (#3764)
Also, reformat ziplist.c to valkey 8 formatting (no code changes besides this).

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-09-23 10:13:36 +03:00
Roman Gershman
f1f8ee17dc
fix: make snapshotting process more responsive (#3759)
* fix: improve BreakStalledFlowsInShard heuristic

Before this change - we wrote in a single call whatever record chunks we pulled from the channel.
This can be problematic for 1GB chunks for example, which might take 10sec to write.

Lately we added a replication breaker on the master side that breaks the fully sync after
a predefined threshold has passed. By default it was 10sec. To improve the robustness of this
breaker, we now write chunks of upto 1MB and update last_write_time_ns_ more frequently.

Also, we added more logs to make replication delays on both sides more visible.
We also added logs of breaking the replication on the master sides.

Unfortunately, this did not help making BreakStalledFlowsInShard more robust because now the
problem moved to replica side which may take 20s+ seconds to parse huge values.
Therefore, I increased the threshold for breaking the replication to 30s.

Finally, instrument GetMetrics call as it takes sometimes more than 1 sec.

---------

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-09-22 17:05:28 +03:00
Roman Gershman
2e9b133ea0
chore: add integrity checks to consumer->pel (#3754)
Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-09-22 15:40:42 +03:00
adiholden
4d38271efa
feat(server): introduce rss oom limit (#3702)
* introduce rss denyoom limit

Signed-off-by: adi_holden <adi@dragonflydb.io>
2024-09-22 13:28:24 +03:00
adiholden
5cf917871c
feat(server): introduce oom_deny_commands flag (#3718)
* server: introduce oom_deny_commands flag

Signed-off-by: adi_holden <adi@dragonflydb.io>
2024-09-22 09:32:18 +03:00
Vladislav
d9f8f2553b
chore: fix return on bad status (#3758) 2024-09-22 01:36:39 +03:00
Roman Gershman
cce2eb35ed
chore: refactor a lambda function into a named one (#3753)
Also did some cosmetic improvements. No functionality should be changed.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-09-22 01:35:56 +03:00
Andy Dunstall
9dd79657ce
fix: zset store conclude transaction on error (#3755) 2024-09-21 19:08:53 +03:00
Borys
ce79da0f7a
fix: add value range check for SETBIT command (#3750) 2024-09-20 18:20:35 +03:00
Roman Gershman
abf3acec4a
chore: introduce a Clone function for the dense set (#3740)
* chore: introduce a Clone function for the dense set

We use a state machine to prefetch data in batches.
After this change, the hot spots are predominantly inside ObjectClone and
Hash methods.

All in all benchmarks show ~45% CPU reduction:
```
BM_Clone/elements:32000    1517322 ns      1517338 ns         2772
BM_Fill/elements:32000      841087 ns       841097 ns         4900
```

---------

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-09-19 16:14:33 +03:00
Vladislav
3af2dfc4e7
chore: add SetReplies (#3727) 2024-09-19 12:54:25 +03:00
Kostas Kyrimis
0e0b2e78a4
chore: change log level to warning for empty keys (#3722)
* adjust log level to warning for allowed empty keys in rdb_load and rdb_save

Signed-off-by: kostas <kostas@dragonflydb.io>
2024-09-19 09:45:09 +00:00
adiholden
409c2a3beb
test: add test for replication deadlock on replication timeout (#3691)
* test: add test for replication deadlock on replication timeout

Signed-off-by: adi_holden <adi@dragonflydb.io>
2024-09-19 12:11:28 +03:00
Borys
efa4efd2bf
refactor: use CmdArgParser for XGROUP command (#3739) 2024-09-18 22:30:37 +03:00
Kostas Kyrimis
6e45c9c3e2
fix: properly track json memory usage (#3641)
* add JsonMemTracker
* add logic based on MiMallocResource deltas that calculates json object usage
* add test

Signed-off-by: kostas <kostas@dragonflydb.io>
2024-09-18 13:08:43 +00:00
Stepan Bagritsevich
b235617a0d
fix(json_family): Fix out of bound ranges for the JSON.ARR* commands (#3712)
* fix(json_family): Fix out of bound ranges for theJSON.ARR* commands

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

* refactor(json_family): address comments

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

* refactor(json_family): address comments 2

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

---------

Signed-off-by: Stepan Bagritsevich <stefan@dragonflydb.io>
2024-09-18 14:31:17 +02:00
Vladislav
41ba864924
chore: Remove ReqSerializer (#3721)
Signed-off-by: Vladislav <vladislav.oleshko@gmail.com>
2024-09-18 14:31:47 +03:00
Stepan Bagritsevich
ae5ce9b497
fix(json_family): Separate double and int values during the comparison of the JSON objects (#3711)
* fix(json_family): Separate the double and int values in JSON commands

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

* refactor(json_family): Address comments

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

---------

Signed-off-by: Stepan Bagritsevich <stefan@dragonflydb.io>
2024-09-18 07:24:48 +02:00
Stepan Bagritsevich
824af02f6f
fix(json_family): Fix JSON.ARRPOP command in legacy mode should not return WRONGTYPE error (#3683)
* fix(json_family): Fix WRONGTYPE error for the JSON legacy mode in the JSON.ARRPOP command

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

* refactor(json_family): address comments

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

* refactor(json_family): address comments 2

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

---------

Signed-off-by: Stepan Bagritsevich <stefan@dragonflydb.io>
2024-09-18 07:24:18 +02:00
Kostas Kyrimis
8a34b3e730
chore: enable ReplyGuard in ReplyBuilder2 (#3705)
* add ReplyGuard in ReplyBuilder2

Signed-off-by: kostas <kostas@dragonflydb.io>
2024-09-17 13:37:23 +03:00
Kostas Kyrimis
6f84115152
chore: add log info on failed commands (#3694)
* log errors on failed commands

Signed-off-by: kostas <kostas@dragonflydb.io>
2024-09-17 13:07:46 +03:00
Shahar Mike
51746d99c7
fix(cluster): Do not Pause() replication / migrations (#3716)
Pre-this change, whenever Dragonfly was paused (either by a user or by
internal processes like takeover or slot migration finalization),
migrations and replications were also paused.

This could cause timing issues, which sometime result in migration
failures. Specifically, when 2 nodes have migrations from one to the
other **in parallel** (A->B and B->A), the `Pause()` that happens on A
(which happens because it's a source node) will stop it from processing
incoming traffic from B (incoming because it is also a target node).

If timed correctly, it will be locked until it times out, and so the
migration will fail.

The fix is to prevent replications and migrations from adhering to
`Pause()`s, which I think should not have happened in the first place
because they should use the admin port anyway.

Fixes #3319
2024-09-17 10:47:55 +03:00
Andy Dunstall
b9ff6934e8
fix: fix s3 load snapshot (#3717) 2024-09-17 07:17:24 +01:00
Borys
e2a852b7e4
fix: add default value has_mc_flag field (#3710) 2024-09-16 10:03:08 +03:00
Roman Gershman
267bd431e4
chore: add clone benchmark (#3709) 2024-09-15 13:10:43 +03:00
Borys
93de559977
Update dflycluster slot-migration-status reply (#3707)
* feat: update DFLYCLUSTER SLOT-MIGRATION-STATUS reply
2024-09-15 09:44:40 +03:00
Kostas Kyrimis
b5929f0162
fix: allow parsing extra spaces on acl files (#3703)
* allow parsing extra whitespace characters in acl files

Signed-off-by: kostas <kostas@dragonflydb.io>
2024-09-13 10:17:20 +03:00
Yang Hau
35c70dbfe1
feat(core): Support RISCV RVV (#3655) 2024-09-12 18:40:46 +03:00
Stepan Bagritsevich
3815cda26d
fix(json_family) Add NOESCAPE option to the JSON.GET command (#3685)
* fix(json_family) Add NOESCAPE option to the JSON.GET command

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

* refactor(json_family): address comments

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

* refactor(json_family): address comments 2

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

---------

Signed-off-by: Stepan Bagritsevich <stefan@dragonflydb.io>
2024-09-12 13:04:46 +02:00
Stepan Bagritsevich
3ece1725a1
fix(json_family): Fix the JSON.SET bug if the path is in legacy mode and is not the root (#3693)
Signed-off-by: Stepan Bagritsevich <stefan@dragonflydb.io>
2024-09-10 15:50:32 +02:00
Borys
9b8aa8eab4
fix: join for cancel incoming migration (#3692) 2024-09-10 14:42:37 +03:00
adiholden
e71f679386
fix(server): fix replication master deadlock on cancelation flow (#3686)
* fix server: fix replication deadlock on cancelation

Signed-off-by: adi_holden <adi@dragonflydb.io>
2024-09-10 14:13:38 +03:00
Roman Gershman
bdc578acef
chore: limit number of descriptors in the exec map (#3688)
For some cases, this map can grow indefinitely.
This change makes it less detailed by makes sure that number of possible keys is bounded.
Still it can provide a good summary of nature of exec transactions.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-09-10 07:50:30 +00:00
Roman Gershman
3cdc8fa128
chore: add a script that parses allocator tracking logs (#3687) 2024-09-10 07:26:44 +00:00
Roman Gershman
257749263b
chore: adjust RdbChannel sizes (#3676)
Fixes #3658

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-09-09 22:21:42 +03:00
Stepan Bagritsevich
2fad54e41f
fix(search_family): Fix LOAD option behavior in the FT.AGGREGATE command (#3660)
* fix(search_family): Fix LOAD option behavior in the FT.AGGREGATE command

fixes dragonflydb#3646

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

* Update src/server/search/search_family.cc

Co-authored-by: Shahar Mike <chakaz@users.noreply.github.com>
Signed-off-by: Stepan Bagritsevich <43710058+BagritsevichStepan@users.noreply.github.com>

---------

Signed-off-by: Stepan Bagritsevich <stefan@dragonflydb.io>
Signed-off-by: Stepan Bagritsevich <43710058+BagritsevichStepan@users.noreply.github.com>
Co-authored-by: Shahar Mike <chakaz@users.noreply.github.com>
2024-09-09 09:21:48 +00:00
adiholden
c34f2b7eeb
server logs: change script error to warning (#3670)
Signed-off-by: adi_holden <adi@dragonflydb.io>
2024-09-09 11:23:37 +03:00
Shahar Mike
b10a4a5348
feat(server): Support CLIENT SETINFO (#3673)
Add support for `CLIENT SETINFO <LIB-NAME | LIB-VER>` and also return
that as part of `CLIENT LIST`, like Valkey.

Fixes #3137
2024-09-09 11:03:05 +03:00
Roman Gershman
b7b96424e4
deprecate RecordsPopper and serialize channel records during push (#3667)
chore: deprecate RecordsPopper and serialize channel records during push

Records channel is redundant for DFS/replication because we have single producer/consumer
scenario and both running on the same thread. Unfortunately we need it for RDB snapshotting.

For non-rdb cases we could just pass a io sink to the snapshot producer,
so that it would use it directly instead of StringFile inside FlushChannelRecord.

This would reduce memory usage, eliminate yet another memory copy and generally would make everything simpler.
For that to work, we must serialize the order of FlushChannelRecord, and that's implemented by
this PR. Also fixes #3658.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-09-09 06:19:04 +00:00
Shahar Mike
1306a91bda
chore: Add CLIENT ID command (#3672)
We already adhere to all requirements, we just need to return the id
when the command is issued :)

Fixes #3651
2024-09-08 22:00:53 +03:00
Stepan Bagritsevich
0e7c12f5d6
fix(search_family): Fix FT.AGGREGATE GROUPBY option (#3657) 2024-09-08 17:29:09 +02:00
Roman Gershman
264835e9c4
chore: cosmetic changes around Snapshot functions (#3652)
* chore: cosmetic changes around Snapshot functions

Some renames and added comments. Refactored StartIncremental into a separate function
without any functional changes.

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

* chore: fix comments

---------

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-09-08 09:25:41 +03:00
Roman Gershman
1d34bf735e
fix: recursive calls in the allocation tracker (#3665)
Also, remove dependence of absl::TimeZone bloated monstrosity, which was required by
absl::FormatTime api, even though we do not actually format a timezone.

When absl::LocalTimeZone is accessed it allocates hundreds of thousands of bytes
for each shard thread (maybe due to lack thread safety during lazy initialization).

At the end, strftime does a great job without any shenanigans.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-09-08 06:24:09 +00:00
Borys
894bf4735b
fix: fix multi mget exec error message (#3662) 2024-09-06 13:06:02 +03:00
Borys
2cc2a23247
fix: deadlock in the cluster migration process (#3653) 2024-09-05 21:55:15 +03:00
Borys
a1e9ee1b6d
CmdArgParser improvement (#3633)
* feat: add processing of tail args into CmdArgParser::Check
* refactor: rename CmdArgParser::Switch to Map
* feat: add CheckMap method into CmdArgParser
2024-09-05 15:30:54 +03:00
Roman Gershman
3461419088
chore: allow disabling io_uring registered buffers (#3650) 2024-09-05 14:47:42 +03:00
Roman Gershman
67117ff081
fix: crash during SORT DESC call (#3637)
fixes #3636

The problem was that instead of implementing GT operator, we implemented
!LT, which is GE operator. As a result the iterators inside the sort algorithm reached
out of bounds.

---------

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-09-03 12:00:31 +00:00
Kostas Kyrimis
2c32e5085c
fix: debug help printed layout (#3635)
* add missing comma to fix the printed layout

Signed-off-by: kostas <kostas@dragonflydb.io>
2024-09-03 14:04:50 +03:00
Roman Gershman
cf7c983423
fix: 'renamenx foo foo' should return 0 if foo exists (#3630)
fix: renamenx foo foo should return 0 if foo exists

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-09-03 10:58:55 +00:00
Roman Gershman
e6f5a2073c
fix: crash when passing empty arguments (#3627)
* fix: crash when passing empty arguments

Fix the case where we pass an empty argument, which then is parsed as an
empty string view with null pointer. The null pointer is not handled correctly
by our low level c code, hence switch to using ""sv for that.


* chore: add more list asserts + improve test_hypothesis
---------

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-09-03 12:43:12 +03:00
Roman Gershman
1a0d44354f
fix: limit parsing in zrange commands (#3626)
1. The offset value can be negative, in that case we should return an empty array.
2. Fix edge cases of inf*0 and -inf + inf, so they will result in 0 and non NaN (similarily to Valkey).

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-09-03 10:08:45 +03:00
Borys
d40e9088ae
refactor: remove extra code from CmdArgParser (#3619)
* refactor: remove extra code from CmdArgParser
2024-09-03 07:04:05 +00:00
Roman Gershman
879f2950e5
fix: edge cases around mismatched path in json code (#3609)
For legacy mode:
1. For mutate commands, an empty result should throw an error
2. For read commands, it returns nil if path was not found, but if it was matched
   but only with a wrong types, it will throw an error.

For non-legacy mode, objlen should throw an error for non existing key.

Simplified JsonCallbackResult a bit and made sure more fakeredis tests are passing.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-09-02 21:37:59 +03:00
Roman Gershman
eef1de33fd
chore: improve debug logs in dragonfly_connection (#3624)
Adresses #3623

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
Co-authored-by: adiholden <adi@dragonflydb.io>
2024-09-02 18:13:16 +03:00
adiholden
7203667723
fix(bug): zinter command should run on replica (#3620)
fix bug: zinter command should run on replica

Signed-off-by: adi_holden <adi@dragonflydb.io>
2024-09-02 12:59:11 +03:00
Borys
8e9b097b9d
fix: fix expiration processing for set command (#3607)
* fix: fix expiration processing for set command
2024-09-02 08:44:11 +03:00
Shahar Mike
de5ecc7447
chore: Split --cluster_announce_ip and --replica_announce_ip (#3615)
chore: Split `cluster_announce_ip` and `replica_announce_ip`

This PR partially reverts #3421

Fixes #3541
2024-09-01 12:43:44 +00:00
Roman Gershman
10de338926
chore: run fakeredis flow with the debug build (#3612)
1. Fix html publishing code
2. Upload dragonfly logs
3. Run it on pull requests

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-09-01 14:51:00 +03:00
Roman Gershman
5c48320496
fix: debug crash inside parsing of ZRANGE (#3611)
Also, fix error msg for EXEC command and finally tune more fakeredis tests.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-08-31 08:02:21 +03:00
Stepan Bagritsevich
31463c288d
fix(json_family): Fix JsonFromString method (#3602)
Signed-off-by: Stepan Bagritsevich <stefan@dragonflydb.io>
2024-08-30 19:39:25 +03:00
Roman Gershman
dd0effac6f
feat: add slave_repl_offset to the replication section. (#3596)
* feat: add slave_repl_offset to the replication section.

In Valkey slave_repl_offset denotes the replication offset on replica site during stable sync phase.
During fullsync phase it appears with 0 value.

In Dragonfly this field appears only after full sync has completed, thus it allows
to check whether Dragonfly reached stable sync phase. The value of this field describes the cumulative progress
of all the replication flows and it does not directly correspond to master side metrics.

In addition, this PR fixes the bug in wait_available_async() function in our replication tests.
This function is intended to wait until a replica reaches stable state and it did by sending pings until they do not
respond with LOADING error, hence the assumption is that the replica is in full sync state already.

However it can happen that master_link_status is "up" but replica has not reached full sync state, and the PING will succeed
just because wait_available_async() was called before full sync started. The whole approach of polling the state is fragile.

Now we use `slave_repl_offset` explicitly to see if the replica reaches stable state.

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

* chore: simplify wait_available_async

* chore: comments

---------

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-08-30 18:58:07 +03:00
Kostas Kyrimis
41f7b611d0
chore: enable -Werror=thread-safety and add missing annotations (part 2/2) (#3595)
* add missing annotations
* small mutex fixes
* enable -Werror=thread-safety for clang builds

---------

Signed-off-by: kostas <kostas@dragonflydb.io>
2024-08-30 15:42:30 +03:00
Kostas Kyrimis
0705bbb536
feat(acl): add pub/sub (#3574)
* add support for pub/sub
* add tests
---------

Signed-off-by: kostas <kostas@dragonflydb.io>
2024-08-30 15:41:28 +03:00
Stepan Bagritsevich
a22eff15dc
fix(server_family): Remove search indexes during the FLUSHALL command (#3539)
* fix(server_family): Add search indixes removing to the FLUSHALL command

fixes dragonflydf#3532

---------

Signed-off-by: Stepan Bagritsevich <bagr.stepan@gmail.com>
Signed-off-by: Stepan Bagritsevich <stefan@dragonflydb.io>
2024-08-30 08:26:14 +03:00
Roman Gershman
20336805f3
chore: enable experimental_new_io by default. (#3605)
* chore: enable experimental_new_io by default.

It has been running for weeks with the flag on, so enabled it also for community.

---------

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
Signed-off-by: Vladislav Oleshko <vlad@dragonflydb.io>
Co-authored-by: Vladislav Oleshko <vlad@dragonflydb.io>
2024-08-29 23:30:26 +03:00
Roman Gershman
fa2d67b8a8
fix: xreadgroup replies as a map for RESP3 (#3576)
* fix: xreadgroup replies as a map for RESP3

Moreover, it returns data for all the strings, irrespective whether they have results or not
(unlike with XREAD)

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

* fix: properly handle xpending with 0 results

Also reject ENTRIESREAD instead of silently accepting it.

---------

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-08-29 20:05:57 +00:00
Roman Gershman
b74bd5a7b2
fix: JSON.STRAPPEND (#3597)
* fix: JSON.STRAPPEND

JSON.STRAPPEND was completely broken.

First, it accepts exactly 3 arguments, i.e. a single value to append.
Secondly, the value must be a json string, not the regular string. Meaning it must be in double quotes.
So, before we parsed: `JSON.STRAPPEND key $.field bar` and now we parse:
`JSON.STRAPPEND key $.field "bar"`

In addition fixed the behavior of JSON.STRLEN to return "no such key" error in case the
json key does not exist and path is specified.
---------

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-08-29 12:29:34 +00:00
Borys
88229cf365
refactor: remove toUpper() from cmd_arg_parser (#3599)
* refactor: remove usage of toUpper() from cmd_arg_parser

* refactor: remove CmdArgParser::NextUpper
2024-08-29 15:19:52 +03:00
Borys
79a80a0b06
refactor: remove double conversion from str to number to str in search (#3591)
fixes #3581
2024-08-29 09:47:41 +03:00
Roman Gershman
0ee52c9d35
chore: remove DflyVersion::VER0 (#3593)
Stop supporting DflyVersion::VER0 from more than a year ago.
In addition, rename Metrics fields to make them more clear
General improvements and fix the reconnect metric.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-08-28 18:21:53 +03:00
Borys
ee1aee8cee
feat: add escaping symbols for tag search (#3578)
* feat: add escaping symbols for tag search
2024-08-28 12:15:23 +03:00
Kostas Kyrimis
9d68d8f741
fix: warning as error on sanitizers build (#3587)
* disable implicit capture by this

---------

Signed-off-by: kostas <kostas@dragonflydb.io>
2024-08-28 08:30:42 +00:00
Roman Gershman
59068c3f8e
feat: add oom_deny_ratio to mutable config (#3585)
Also order other configuration variables alphabetically.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-08-28 06:24:20 +00:00
Roman Gershman
dc040b53ad
fix: return an error when invalid number of arguments is passed. (#3584)
Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-08-28 06:20:29 +00:00
Stepan Bagritsevich
832b79563d
fix(json_family): Fix JSON.GET crash for the multiple legacy mode paths (#3582)
fixes dragonflydb#3558

Signed-off-by: Stepan Bagritsevich <stefan@dragonflydb.io>
2024-08-27 16:20:34 +00:00
Stepan Bagritsevich
f4fd0f1a07
fix(json_family): Fix json get crash due to an invalid json path (#3580)
fixes dragonflydb##3558

Signed-off-by: Stepan Bagritsevich <stefan@dragonflydb.io>
2024-08-27 16:35:54 +02:00
Eunoia
cfb9fdab34
feat(generic_family): Implement EXPIRETIME and PEXPIRETIME commands (#3524)
Introduce EXPIRETIME and PEXPIRETIME commands
2024-08-26 15:55:24 +00:00
Kostas Kyrimis
839b1be82d
chore: add -Wthread-analysis and annotate (part 1/2) (#3502)
* enable -Wthread-analysis
* add missing annotations
* small fixes

---------

Signed-off-by: kostas <kostas@dragonflydb.io>
2024-08-26 18:22:38 +03:00
Roman Gershman
908290a268
chore: improve compatibility of set and ping commands (#3569)
* chore: improve compatibility of set and ping commands

smismember should return an array of longs and not array of strings.
ping in subscribe mode returns an array for resp2.
Also, fix double rounding for legacy float mode.
---------

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-08-26 13:33:03 +03:00
Vladislav
10816b500f
chore(search): Silence query parser error (#3570) 2024-08-26 13:03:16 +03:00
Kostas Kyrimis
9c3d69e0ec
fix: delete empty dense sets in HGetGeneric (#3543)
* remove DelEmptyPrimeValue
* delete empty dense set in HGetGeneric
* const qualify FindReadOnly

---------

Signed-off-by: kostas <kostas@dragonflydb.io>
2024-08-26 11:33:57 +03:00
Vladislav
b7eccad5bd
chore(transaction): More blocking tests (#3546) 2024-08-26 10:02:08 +03:00
Vladislav
789603d1a7
chore(server): Unify zset boolean operations into single function (#3567) 2024-08-26 10:01:58 +03:00
Vladislav
fce7970ad7
chore(server): Sort correctly in ZINTER (#3566) 2024-08-25 23:43:52 +03:00
Roman Gershman
20b8817148
fix: compatibility around list,string and sort commands (#3568)
1. Fix corner cases around non existing keys
2. Fix matching logic for * glob, as well as '' glob.
3. Improve SORT option parsing.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-08-25 16:30:55 +03:00
Vladislav
067fdd83b9
chore(server): Unify zset arg parsing (#3563) 2024-08-25 11:55:10 +03:00
Roman Gershman
be822ae9e1
fix: compatibility around list and string commands (#3565) 2024-08-25 10:41:25 +03:00
Vladislav
1646e90923
fix(server): Fix ZRANGEBYLEX limit params (#3562) 2024-08-25 09:21:49 +03:00
Roman Gershman
caf677ea76
fix: string compatibility issues (#3564)
1. strlen should return 0 for non existing types.
2. reject both EX and PX options in SET
3. prevent overflow of expiry time that is too large

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-08-25 08:08:14 +03:00
Roman Gershman
52b3866351
chore: allow limiting pipelining queue by length (#3551)
* chore: allow limiting pipelining queue by length

We already allow limiting the queue by memory usage but it also makes sense to limit by depth,
so that in extreme cases we would provide backpressure back to client connections. Otherwise if we parse and read everything,
clients do not have a sense of how loaded the connection is on the server side.

---------

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-08-24 18:22:56 +03:00
Vladislav
9f7cbc7d4d
chore(search): fix numeric index query in rev order (#3555) 2024-08-24 13:32:36 +03:00
Vladislav
0e4e971ad9
chore(server): Fix watch (#3557) 2024-08-24 13:32:21 +03:00
Stepan Bagritsevich
3fd3c40b74
fix(search_family): Fix query parsing for the integer tags in OR expression (#3544)
fixes dragonflydb#3490

Signed-off-by: Stepan Bagritsevich <stefan@dragonflydb.io>
2024-08-24 11:58:16 +03:00
Roman Gershman
358c644335
fix: zinterstore correctly finds weights (#3554)
1. Fix the bug of computing incorrectly the weight index in OpInter
2. Remove code duplication and factor out the parsing code from OpInter and OpUnion into PrepareWeightedSets
3. Implement TODO and support union of zsets and sets, which has already been implemented for ZINTER.

fixes #3553

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-08-24 11:52:21 +03:00
Stepan Bagritsevich
80c3579596
feat(server_family): Add backup/restore Prometheus metrics (#3520)
* feat(server_family): Add backup/restore Prometheus metrics

fixes dragonflydb#3210

---------

Signed-off-by: Stepan Bagritsevich <bagr.stepan@gmail.com>
2024-08-24 00:36:31 +03:00
Roman Gershman
dc4dcbfcbd
chore: add deallocation logs in the allocation tracker (#3549) 2024-08-23 17:20:53 +03:00
Vladislav
f88e49ba68
chore: fix search replication (#3547)
chore: fix search replcation

Signed-off-by: Vladislav Oleshko <vlad@dragonflydb.io>
2024-08-23 08:35:09 +03:00
Kostas Kyrimis
80972c7ace
fix: build errors in sanitizers daily workflow (#3542)
* disable warning for the problematic block in list_family

---------

Signed-off-by: kostas <kostas@dragonflydb.io>
2024-08-22 17:52:35 +00:00
Stepan Bagritsevich
6cfbc08013
fix(jsonpath): Add JsonPath grammar for the child identifier in brackets (#3533)
* fix(jsonpath): Add json path grammar for the child identifier with brackets

fixes dragonflydb##3511

---------

Signed-off-by: Stepan Bagritsevich <bagr.stepan@gmail.com>
2024-08-22 13:49:50 +03:00
Vladislav
1bf6d73aa3
fix(transaction): Don't set continuation for blocking (#3540) 2024-08-21 17:48:23 +00:00
Borys
8266c8d026
fix: MC flags size and serialization #3134 (#3538) 2024-08-21 18:31:03 +03:00
Kostas Kyrimis
51f6bbed09
fix: macos build (#3536)
* define IOV_MAX on macos if it's not defined

---------

Signed-off-by: kostas <kostas@dragonflydb.io>
2024-08-21 16:33:45 +03:00
Stepan Bagritsevich
54cf6f0d06
fix(search_family): Add error on creating indexes from non-zero databases (#3537) 2024-08-21 15:19:21 +03:00
Kostas Kyrimis
4835b5debc
fix: deadlock in Heartbeat() (#3530)
* acquire and immediately release db_slice.GetSerializationMutex() in Heartbeat()

---------

Signed-off-by: kostas <kostas@dragonflydb.io>
2024-08-20 17:32:04 +03:00
Kostas Kyrimis
b979994025
fix: skip empty objects on load and replication (#3514)
* skip empty objects in rdb save
* skip empty objects in rdb load
* delete empty keys in FindReadOnly

---------

Signed-off-by: kostas <kostas@dragonflydb.io>
2024-08-20 09:44:41 +03:00
Vladislav
f90ae4fcff
chore(config): make pipeline_squash configurable (#3529) 2024-08-20 09:31:44 +03:00
Kostas Kyrimis
86e79e13c5
fix: disable sanitizers false positive (#3522)
* disable false positive test cases

---------

Signed-off-by: kostas <kostas@dragonflydb.io>
2024-08-19 13:46:14 +03:00
Vladislav
d13cd53e17
chore(io): Optimize repeated ReservePiece calls (#3525) 2024-08-19 13:20:34 +03:00
Vladislav
1f36c9952d
chore(io): Introduce (carefully) new io with use_new_io flag (#3513)
Plugs in new IO, must be reverted after successful testing
2024-08-16 16:56:04 +03:00
Kostas Kyrimis
d3a893f2a6
fix: disable ThreadLocalMutex when big value ser is off (#3521)
* fix: disable ThreadLocalMutex when big value ser is off

* refactor: address comments

---------

Co-authored-by: Ubuntu <ubuntu@ip-172-31-28-29.ec2.internal>
Co-authored-by: Borys <borys@dragonflydb.io>
2024-08-15 22:19:01 +03:00
Shahar Mike
ad3ebf61d2
feat(cluster): Allow appending RDB to existing store (#3505)
* feat(cluster): Allow appending RDB to existing store

The goal of this PR is to support the loadoing of multiple RDB files into a single server, like when migrating from a Valkey cluster to Dragonfly with a different number of nodes.

It makes the following changes:

* Removes `DEBUG LOAD`, as we already have `DFLY LOAD`
* Adds `APPEND` option to `DFLY LOAD` (i.e. `DFLY LOAD <filename> APPEND`) that loads an RDB without first flushing the data store, overriding existing keys
* Does not load keys belonging to unowned slots, if in cluster mode

Fixes #2840
2024-08-15 14:56:40 +03:00
Shahar Mike
5b546df94d
chore: Change Lua embedded flags syntax (#3517)
Background

We tried to be compatible with Valkey in their support of Lua flags, but we generally failed:

We are not really compatible with Valkey because our flags are different (we reject unknown flags, and Valkey flags are unknown to us)
The #!lua syntax doesn't work with Lua (# is not a comment), so scripts written for older versions of Redis can't be used with Dragonfly (i.e. they can't add Dragonfly flags and remain compatible with older Redis versions)
Changes

Instead of the previous syntax:

#!lua flags=allow-undeclared-keys,disable-atomicity

We now use this syntax:

--!df flags=allow-undeclared-keys,disable-atomicity
It is not backwards compatible (with older versions of Dragonfly), but it should be very easy to adapt to, and doesn't suffer from the disadvantages above.

Related to #3512
2024-08-15 08:04:20 +03:00
Roman Gershman
81eff01b9d
fix: bugs around the growth of a tiered file (#3516)
1. Before - when 15% margin of total size becomes larger than 256MB, we increased the file by 256MB even though
   we still had unused 256MB. Now it's fixed.
2. We attempted to grow a file even if it reached the limit and then returned the error.
   It is wrong handle "reach the limit" state as an error - it's just a logical constraint,
   so now we do not attempt to grow and handle this quietly.
3. There was a segfault bug in extent tree in case the existing segment and the new one needs to be united.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-08-15 07:24:31 +03:00
Roman Gershman
93f6773297
chore: reduce pipelining latency by reusing existing shard fibers (#3494)
* chore: reduce pipelining latency by reusing existing shard fibers

To prove the benefits, run `./dfly_bench --pipeline=50   -n 20000  --ratio 0:1  --qps=0  --key_maximum=1`
Before: the average pipelining latency was 10ms
After: the average pipelining latency is 5ms.
Avg latency: pipelined_latency_usec / total_pipelined_squashed_commands

Also, improved counting of squashed commands - to count actual squashed ones.
---------

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-08-14 14:45:54 +03:00
Roman Gershman
a2e63f144c
fix: clang warnings (#3509)
Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-08-14 09:39:56 +00:00
Roman Gershman
fa0913e662
chore: introduce a secondary TaskQueue for shards (#3508)
Also allow the TaskQueue to support multiple consumer fibers.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-08-14 10:53:29 +03:00
Roman Gershman
5cfe4154cc
chore: split engine_shard file from engine_shard_set (#3507)
No functional changes besides that.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-08-13 22:27:46 +03:00
Kostas Kyrimis
0786fc83c1
fix: missing virtual destructors in ReplyBuilder2 (#3506) 2024-08-13 17:20:15 +03:00
Stepan Bagritsevich
c756023332
feat: Expose replica_reconnect_count for Prometheus metrics (#3370) 2024-08-13 12:34:01 +02:00
Kostas Kyrimis
3f5d4f890d
fix: sanitizers false positives (#3495)
* disable flaky tests

---------

Signed-off-by: kostas <kostas@dragonflydb.io>
2024-08-13 09:53:31 +03:00