Commit graph

40 commits

Author SHA1 Message Date
adiholden
2d49a28c15
fix(server): handle running script load inside multi (#4074)
Signed-off-by: adi_holden <adi@dragonflydb.io>
2024-11-10 09:34:40 +02:00
Roman Gershman
7035606b4b
chore: pass SinkReplyBuilder and Transaction explicitly. Part6 (#3987) 2024-10-24 18:47:18 +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
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
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
Shahar Mike
aa424c81af
feat: Allow pre-declaring Lua SHAs to run with undeclared keys (#3465)
* feat: Allow pre-declaring Lua SHAs to run with undeclared keys

By using `--lua_undeclared_keys_shas=SHA,SHA,SHA` users can now specify
which scripts should run globally (undeclared keys) without explicit
support from the scripts themselves.

Fixes #2442
2024-08-08 10:27:27 +03:00
Vladislav
82298b8122
fix(server): Implement SCRIPT GC command (#3431)
* fix(server): Implement SCRIPT GC command
2024-08-02 23:49:51 +03:00
Roman Gershman
55e445b511
chore: provide basic logging to catch possible command errors (#3213)
* chore: provide basic logging to catch possible command errors

---------

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-06-26 14:21:05 +03:00
Roman Gershman
5534ee5c23
chore: minor fixes (#3082)
1. script errors are now logged continously but at most 5 per second.
2. "memory arena" is introduced - it prints the arena stats per thread.
   "memory malloc-stats" now only prints the global stats.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-05-26 10:14:02 +03:00
Vladislav
1a5eacca87
chore: Pull helio with new future (#2944) 2024-04-22 20:18:10 +03:00
adiholden
7580a88ca5
feat server: bring visibility to script errors (#2879)
* feat server: bring visibility to script errorד

Signed-off-by: adi_holden <adi@dragonflydb.io>
2024-04-11 11:25:41 +03: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
Roman Gershman
908efff7bd
fix: make sure SCRIPT FLUSH concludes (#2565)
InterpreterManager::Reset creates now a new storage for interpreters,
 and waits for the old ones to be returned.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-02-09 18:55:14 +02:00
Roman Gershman
b5b5093165
fix: fix BLOCKING/REVERSE_MAPPING flags for some commands (#2516)
* fix: BLOCKING/REVERSE_MAPPING flags for some commands

Also, simplify interfaces around REVERSE_MAPPING in the internal tx code.
---------

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-02-01 15:39:14 +00:00
s-shiraki
73fe5a4eb2
fix(server): Implement SCRIPT FLUSH command (#2493)
* fix(server): Implement SCRIPT FLUSH command
2024-01-31 08:31:06 +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
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
Vladislav
769f5a19cd
feat: Span-all no-key transactional commands (#1864)
* feat: Span-all no-key transactional commands

---------

Signed-off-by: Vladislav Oleshko <vlad@dragonflydb.io>
2023-09-19 11:10:56 +03:00
Kostas Kyrimis
0f8f6f387b
feat: do not process lua script if sha exists in cache (#1537) 2023-07-12 19:31:42 +03:00
Vladislav
cfca751848
feat: global eval in exec (#1443)
Enables execution of global lua scripts inside multi/exec transactions if the defualt script config enables global execution for scripts. This change is only a fix and does not provide any safeguards against other execution scenarios (namely enabling globality with script flags). In the future, the proper execution mode should be determined more carefully by inspecting the scripts to be executed

Signed-off-by: Vladislav Oleshko <vlad@dragonflydb.io>
Co-authored-by: Kostas Kyrimis  <kostaskyrim@gmail.com>
2023-07-01 22:12:05 +03:00
Vladislav
737ca2e918 fix: script flags naming + add stick option (#1295)
Signed-off-by: Vladislav Oleshko <vlad@dragonflydb.io>
2023-06-01 15:13:14 +03:00
Vladislav
c2af5b0de1
fix: fix script body access (#1169)
Signed-off-by: Vladislav Oleshko <vlad@dragonflydb.io>
2023-05-01 20:05:18 +03:00
Vladislav
89072228e5
Detect possible async calls in scripts (#1122)
Automatically detect possible async calls for lua scripts based on regex
2023-05-01 15:03:51 +03:00
adiholden
7f56a435c4
bug(server): replicate scripts in stable state (#1114)
* bug(server): replicate scripts in stable state

---------

Signed-off-by: adi_holden <adi@dragonflydb.io>
2023-04-23 23:46:51 +03:00
Roman Gershman
c271e13176
chore: import fiber related primitives under dfly namespace (#1012)
This change removes most mentions of boost::fibers or util::fibers_ext.
Instead it introduces "core/fibers.h" file that incorporates most of
the primitives under dfly namespace. This is done in preparation to
switching from Boost.Fibers to helio native fibers.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2023-03-30 13:26:59 +03:00
Vladislav
72f67eddd8
refactor(facade): Refactor reply builder (#991)
Refactor RedisReplyBuilder to simplify method overloads
2023-03-26 12:52:40 +03:00
Roman Gershman
12abe0bc12
chore: update helio dependency (#984)
Also remove direct references for boost fibers from the code.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2023-03-24 18:04:05 +03:00
Vladislav
9f0e269a12
feat(server): Specify script flags with shebang (#944)
* feat(server): Specify script flags with shebang

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

* fix(server): Ignore erros with no-writes flag

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

---------

Signed-off-by: Vladislav Oleshko <vlad@dragonflydb.io>
2023-03-19 08:10:24 +02:00
Vladislav
149b1fa913
feat(server): Pragmas from scripts (#927)
Parse script param pragmas from script source
2023-03-12 11:05:15 +03:00
Vladislav
edbd43a3b3
Support script configuration (#889)
Store script parameters for each script that allow configuring it's transactions multi mode. They can be configured either for a specific scripts with `SCRIPT CONIFG <sha> [params...]` or changed globally as defaults with `default_lua_config`.
The current supported options are `allow-undeclared-keys` and `disable-atomicity`.  Based on those flags, we determine the correct multi mode. `disable-atomicity` allow running in non-atomic mode, whereas being atomic and enabling `allow-undeclared-keys` requires the global mode.
2023-03-01 19:17:41 +03:00
Vladislav
b2958b5381
feat(server): Pool lua interpreters (#765) 2023-02-08 14:56:32 +03:00
Roman Gershman
4c725b6654
feat(server): add latency statistics for lua script calls (#758)
Also provide new subcommands "script list" and "script latency"
Fixes #754

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2023-02-05 21:38:59 +02:00
Roman Gershman
de9369f518
chore(server): update license text (#312) 2022-09-19 09:01:10 +03:00
Roman Gershman
c23dc1c94c fix(lua): Avoid infinite loop and fix sha compatibility with redis.
Fixes #146 and fixes #147.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2022-06-13 23:32:19 +03:00
Roman Gershman
a9c0fa8ea4 Implement basic XADD, XRANGE, XLEN commands.
Covers most funvtionality for #59.
2022-06-08 22:04:49 +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
797c8121b1 Limit table growth according to maxmemory.
1. Make EngineShardSet to be a process singleton instead of a variable passed everywhere.
2. Implement a heuristic of updating free memory per shard.
3. Make sure that SET command returns OOM when a database reaches its limits.
2022-05-16 08:19:32 +03:00
Roman Gershman
5c9cee171c Add SCRIPT EXISTS subcommand 2022-04-30 16:58:36 +03:00
Roman Gershman
8a1396de31 Address HSET bugs
1. add hmset
2. hmget returns nulls when key not found
3. test for valid number of arguments in hset
2022-04-04 13:08:16 +03: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 server/script_mgr.cc (Browse further)