Commit graph

38 commits

Author SHA1 Message Date
Roman Gershman
3977f0f60a
chore: futher dash table clean ups (#5072)
Added types PhysicalBid and LogicalBid to help showing the meaning/context behind
a bucket id.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2025-05-07 10:30:49 +03:00
Roman Gershman
4d07d7d053
chore: dash table clean ups (#5064)
Remove stash template parameter because we only use dashtable with a single configuration
of STASH_CNT=4.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2025-05-06 09:33:00 +00:00
Shahar Mike
6f3c6e3d57
chore: Fix all clang build warnings (#4475)
* chore: Fix all clang build warnings

Also add `-Werror` to clang build in CI.

Fixes #4449

* all build targets

* fix search test
2025-01-20 10:24:07 +02:00
Roman Gershman
a936dfe8a5
chore: add Dash::Prefetch function (#4476)
* chore: add Dash::Prefetch function

It's not being used at this time.

* chore: fixes
2025-01-19 20:07:22 +02:00
adiholden
805c024fc2
fix(server): fix bug in replication on cached mode (#3156)
* fix server: fix replication on cached mode

Signed-off-by: adi_holden <adi@dragonflydb.io>
2024-06-17 08:37:58 +03:00
Vladislav
d675e63ab0
chore(dash): Replace comparator with predicate (#3025)
Signed-off-by: Vladislav Oleshko <vlad@dragonflydb.io>
2024-05-08 13:03:15 +03:00
Vladislav
f27506e678
feat(tiering): simple offload loop (#2987)
Simple offloading for tiering

Signed-off-by: Vladislav Oleshko <vlad@dragonflydb.io>
2024-05-06 22:28:45 +03:00
Kostas Kyrimis
9d5bd99f5c
fix: sanitizers clang build and clean up some warnings (#2793)
* fix sanitizers build on clang
* clean up some warnings
2024-03-29 17:13:37 +02:00
Kostas Kyrimis
370f334baf
chore: remove duplicate code from dash and simplify (#2765)
* rename all Policy members for consistency
* remove duplicate code
2024-03-29 11:14:58 +02:00
Kostas Kyrimis
cd20c4003d
chore(replication-tests): add cache_mode on test replication all (#2685)
* add cache_mode cases on test_replication_all
* fix CVCOnBumpUp to not skip some of the modified buckets
2024-03-27 14:28:52 +02:00
Roman Gershman
df39d3a286
chore: move jsoncons path code into dedicated files (#2666)
It's only a code move, without functional changes.
This is in preparation to implementing the same path functionality
for flexbuffers objects.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-02-27 11:50:24 +02:00
adiholden
32e8d49123
feat(tiering): add background offload step (#2504)
* feat(tiering): add background offload step

Signed-off-by: adi_holden <adi@dragonflydb.io
2024-02-14 14:28:41 +02:00
adiholden
9f4c4353b5
fix(server): mget crash on same key get (#2474)
* fix(server): mget crash on same key get

fix: #2465
the bug: on cache mode mget bumps up items. When executing mget with the same key several times i.e mget key key we will invalidate the iterator when we bump up the item in dash table.
the fix: bump up/down items only once by using bumped_items set
This PR also reverts c225113
and updates the bumped stats and bumped_items set if the item was bumped

Signed-off-by: adi_holden <adi@dragonflydb.io>
2024-01-28 11:45:35 +02:00
adiholden
9f3b118b87
server(tiering): load data on read (#2415)
* server(tiering): load data on read

Signed-off-by: adi_holden <adi@dragonflydb.io>
2024-01-17 16:13:56 +02:00
Roman Gershman
01a9e6d1f0
feat: introduce segment merge operation (#2412)
Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-01-15 04:02:12 +02:00
Roman Gershman
1cab6695d7
chore: improvements in dash code (#2387)
chore: cosmetic improvements in dash code

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

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-01-08 20:21:52 +02:00
Roman Gershman
d495baba93
fix: wrong assert check in dash segment (#2238)
Fixes #2234

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2023-12-01 05:42:49 +02:00
iko1
19d7622280
feat: add s390x architecture support (#1214)
* fix(lua): use native architecture when compiling lua for s390x.

Signed-off-by: iko1 <me@remotecpp.dev>

* feat(server): implement CompareFP for s390x architecture.

Signed-off-by: iko1 <me@remotecpp.dev>

* feat: implement validate_ascii_fast function variant for s390x arch.

Signed-off-by: iko1 <me@remotecpp.dev>

* fix: add comments before s390x vector operations

Signed-off-by: iko1 <me@remotecpp.dev>

* fix validate_ascii_fast function logic after CR comment

Signed-off-by: iko1 <me@remotecpp.dev>

* Revert "fix(lua): use native architecture when compiling lua for s390x."

This reverts commit 6cc5d8a8ed.

* fix(lua): use native architecture when compiling lua for s390x.

Signed-off-by: iko1 <me@remotecpp.dev>

* refactor validate_ascii_fast function after CR comment

Signed-off-by: iko1 <me@remotecpp.dev>

* include vecintrin.h from sse_port.h rather the misleading filename

Signed-off-by: iko1 <me@remotecpp.dev>

---------

Signed-off-by: iko1 <me@remotecpp.dev>
2023-06-18 21:33:22 +03:00
adiholden
8600eacdc4
bug(sse2neon): fix sanitizer crash in _mm_loadu_si128 (#1037)
* bug(sse2neon): fix sanitizer crash in _mm_loadu_si128

Signed-off-by: adi_holden <adi@dragonflydb.io>

* remove static

Signed-off-by: adi_holden <adi@dragonflydb.io>

---------

Signed-off-by: adi_holden <adi@dragonflydb.io>
2023-04-10 10:56:58 +03:00
Roman Gershman
082ac36ac1
fix(bug): dashtable split crashes when moving items from the old segment (#318)
fix(bug): dashtable split crashes when moving items from the old segment.

Segment's Insert function uses an opportunistic heuristic that chose a bucket with smaller items among two available.
This creates a problem with split that goes from a smaller bucket to the biggest one and moves items to the new segment.
In rare case, the heurstic fills up a the next bucket with items that could reside in earlier buckets and then that bucket
does not have space for its own items. Eventually, items that had enough space in the old segment do not find space in the new one

The fix is to adopt a conservative approach during split and try to use a home bucket first. Home bucket is usually a smaller one.
This approach should be optimal because Split starts with smaller buckets first (can be proven iteratively).

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

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2022-09-20 20:57:41 +03:00
Roman Gershman
0a1b5eb297
chore(server): rdb save can now save into tcp socket directly. (#317)
In more detail, RdbSaver uses AlignedBuffer that writes into io::Sink in chunks of 4KB.
It's great for the direct file I/O, but bad for sockets that receive blocks of 4KB with garbage
at the end. I improved the code around this and actually simplified the logic, so now AlignedBuffer
is just another Sink that is passed into serializer when writing into files. When sending to
sockets a socket sink is passed instead.

Also many other unrelated changes grouped into this pretty big cr.
1. dashtable readability improvements.
2. Move methods from facade::ConnectionContext - into facade::Service,
   make ConnectionContext a dumb object.
3. Optionally allow journal to be memory only (not backed up by a disk)
   by using a ring buffer to store last k entries in each journal slice. Also renamed
   journal_shard into journal_slice because journal has presence in each DF thread and not
   only in its shards.
4. Introduce journal::Entry that will consolidate any store change that happens in the thread.
5. Introduce GetRandomHex utility function.
6. Introduce two hooks: ServerFamily::OnClose that is called when a connection is closed,
   and ServerFamily::BreakOnShutdown that is called when process exits and any background fibers neet to
   break early.
7. Pull some noisy info logs out of rdb_load class.
8. Snapshot class now has the ability to subscribe to journal changes, thus it can include concurrent changes into the snapshot.
   Currently only journal::Op::VAL is supported (it's part of RDB format anyway).

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2022-09-20 11:09:03 +03:00
Roman Gershman
de9369f518
chore(server): update license text (#312) 2022-09-19 09:01:10 +03:00
Ryan Russell
231ef3d367
docs(src/core): readability improvements (#293)
Signed-off-by: Ryan Russell <git@ryanrussell.org>

Signed-off-by: Ryan Russell <git@ryanrussell.org>
2022-09-14 15:30:05 +03:00
Roman Gershman
4e4ed63467
feat(server): tighten memory checks when inseting a new object. (#258)
Before this change Dragonfly evicted items only when it was low on memory and had to grow its main dictionary.
It is not enough because in many cases Dragonfly can grow in memory even when the main dictionary does not grow.
For example, when its dictionary is less than 90% utilized, but the newly added objects require lots of memory.

In addition, the dashtable adds additional segments, when other segments have enough available slots to fill the rest of the free memory.

This change adds another layer of defense that allows evicting items even when dictionary segments are not full.
The eviction is still local with respect to a segment. On my tests it seems that it's much harder to cross maxmemory limit than before.

In addition, we tightened the heuristic that allowes the dashtable to grow. Now it takes into account the average bytes per item
in order to project how much memory the full table takes before adding to it new segments.
This really improves dashtable utilization.

There are still things to improve:
1. the eviction behavior is rough. Once an insert does the eviction it tries to free enough objects to bring memory back.
   This may result in very spiky insertion/eviction patterns.
2. The eviction procedure, even though it's limited to a single segment, is quite heavy because it goes over all buckets
   in the segment. This may result in weird artifacts where we evict just enough to be under the limit, then add and evict
   again and so on.
3. Therefore, we may need a periodic eviction that will compliment this emergency eviction step.

Fixes #224 and partially addresses #256

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2022-08-26 15:00:08 +03:00
Vladislav
25e700f39f
feat(server): Implement STICK command #219 (#245)
* feat(server): Implement STICK command #219

Signed-off-by: Vladislav Oleshko <vladislav.oleshko@gmail.com>
2022-08-20 16:50:43 +03:00
Roman Gershman
6b7d2a22df
chore(strings): Simplify Set flow (#164)
Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2022-06-19 23:19:42 +03:00
Ryan Russell
eae5c08e76
Improve Comment Readability (#69)
Signed-off-by: Ryan Russell <git@ryanrussell.org>
2022-05-31 23:07:00 +03:00
Roman Gershman
c7d1893478 Add more documentation about dashtable. Tune expiry heuristics a bit 2022-05-21 20:35:19 +03:00
Roman Gershman
343dd22ce5 Fixes #21.
1. Snapshot now passed db index and rdb save handles by inserting select opcodes when needed.
2. Fix few more bugs in CVCUponInsert.
3. Save lua scripts.
2022-05-20 23:25:41 +03:00
Roman Gershman
439070d00d Few improvements.
1. Stabilized naming scheme for snapshot files.
   The behavior is determined by dbfilename flag.
   By default it's 'dump'. Dragonfly checks if the flag has an extension
   if not, it automatically saves timestamped files (dump*.rdb) and loads the latest file that is available.
   In case the flag has extension like 'dump.rdb' it fallbacks to redis behavior of loading and saving to the
   same file.

2. Updated the logo url.
2022-05-19 15:50:42 +03:00
Roman Gershman
5e4aa0a1a8 Handle OOM errors for more types. Fix clang warnings and errors 2022-05-18 21:53:49 +03:00
Roman Gershman
cfaf173236 Allow cache mode - intelligent eviction of less likely to be used items.
This id one by shifting right slots in a stash bucket of the full segment.
In addition, I added eviction related stats to memory and stats section.
I also updated README with the changes. Finally, I added a flag that allows
to disable http-admin console in dragonfly.
2022-05-16 19:39:17 +03:00
Roman Gershman
038868802f Add caching mode to dragonfly - part 1.
The heart of this feature is ability to bump up entries that has been searched for.
When we bump up an entry withing a dash-table it's moved out of stash buckets or to lower slot ids
within normal buckets. The entry they replace is moved to the place of bumped-up entries.
The next change will be to implement the actual eviction heuristic that will evict keys from the stash buckets.
This will give stash buckets an addition responsibility for caching mode - they will serve as a probation buffer
that holds low-priority or newly added items.
2022-05-15 21:03:56 +03:00
Roman Gershman
6e2e5fcf67 Add support for reordering items within dash table - needed for cache evictions.
1. Simplify versioning scheme. This also reduces metadata space and increases table capacity
   for same memory reservation by ~%5.
2. Fix snapshotting bugs. Recognize duplicate keys during loading.
3. Introduce DEBUG LOAD command to perform manual loading of files.
2022-05-15 14:17:45 +03:00
Roman Gershman
2b553535b2 Upon full segment try unloading stash buckets back to regular ones 2022-05-12 13:43:03 +03:00
Roman Gershman
bc92ace19c Add safe cursor API to dash table 2022-04-14 21:31:31 +03:00
Roman Gershman
8054ed4f3a Implement directory shrinkage when we flush the database 2022-03-09 09:06:11 +02:00
Roman Gershman
b8521828e3 Add Dockerfile for prod container. Reorganize source tree to be docker-build friendly. 2022-02-25 10:03:42 +02:00
Renamed from core/dash_internal.h (Browse further)