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

2946 commits

Author SHA1 Message Date
Roman Gershman
40c24d2d25
fix(server): dfly_main.cc now compiled with march=core2. (#328)
Fixes #325. Apparently, before the fix AVX instructions were produced
right at the start, thus the server crashed before it
had a chance to install sigill handler.
2022-09-26 09:46:01 +03:00
Roman Gershman
0925829afb feat(server): Introduce transaction clock.
Partially implements #6.
Before, each shard lazily updated its clock used for the expiry evaluation.
Now, the clock value is set during the transaction scheduling phase and is assigned
to each transaction. From now on DbSlice methods use this value when checking whether
the entry is expired via passed DbContext argument.

Also, implemented transactionally consistent TIME command and
verify that time is the same during the transaction. See
https://ably.com/blog/redis-keys-do-not-expire-atomically for motivation.

Still have not implemented any lamport style updates for background processes
(not sure if it's the right way to proceed).
2022-09-25 23:53:08 +03:00
Roman Gershman
347a619b44 chore(redis): remove noisy warnings. 2022-09-25 07:17:35 +03:00
Vladislav
ca776119f0
fix(server): Fix ContainerEntry union initialization (#323)
Signed-off-by: Vladislav Oleshko <vlad@dragonflydb.io>

Signed-off-by: Vladislav Oleshko <vlad@dragonflydb.io>
2022-09-23 19:14:48 +03:00
Vladislav
0377481e28
feat(server): SORT command prototype (#311)
feat(server): Implement SORT

Fixes #287

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

Signed-off-by: Vladislav Oleshko <vlad@dragonflydb.io>
Co-authored-by: Vladislav Oleshko <vlad@dragonflydb.io>
2022-09-23 07:17:49 +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
Acheev Bhagat
751bcb9aec
feat(packaging): create deb packaging #249 (#313) 2022-09-20 11:10:19 +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
Boaz Sade
1733af4cf6
feat(server): bitcount commands support and unit tests
feat(server): bitcount commands support and unit tests - 

update docs/api_status.md, update license 
Partially implements #213 

Signed-off-by: Boaz Sade <boaz@dragonflydb.io>
Co-authored-by: Boaz Sade <boaz@dragonflydb.io>
2022-09-20 11:07:26 +03:00
Roman Gershman
de9369f518
chore(server): update license text (#312) 2022-09-19 09:01:10 +03:00
odedponcz
f1ee9b4b8d
feat(docs): Update broken link to grafana dashboard (#314)
Signed-off-by: Oded Poncz <oded@poncz.com>
2022-09-19 09:00:23 +03:00
Vladislav
16b6b11cf2
feat(server): Implement MOVE command (#298)
* feat(server): Implement MOVE command

Signed-off-by: Vladislav Oleshko <vlad@dragonflydb.io>
Co-authored-by: Vladislav Oleshko <vlad@dragonflydb.io>
2022-09-18 20:57:12 +03:00
Boaz Sade
1aef3c1030
feat(server): adding support for EXAT PXAT option at set command (#306)
feat(server): EXAT PXAT support changes according to code review #284

Signed-off-by: Boaz Sade <boaz@dragonflydb.io>
Co-authored-by: Boaz Sade <boaz@dragonflydb.io>
2022-09-18 19:51:54 +03:00
Tomato6966
f3ab64e645
Added more useful flags to the flags section (#305)
Signed-off-by: Tomato6966 <chris.pre03@gmail.com>
2022-09-18 16:37:24 +03:00
romange
4041b60149 chore(helm-chart): update to v0.8.0 2022-09-18 13:35:09 +00:00
Boaz Sade
6ec453a599
feat(server): adding support for bitops #213 (#295)
feat(server): bitset bitget commands - update docs/api_status.md #213

Signed-off-by: Boaz Sade <boaz@dragonflydb.io>
2022-09-18 16:20:51 +03:00
Roman Gershman
7ed808d5d0 fix(rdb): Fix RDB load bug when loading hset 2022-09-18 13:15:39 +03:00
iko1
d3c848f97a
feat(server): implement json.del command (#239) (#262)
* feat(server): implement json.del command (#239)

Signed-off-by: iko1 <me@remotecpp.dev>
2022-09-17 19:19:47 +03:00
Ryan Russell
b81634c25f
docs(server): readability cleanup (#304)
* docs: fix Daniel Lemire's name

Signed-off-by: Ryan Russell <git@ryanrussell.org>

* refactor(server): readability cleanup

Signed-off-by: Ryan Russell <git@ryanrussell.org>

* docs: actually fix the name attribution

Signed-off-by: Ryan Russell <git@ryanrussell.org>

Signed-off-by: Ryan Russell <git@ryanrussell.org>
2022-09-17 15:44:35 +03:00
Braydn
7cc761134b
fix(server): Added RDB load / save for DenseSet (#297)
Signed-off-by: Braydn <braydn.moore@uwaterloo.ca>
2022-09-14 20:09:32 +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
4522f2fdd1
chore(server): Fix clang warnings and errors (#290)
Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2022-09-14 09:05:51 +03:00
Braydn
b8d791961e
feat(core): Added DenseSet and StringSet types (#268)
* feat(core): Added DenseSet & StringSet types with docs

- Improved documentation by adding labels to chain types & pointer tagging table
- Added potential improvements to the DenseSet types in the docs
- Added excalidraw save file for future editing
- Removed ambiguous overloading types
- Renamed iterators to be more clear


* feat(core): Cleaned up DenseSet and Docs
* feat(core): Made DenseSet more ergonomic
* feat(server): Integration of DenseSet into Server

- Integrated DenseSet with CompactObj and the Set Family commands

Signed-off-by: Braydn <braydn.moore@uwaterloo.ca>
2022-09-14 08:41:54 +03:00
Vladislav
ed83b07fad
docs(api): Update api_status.md (#285)
* Update api_status.md
2022-09-13 20:13:34 +03:00
Vladislav
cb024a23ac
feat(server): Watch & Unwatch commands (#277)
* chore(server): Refactor ConnectionState & DbSlice for watched key support

* feat(server): Add WATCH & UNWATCH commands

Signed-off-by: Vladislav Oleshko <vlad@dragonflydb.io>
Co-authored-by: Vladislav Oleshko <vlad@dragonflydb.io>
2022-09-13 19:14:11 +03:00
Boaz Sade
d3359f1a0a
feat(server): support for setnx command #281 (#283)
Signed-off-by: Boaz Sade <boaz1sade@gmail.com>
2022-09-13 17:40:22 +03:00
Vladislav
add252c301
fix(server): Fix QUIT not shutting down connection (#280)
* fix(server): Fix QUIT not shutting down connection

Fixes #170
2022-09-13 05:25:46 +03:00
odedponcz
0fbd1afa36
feat: Change tls command line argument to conform with Redis (#276)
Change tls command line argument to conform with Redis

Signed-off-by: Oded Poncz <oded@poncz.com>

Signed-off-by: Oded Poncz <oded@poncz.com>
2022-09-08 19:32:52 +03:00
romange
a793125599 chore(helm-chart): update to v0.7.0 2022-09-08 13:18:49 +00:00
Vladislav
a43badf50c
feat(core): Add lua modules (#273)
feat(server): Add modules to lua interpreter
2022-09-08 14:31:27 +03:00
Roman Gershman
cfa1265b29 fix(server): fix a potential bug of loosing changes with multiple concurrent snapshots 2022-09-08 09:01:51 +03:00
Roman Gershman
c5a7e658a1 fix(server): Fix break callback handling in case of thread migrations.
When a connection migrates to another thread, it also being handled by a different io_uring.
That means we need to cancel any pending io requests we had in the old io uring and reestablish them
in the new one.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2022-09-05 06:52:51 +03:00
Roman Gershman
14e61f532f feat(replication): Extend replication handshake protocol to support DF->DF replication.
1. Introduce REPLCONF command support.
2. Introduce DF specific DFLY SYNC command to allow multi-flow replication.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2022-09-02 16:39:53 +03:00
Roman Gershman
042800c2f4 feat(rdb): Allow producing multiple rdb files when creating a snapshot. 2022-08-30 22:41:37 +03:00
Roman Gershman
439d79f03c chore(rdb): refactor and some clean-ups of rdb code 2022-08-29 23:41:43 +03:00
Roman Gershman
ae65c489e5 docs(rdb): More work on the rdb snapshotting document.
Also add some debugging command to control the replication flow.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2022-08-28 17:27:34 +03:00
Roman Gershman
c72939d0d4 docs(rdb): Add rdbsave high level design. 2022-08-27 22:56:45 +03:00
Roman Gershman
1ed81cf61d chore(set): minor cleanups and refactorings. (#260) 2022-08-27 10:18:54 +03:00
iko1
3acb1bb704 feat(server): implement json.numincrby (#240) (#252)
* feat(server): implement json.numincrby (#240)

Signed-off-by: iko1 <me@remotecpp.dev>
2022-08-26 16:50:10 +03:00
iko1
3e3496c4bf feat(server): implement JSON.TOGGLE & JSON.ARRLEN & JSON.OBJLEN commands (#228)
feat(server): implement JSON.TOGGLE & JSON.ARRLEN & JSON.OBJLEN commands (#241)

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

Signed-off-by: iko1 <me@remotecpp.dev>
2022-08-26 16:50:10 +03:00
iko1
e4651b95dc feat(server): implement JSON.STRLEN & JSON.TYPE commands (#225)
Signed-off-by: iko1 <me@remotecpp.dev>
2022-08-26 16:50:10 +03:00
iko1
5d3e9dc82a feat(server): implement JSON.GET command (#104)
Signed-off-by: iko1 <me@remotecpp.dev>
2022-08-26 16:50:10 +03:00
Roman Gershman
847a3f183b chore(json): Add more jsoncons tests
Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2022-08-26 16:50:10 +03:00
Roman Gershman
54444bf6ca chore(json): low level parsing function
Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2022-08-26 16:50:10 +03:00
Roman Gershman
985188c8ad chore(json): Add more unit tests.
Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2022-08-26 16:50:10 +03:00
Roman Gershman
ad6e904a53 Add jsoncons library as third-party dependency 2022-08-26 16:50:10 +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
Braydn
b7f85e59a6
feat(server): Implemented periodic snapshotting (#161) (#250)
* feat(server): Implemented periodic snapshotting (#161)

* feat(test): Added the ability to specify dragonfly cli parameters on a test basis (#199)

Signed-off-by: Braydn <braydn.moore@uwaterloo.ca>

* feat(server): Implemented periodic snapshotting (#161)

Code cleanup & CONTRIBUTORS.md modifcation

Signed-off-by: Braydn <braydn.moore@uwaterloo.ca>

* feat(server): Implemented periodic snapshotting (#161)

Parsing and race condition fixes. Improved pytests

Signed-off-by: Braydn <braydn.moore@uwaterloo.ca>

* feat(test): Cleaned up pytest code & added documentation (#199)

- Moved tests into their own file
- Renamed test namespace to avoid naming conflicts with pytest
- Updated requirements.txt to make test environment reproducible
- Added documentation to write tests

feat(server): Updated helio submodule

Signed-off-by: Braydn <braydn.moore@uwaterloo.ca>

Signed-off-by: Braydn <braydn.moore@uwaterloo.ca>
Co-authored-by: Braydn <braydnmoore3@gmail.com>
2022-08-26 13:54:38 +03:00
Roman Gershman
c49e88899b docs(server): Start DF shared nothing design document. 2022-08-20 21:38:33 +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