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

1989 commits

Author SHA1 Message Date
Roman Gershman
f7292de4e7
chore: Introduce fiber stack allocator (#2730)
1. Use clib malloc for allocating fiber stacks but reduce the fiber stack size.
   clib malloc uses default 4K OS pages when reserving memory from the OS.
   The reason for not using mi_malloc, because we use 2MB large OS pages with mimalloc.
   However, allocating stacks is one of the cases, when using smaller 4KB memory pages is actually more
   RSS efficient because memory pages become hot at better granularity.

2. Add "memory_fiberstack_vms_bytes" metric exposing fiber stack vm usage.
3. Fix macos dependencies & update ci versions.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-03-18 13:51:33 +02:00
Shahar Mike
e9548a2917
fix(cluster): Reply with correct \n / \r\n from CLUSTER sub cmd (#2731)
* fix(cluster): Reply with correct `\n` / `\r\n` from `CLUSTER` sub commands

Fixes #2726

* fix tests
2024-03-17 10:23:46 +02:00
Vladislav
8e38d24fe2
chore: fix DeduceExecMode (#2733) 2024-03-16 17:37:53 +03:00
Borys
da2b4415be
refactor: block list refactoring #2580 (#2732) 2024-03-15 18:55:03 +02:00
Kostas Kyrimis
76d697aaff
feat: add flag masteruser (#2693)
* add flag masteruser
* fix ack reply on acl validation failure
2024-03-15 08:41:24 +02:00
Shahar Mike
e2b5d48837
feat(json): Deserialize ReJSON format (#2725)
* feat(json): Deserialize ReJSON format

This PR adds support for Redis-based JSON RDB format deserialization.
Since Redis uses ReJSON as a module, serialization is slightly different
from other types, but overall it's not a big change once we know where
all bits should be.

While this change knows how to _read_ Redis-based JSON keys, it does not
_save_ them in Redis format. That will be in a different PR.

This PR also ignores unknown (non-keys) module data instead of failing the load.

Fixes #2718

* Cleanup

* Add tests

* Skip unsupported modules

* Small refactor
2024-03-14 17:23:31 +02:00
Vladislav
9c6e6a96b7
fix(transaction): Replace with armed sync point (#2708)
1. Replaces run_barrier as a synchronization point with is_armed + an embedded blocking counter for awaiting running jobs
2. Replaces IsArmedInShard + GetLocalMask + is_armed.exchange chain with a single DisarmInShard() / DisarmInShardWhen

Signed-off-by: Vladislav Oleshko <vlad@dragonflydb.io>
2024-03-14 14:40:32 +00:00
Roman Gershman
7e0536fd4c
chore: remove core/fibers (#2723)
Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-03-14 12:02:33 +00:00
Kostas Kyrimis
094df3ef3f
fix(BgSave): async from sync (#2702)
* make BgSave command async
2024-03-14 13:31:58 +02:00
Kostas Kyrimis
95538dbad6
fix(transaction): nullptr access on non transactional commands (#2724)
* fix nullptr access on non transactional commands in client tracking
2024-03-14 10:07:24 +02:00
Vladislav
12d76dd5c2
chore: Record cmd stat from invoke (#2720)
1. Pipeline squashing was not recorded
2. Apparently Redis counts commands of MULTI/EXEC transations separately, so I assume we also should
-> Place RecordCmd() in Invoke()
2024-03-13 10:56:17 +03:00
romange
e9734e7c11 chore(helm-chart): update to v1.15.1 2024-03-12 15:49:57 +00:00
Roman Gershman
954780edd1
Remove check-fail in ExpireIfNeeded and introduce DFLY LOAD (#2699)
* chore: prevent crashing upon inconsistent expiry table

Also, introduce "DFLY LOAD <filename>" command in addition to "DEBUG LOAD"
as an official command to load snapshots into the running server.


---------

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-03-12 16:54:13 +02:00
Shahar Mike
8a5ed442d1
chore: Use c-ares for resolving hosts in ProtocolClient (#2719)
We already have a Fiber-aware DNS resolver in Helio, so it's trivial to
change and use.

I tested this end-to-end and it really resolves DNS addresses, not just
localhost.

Fixes #947
2024-03-12 14:39:22 +02:00
Kostas Kyrimis
d6107e55c5
chore: update sanitizers workflow (#2686)
* change timeout duration
* remove failing false positive tests
2024-03-12 14:19:12 +02:00
Kostas Kyrimis
a96d4e4dc8
chore: disable flaky fuzzy migration test (#2716) 2024-03-12 14:18:43 +02:00
Roman Gershman
d709f2a911
chore: improve compatibility of EXPIRE functions with Redis (#2696)
* chore: improve compatibility of EXPIRE functions with Redis

Also, provide a module name if stumbled upon module data that can not be loaded
by dragonfly.

---------

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-03-12 13:50:08 +02:00
Vladislav
4a9f816106
chore(transaction): Don't call GetLocalMask from blocking controller (#2715)
chore: remove reliance on GetLocalMask in BlockingController
2024-03-12 11:53:41 +03:00
Vladislav
9ccf2b9871
chore(transaction): Simplify PollExecution (#2712) 2024-03-12 09:09:29 +03:00
Vladislav
a3dc9382bb
chore: Pull helio with new BlockingCounter (#2711)
Pull helio with new BlockingCounter and fix all usages to use -> operator

---------

Signed-off-by: Vladislav Oleshko <vlad@dragonflydb.io>
2024-03-11 08:03:18 +00:00
Shahar Mike
9ba532a826
feat(server): Use mimalloc in SSL calls (#2710)
* feat(server): Use mimalloc in SSL calls

Until now, OpenSSL used `malloc()` directly. This PR overrides it to use
mimalloc.

Fixes #2709

* Add generate-tls-files.sh
2024-03-11 08:25:59 +02:00
Shahar Mike
8b31195798
feat(cluster): Add --cluster_id flag (#2695)
* feat(cluster): Add `--cluster_id` flag

This flag sets the unique ID of a node in a cluster.

It is UB (and bad) to set the same IDs to multiple nodes in the same
cluster.

If unset (default), the `master_replid` (previously known as `master_id`) is used.

Fixes #2643
Related to #2636

* gh comments

* oops - revert line removal

* fix

* replica

* disallow cluster_node_id in emulated mode

* fix replica test
2024-03-10 20:16:31 +02:00
Roman Gershman
7f02d40b57
chore: add ubuntu22 devcontainer (#2700) 2024-03-09 17:38:01 +02:00
Vladislav
6df0fa4948
fix(channel store): add acquire/release pair in fast update path (#2704)
This pointer is shared between threads and updated immediately, but the memory behind it is not synced.
2024-03-09 11:49:18 +03:00
Vladislav
292c5bcd71
chore: little transaction cleanup (#2608)
Make renabled_autojournal a regular bool, simplify CancelShardCb logic

Signed-off-by: Vladislav Oleshko <vlad@dragonflydb.io>

---------

Signed-off-by: Vladislav Oleshko <vlad@dragonflydb.io>
2024-03-08 09:50:09 +03:00
Vladislav
22e413a00b
Basic FT.AGGREGATE (#2413)
Introduces basic FT.AGGREGATE command, supporting GROUPBY, SORTBY, LIMIT

Signed-off-by: Vladislav <vladislav.oleshko@gmail.com>

---------
2024-03-08 08:51:51 +03:00
Borys
98616755c0
feat(cluster): automatic slot migration finalization #2697 (#2698)
* feat(cluster): automatic slot migration finalization #2697
2024-03-07 20:29:21 +02:00
Roman Gershman
b38024ba4f
chore: add malloc-based stats and decommit (#2692)
* chore: add malloc-based stats and decommit

Provides more stats and control with glibc-malloc based allocator.
For example,
with v1.15.0 (--proactor_threads=2), empty database, `info memory`returns

```
used_memory:614576
used_memory_human:600.2KiB
used_memory_peak:614576
used_memory_peak_human:600.2KiB
used_memory_rss:19922944
used_memory_rss_human:19.00MiB
```

then during `memtier_benchmark  -n 300000  --key-maximum 100000 --ratio 0:1 --threads=30 -c 100` (i.e GET-only with 3k connections):

```
used_memory:614576
used_memory_human:600.2KiB
used_memory_peak:614576
used_memory_peak_human:600.2KiB
used_memory_rss:59985920
used_memory_rss_human:57.21MiB
used_memory_peak_rss:59985920
```

connections overhead grows by ~39MB.
when the traffic stops, `used_memory_rss_human` becomes `30.35MiB`
and we do not know where 11MB gets lost and `MEMORY DECOMMIT` does not reduce the RSS.

With this change, `memory malloc-stats` return during the memtier traffic
```
malloc arena: 394862592
malloc fordblks: 94192
```
i.e. 395MB virtual memory was allocated by malloc and only 94KB is chunks available for reuse.
395MB is arena virtual memory, and not RSS obviously, but at least we have some visibility into malloc reservations.
The RSS usage is the same ~57MB and the difference between virtual and RSS is due to the fact we reserve fiber stacks of size 131KB but we touch less.
After the traffic stops, `arena` is reduced to 134520832 bytes, and fordblks are 133016592, i.e. majority of reserved ranges are also free (available to reuse) in the malloc pools.
RSS goes down similarly to before to ~31MB.

So far, this PR only demonstrated the increased visibility to mmapped ranges reserved by glibc malloc.
The additional functional change is in `MEMORY DECOMMIT` that now trims malloc RSS usage from reserved but unused (fordblks) pages
by calling `malloc_trim`.
After the call, RSS is: `used_memory_rss_human:20.29MiB` which is almost the same as when we started the empty process.

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

* chore: fix build for older glibc environments

Disable these extensions for alpine and use legacy version
for older glibc libraries.
---------

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-03-06 13:11:44 +00:00
Borys
dfedaf7e6e
refactor: remove FULL-SYNC-CUT cmd #2687 (#2688)
* refactor: remove FULL-SYNC-CUT cmd #2687
2024-03-06 14:26:35 +02:00
Shahar Mike
66b87e16c2
feat(server): Account for serializer's temporary buffer size (#2689)
* feat(server): Account for serializer's temporary buffer size

* gh comments
2024-03-06 13:39:32 +02:00
Shahar Mike
35b0ab101e
fix(flushall): Decommit memory after releasing tables. (#2691)
In the fiber we used to call `mi_heap_collect()` when we're done
deleting items. But since that fiber captures a `vector` of intrusive
pointers to `DbTable`s, it can't free all memory used by the tables
themselves.

A local test shows that this fix helps almost entirely: when occupying a
5gb DB, `FLUSHALL` will reduce RSS by 4.7gb, leaving 300mb still used. A
follow up `MEMORY DECOMMIT` *will* indeed remove these 300mb, but I'm
still not sure why they are not released immediately. Still looking...

Addresses (1) of #2690
2024-03-05 15:45:13 +02:00
Roman Gershman
30ce250ab2
chore: Increase disk space in the coverage runs (#2684)
Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-03-04 15:29:00 +02:00
manojks1999
0081f4de71
Chore: Fixed Docker Health Check (#2659)
* docker_healthcheck_fix

* grep_fix_for_alpine

* added environment variable for healthcheck and changed the port extraction accorfingly
2024-03-04 12:47:18 +02:00
Yue Li
842249bc60
bug(tiering): fix overflow in page offset calculation and wrong hash offset calculation (#2683)
fix overflow in page offset calculation and wrong hash offset calculation
2024-03-04 10:08:22 +00:00
Kostas Kyrimis
1b3594ba35
fix: missing manual trigger for daily sanitizers (#2682)
* add manual trigger for usan/asan workflow
2024-03-04 11:40:01 +02:00
Kostas Kyrimis
f3ba448106
chore: make usan asan optional and enable them on CI (#2631)
* add daily job to run unit tests with asan/usan
2024-03-04 11:00:46 +02:00
romange
cf889486bc chore(helm-chart): update to v1.15.0 2024-03-04 05:54:31 +00:00
romange
d551c2a3d3 chore(helm-chart): update to v1.14.7 2024-03-04 04:24:20 +00:00
Roman Gershman
0c1150956b
chore: add oom stats to /metrics (#2680)
* chore: add oom stats to /metrics

Expose oom/cmd errors when we reject executing a command if we reached OOM state (controlled by oom_deny_ratio flag).
Expose oom/insert errors when we do not insert a new key or do not grow a dashtable (controlled by table_growth_margin).

Move OOM command check to a place that covers all types of transactions - including multi and squashing transactions. 
 
---------

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-03-03 18:01:21 +00:00
adiholden
7c443f3a15
feat(server): introduce table_growth_margin flag (#2678)
* feat(server): introduce table_growth_margin flag

Signed-off-by: adi_holden <adi@dragonflydb.io>
2024-03-03 13:02:18 +00:00
Roman Gershman
93debc754c
chore: more fixes for macos (#2677)
1.Add back the search files to MacOs build (linker errors are fixed now).
2. Add default maxmemory argument (if not present already) when launching dragonfly process in regression tests.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-03-02 23:14:33 +02:00
Vladislav
9698f974ea
fix(snapshot): Fix flag access (#2676) 2024-03-01 16:21:57 +03:00
Roman Gershman
7ca45f9feb
chore: update helio dependency (#2674) 2024-03-01 10:30:36 +02:00
romange
7148479965 chore(helm-chart): update to v1.14.6 2024-03-01 02:51:15 +00:00
Borys
e57067d2fb
refactor(cluster): #2652 initiate migration process from CONFIG cmd (#2667)
* refactor(cluster): #2652 initiate migration process from CONFIG cmd
2024-02-29 16:08:53 +02:00
Roman Gershman
f8f213e22f
fix: optionally return float as integer from lua script (#2672)
Redis, due to its old lua enginer and bunch of historic reasons returns floats as integers from lua scripts.
This means `eval "return 42.9" 0` would return 42 as long integer.

Dragonfly supports both integers and floats in its lua engine, returning a precise "42.9" in the same scenario.
RESP2 does not support float types so "42.9" is returned as a bulk string for RESP2 connections. For RESP3, dragonfly
returns 42.9 as a native RESP3 double primitive.

This PR introduces an optional legacy behavior for Dragonfly only for the RESP2 protocol. When the `--lua_resp2_legacy_float` flag is passed,
Dragonfly will round down the double value to the nearest integer and return it as RESP2 native long integer.

Fixes #2664

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-02-29 15:34:51 +02:00
Shahar Mike
54cb7d5cd0
feat(cluster_mgr): Add support for remote Dragonfly servers (#2671)
* WIP: `cluster_mgr.py` to work with remote targets

* Documentation

* No admin port

* Support different hostname move/migrate

* Fix migrate bug

* Fix typo in --help

* fix test

* self.update_id()
2024-02-29 11:59:54 +02:00
adiholden
7e4527098b
fix(server): client pause work while blocking commands run (#2584)
fix #2576
fix #2661

Signed-off-by: adi_holden <adi@dragonflydb.io>
2024-02-28 11:07:03 +00:00
Leonardo Mello
8ef92629c5
feat(generic_family): implement RANDOMKEY command (#2639)
Signed-off-by: Leonardo Mello <lsvmello@gmail.com>
2024-02-27 16:03:21 +02:00
Roman Gershman
cf9f10e94e
chore: fuly cover json_family API with json::Path parsing (#2663)
---------

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-02-27 14:58:59 +02:00