Commit graph

75 commits

Author SHA1 Message Date
Vladislav
e45c1e92a2
chore: Refactor string span management (#3165)
Signed-off-by: Vladislav Oleshko <vlad@dragonflydb.io>
2024-06-18 10:37:32 +03:00
Vladislav
c08719117c
feat(json): MSET (#3167)
Signed-off-by: Vladislav Oleshko <vlad@dragonflydb.io>
2024-06-13 12:33:24 +03:00
Roman Gershman
9f09104c61
chore: get rid of kv_args and replace it with slices to full_args (#3101)
* Revert "Revert "chore: get rid of kv_args and replace it with slices to full_… (#3024)"

This reverts commit 25e6930ac3.

Fixing the performance bug caused by applying equality operator
on two spans inside ShardArgs::Iterator::operator==

---------

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-06-05 14:25:26 +03:00
Roman Gershman
8721ca7fca
chore: add half-range indices (#3041)
Add indices in form of [:end] or [start:]
Also, enable jsonpathv2 by default

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-05-13 10:30:58 +03:00
Roman Gershman
25e6930ac3
Revert "chore: get rid of kv_args and replace it with slices to full_… (#3024)
Revert "chore: get rid of kv_args and replace it with slices to full_args (#2942)"

This reverts commit de0e5cb0bd.
2024-05-08 03:01:37 +03:00
Roman Gershman
de0e5cb0bd
chore: get rid of kv_args and replace it with slices to full_args (#2942)
The main change is in tx_base.* where we introduce ShardArgs slice that
is only forward iterable. It allows us to go over sub-ranges of the full arguments
slice or read an index of any of its elements.

Since ShardArgs provide now indices into the original argument list we do not need to build the reverse index in transactions.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-05-06 15:53:30 +03:00
Roman Gershman
9bda5b1d4b
chore: another preparation commit to get rid of kv_args in transaction (#2996)
This changes Entry::Payload to struct instead of variant.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-05-02 09:59:45 +03:00
Roman Gershman
b7686f26a5
feat: implement json.merge (#2960)
feat: json.merge

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-04-29 23:40:38 +03:00
adiholden
d5cd0ed204
fixes for v1.18.0 (#2956)
* fix server: change table_growth_margin default value

---------

Signed-off-by: adi_holden <adi@dragonflydb.io>
2024-04-24 18:21:14 +03:00
Roman Gershman
89b1d7d52a
chore: Introduce ShardArgs as a distinct type (#2952)
Done in preparation to make ShardArgs a smart iterable type,
but currently it's just a wrapper aroung ArgSlice.
Also refactored common.{h,cc} into tx_base.{h,cc}

In addition, fixed a bug in key tracking, where we wrongly created weak_ref
in a shard thread instead of doing this in the coordinator thread.
Finally, identified another bug (not fixed yet) where we track all the arguments
instead of tracking keys only.

Besides this, no functional changes around the moved code.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-04-24 13:36:34 +03:00
Roman Gershman
3d609504d0
chore: adjust transaction code to keystep/3 commands (#2941) 2024-04-21 14:20:57 +00:00
Kostas Kyrimis
ccffc14419
fix(json): make path optional in json.objkeys (#2872)
* make path optional in json.objkeys
2024-04-09 18:54:12 +03:00
Shahar Mike
54c9633cb8
feat(dbslice): Add self-laundering iterator in DbSlice (#2815)
A self-laundering iterator will enable us to, eventually, yield from fibers while holding an iterator. For example:

```cpp
auto it1 = db_slice.Find(...);
Yield();  // Until now - this could have invalidated `it1`
auto it2 = db_slice.Find(...);
```

Why is this a good idea? Because it will enable yielding inside PreUpdate() which will allow breaking down of writing huge entries in small quantities to disk/network, eliminating the need to allocate huge chunks of memory just for serialization.

Also, it'll probably unlock future developments as well, as yielding can be useful in other contexts.
2024-04-09 12:00:52 +03:00
Roman Gershman
c8426cfd31
chore: implement path mutation for JsonFlat (#2805)
* chore: implement path mutation for JsonFlat

This is done by converting the flat blob into mutable c++ json
and then building a new flat blob.

Also, add JsonFlat encoding to CompactObject class.
---------

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-04-04 17:33:56 +00:00
Vladislav
1ec603e568
chore: Support json paths without root selector (#2747)
* chore: Support json paths without root selector

---------

Signed-off-by: Vladislav Oleshko <vlad@dragonflydb.io>
2024-03-19 21:09:52 +03: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
Roman Gershman
91c299b33e
chore: Del and NUMINCRBY use json::Path (#2655)
* chore: Del and NUMINCRBY use json::Path

Also, fix various protocol bugs when we sent simple string
instead of sending bulk strings.

Fixed a typo in path.cc that lead to a data race bug.

Finally, flip the flag in regression tests to start covering json::Path code
and added test coverage for the data race bug

---------

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-02-26 14:06:21 +00:00
Roman Gershman
d54b600f31
chore: switch to self-built flatbuffers (#2657)
* chore: switch to self-built flatbuffers

This should solve the linker errors on MacOs build.

---------

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-02-26 10:03:17 +02:00
Roman Gershman
050649d762
chore: fully switch to dual parsing with json::Path (#2654)
Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-02-24 13:26:31 +02:00
Roman Gershman
2b30f69fe3
chore: JSON.GET now works with our own jsonpath (#2653) 2024-02-24 13:23:41 +02:00
Roman Gershman
bcae2dfb46
a test with flat buffers (#2520)
feat: a test with flat buffers

Also, add an experimental flag `--experimental_flat_json` that allows writing json objects as flat strings using
flexibuffers.

The experiment shows that `debug populate 100000 a 10 type json elements 30`
uses almost 3 times less memory than with native jsoncons objects.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-02-23 13:53:41 +02:00
Roman Gershman
cbfd5bb7c5
chore: doc_accessors now parse with json::Path as well (#2615)
chore: replace search path parsing with json::Path

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-02-20 19:58:22 +02:00
Roman Gershman
fa75360227
chore: get rid of object.c and robj* in cc code (#2610)
Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-02-18 16:52:23 +02:00
Roman Gershman
750f039316
Add mutate method to jsonpath (#2606)
* Add mutate method to jsonpath

Plug it in into OpToggle op.

---------

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-02-18 16:06:33 +02:00
Roman Gershman
d802a2181a
chore: consolidate json code under core/json (#2609)
Fix linker dependencies - now dfly_core depends on jsonpath.
jsonpath does not depend on CompactObject anymore.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-02-18 09:22:34 +00:00
Roman Gershman
888a437bf5
wire json::Path into json_family (#2587)
* feat: wire json::Path into the server

The feature is disabled under a flag and it covers read operations for now.
---------

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-02-15 17:05:53 +00:00
Roman Gershman
ea5955962e
chore: switch json object to pmr allocator (#2483)
* chore: switch json object to pmr allocator

1. Move json object creation code to the shard-thread inside rdb_load
2. Now json_family never references "json" type, always dfly::JsonType
3. Switch JsonType to pmr::json.
4. Make sure we pass the correct memory_resource when creating json object from string.

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

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-01-26 12:47:46 +02:00
Kostas Kyrimis
517be2005e
refactor: return OpResult in DbSlice::AddOrFind instead of throwing std::bad_alloc (#2427)
* return OpResult in AddOrFind instead of throwing bad_alloc
* small refactor
2024-01-23 14:16:03 +02:00
Kostas Kyrimis
39e7e5ad87
fix: missing error reply to client after AddOrFind throw std::bad_alloc (#2411)
* Handle properly and reply on execution paths that throw std::bad_alloc within AddOrFind
2024-01-15 10:13:10 +02:00
Shahar Mike
0e4d76cc96
refactor(DbSlice): Replace FindExt() with FindMutable() and FindReadOnly (#2308)
* refactor(DbSlice): Replace `FindExt()` with `FindMutable()` and `FindReadOnly`

* fix

* `ExpireConstIterator`

* Don't update stats on FindMutable()

* auto&

* ReadOnly

* Remove redundant call

* move() before

* Remove redundant post_updater

* Update comment
2023-12-20 08:04:39 +02:00
Shahar Mike
dcedd1645e
feat(server): Convert DbSlice's AddOr* to return AutoUpdater (#2290)
* fix(server): Use AutoUpdater with AddOr* methods

* Remove explicit calls

* `operator=`

* return *this

* PostUpdate twice

* exp it

* bitops

* remove explicit `Run()`

* Explicitly `delete` copy ops

* Remove `AddOrSkip()`
2023-12-17 15:00:10 +02:00
Roman Gershman
d88b2422de
chore: eliminate most of clang++ warnings (#2288)
Not all of them but 90% is done.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2023-12-11 12:47:53 +02:00
Shahar Mike
1ce3f983c9
WIP: Auto PostUpdate() (#2268)
* WIP: Auto `PostUpdate()`

* More `Find()` uses

* Final touches

* Fixes

* Fix bug and allow reassigning

* Rename to AutoUpdater

* Fix and add DCHECK

* Also check deletion count

* Use ccache instead of sccache

* Try to upgrade Helio

* off64_t

* off64_t

* Revert changes to CI
2023-12-11 10:07:53 +02:00
Roman Gershman
ff562897eb
fix: accept '-' character when parsing json fields (#2271)
Fixes #2265
Also switch to our own fork of jsoncons instead of using patches.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2023-12-10 09:32:52 +02:00
Borys
33d0879416
refactor: conn_context and reply_builder refactoring (#2251)
* refactor: conn_context and reply_builder refactoring
2023-12-06 08:23:32 +02:00
Roman Gershman
7d53d196aa
chore: improve performance of mget operation (#2212)
Specifically, allocate only a single blob when returning multiple entries from a shard.
In addition, refactor and unify MGetResponse between string family code and ReplyBuilder code.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2023-11-24 14:13:07 +02:00
Vladislav
27dcec38ee
fix(json): fix json dot path (#2186)
* fix(json): fix json dot path

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

---------

Signed-off-by: Vladislav Oleshko <vlad@dragonflydb.io>
2023-11-17 22:32:16 +03:00
Roman Gershman
4201ac416e
chore: remove Command step argument (#2150)
It will be represented via INTERLEAVED_KEYS option.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2023-11-10 19:10:56 +02:00
iko1
1dbaab564a
fix: set the key index within the json.debug command (#1932)
* fix: set the key index within the json.debug command

Signed-off-by: iko1 <me@remotecpp.dev>
2023-09-26 12:39:42 +03:00
iko1
19783face5
feat(json): support JSON.GET pretty print options (#1832)
* parse json.get pretty print options

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

* finalize json.get sub args
* set indent size to 1 & add unit tests cases

---------

Signed-off-by: iko1 <me@remotecpp.dev>
2023-09-24 17:40:13 +03:00
Uku Loskit
7a5fe1adc1
fix: fix json.arrappend not allowing passing JSON objects (#1867)
Signed-off-by: Uku Loskit <ukuloskit@gmail.com>
2023-09-16 12:27:20 +03:00
Kostas Kyrimis
bbd4c6b636
feat(AclFamily): add acl commands (#1844) 2023-09-15 14:28:36 +03:00
Kostas Kyrimis
cfc04cf952
chore: add acl categories to all commands (#1711)
1. Add acl categories to each command
2. Extend `facade::CommandId` to include acl category
3. Add dragonfly extensions to acl categories for modules like search, json etc (since modules in redis do not have acl categories by default but in dragonfly these are not implemented as modules)
2023-08-20 13:27:14 +03:00
adiholden
3565e80924
fix(server): update denyoom flag for all commands (#1651)
update denyoom flag for all commands
DENYOOM command flag marks which commands will be denied when memory usage crosses the "red zone".

Signed-off-by: adi_holden <adi@dragonflydb.io>
2023-08-09 09:42:26 +03:00
iko1
37eedd4c8b
chore: update jsoncons dependency (#1066)
* chore: update jsoncons dependency

* fix: remove unused test case

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

* initial attempt to create custom memory allocator test

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

* chore: update jsoncons dependency

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

* chore: update jsoncons dependency

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

---------

Signed-off-by: iko1 <me@remotecpp.dev>
2023-07-11 10:17:22 +03:00
Vladislav
dc5ec628e5
fix: support json v1 dot path (#1462)
Signed-off-by: Vladislav Oleshko <vlad@dragonflydb.io>
2023-06-22 14:38:30 +03:00
Vladislav
f97dbad6f9
feat: track update and delete for search (#1325)
Automatically update search indices

---------

Signed-off-by: Vladislav Oleshko <vlad@dragonflydb.io>
2023-06-12 11:43:30 +03:00
iko1
c2d32f9d68
fix(server): json.set should add missing keys and add missing cmd... (#1065)
fix(server): json.set should add missing keys and add missing command flags

Signed-off-by: iko1 <me@remotecpp.dev>
2023-04-20 11:20:00 +03:00
Vladislav
a12ddfe108
Remove cmd name from args (#1057)
chore: remove cmd name from the list of arguments

Signed-off-by: Vladislav Oleshko <vlad@dragonflydb.io>
Co-authored-by: Roman Gershman <roman@dragonflydb.io>
2023-04-10 14:14:52 +03:00
iko1
04f4362c72
fix(server): fix JSON.MGET implementation (#849) (#876)
fix(server): fix json.mget implementation (#849)

Signed-off-by: iko1 <me@remotecpp.dev>
2023-03-03 00:16:35 +02:00