Commit graph

22 commits

Author SHA1 Message Date
Roman Gershman
8030ee96b5
chore: preparation step for lock fingerprints (#2899)
The main change here is introduction of the strong type LockTag
that differentiates from a string_view key.

Also, some testing improvements to improve the footprint of the next PR.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-04-16 19:23:50 +03:00
Shahar Mike
256e07f8ba
feat(server): Allow configuration of hashtag extraction (#2890)
* feat(server): Allow configuration of hashtag extraction

Before this PR: Hashtags, if enabled, meant the text between `{` and `}`
in the key (if exists and non-empty).

After this PR:

* Hashtags can _still_ be enabled / disabled
* Hashtag open / close char can be specified (and can be the same), like `:` popular with BullMQ
* Hashtag can include `N` closing tags to skip, like `{a}b}c}d` with `2` will return `a}b}c`.

This will allow some existing systems to migrate without code changes in
client code.
2024-04-14 15:09:41 +03:00
Borys
482bd58787
feat(cluster): add migration removing by config #2835 (#2844) 2024-04-05 11:03:54 +03:00
Borys
84d451fbed
fix: #2745 don't start migration process again after apply the same the same config is applied (#2822)
* fix: #2745 don't start a migration process again after the same config is applied
refactor: remove extra includes
2024-04-03 10:21:27 +03: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
Borys
8771ab32a6
refactor: create one type for slots set #2459 (#2645)
* refactor: create one type for slot ranges #2459
2024-02-23 14:10:42 +02:00
Borys
491538e170
feat(cluster): #2448 add new DFLYMIGRATE ACK cmd (#2582)
* feat(cluster): #2448 add new DFLYMIGRATE ACK cmd
2024-02-19 19:21:14 +02:00
Borys
72f651d527
feat(cluster): add slots blocking when we finalize migration (#2484)
* feat(cluster): add slots blocking when we finalize the migration
2024-02-07 15:19:35 +02:00
Roman Gershman
8f454b2dea
fix: allow lock_on_hashtags with any cluster mode (#2443)
Motivation - after we submitted #2429 some smart-ass clients
prevent users from accessing single-node commands like "SELECT".
This PR fixes it by allowing consistent sharding based on hashtags
even with cluster mode disabled.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
2024-01-19 23:44:24 +02:00
Vladislav
aaf01d4244
feat(cluster): Cancel blocking commands on cluster update (#2255)
Handle blocking commands during cluster config update

---------

Signed-off-by: Vladislav Oleshko <vlad@dragonflydb.io>
2023-12-17 15:32:35 +03:00
Shahar Mike
ef55713dfc
feat(server): Use hashtags for sharding in emulated cluster mode. (#1602)
This PR would have been 1 line change instead of 11 files, but it
required some plumbing and refactoring:
* Now ClusterConfig is aware of emulated cluster mode
* As a result, this API was moved from ClusterFamily
* And so was the flag & its parsing
* ClusterFamily doesn't need is_emulated_cluster_ member
* ServerFamily no longer needs ClusterFamily* member (because the API is
  static)
* I also changed `ClusterConfig::IsClusterEnabled()` to
  `ClusterConfig::IsEnabled()` to be shorter
2023-07-31 13:55:47 +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
Chaka
14e9ba4849
fix(cluster): Fix race when setting cluster config (#1428)
* fix(cluster): Fix race when setting cluster config

* Return `shared_ptr` from Create factory function.
2023-06-19 11:24:26 +03:00
Chaka
ff338bebe2
feat(cluster): Use thread-local cluster config (#1361)
To support this, I refactored some of the code:

* We no longer have `IsConfigured()` and `SetConfig()`, now
  configuration validation is done via instantiation
* As a result, we check if `tl_cluster_config` is `nullptr` or not to
  determine whether the cluster has been configured
* Reduce the size of the config by only storing 1 bit per slot (whether it's owned locally or not)
* Pushing new configuration is done via copy-c'tor

While at it, add a small test function to remove `sleep()`s and wait in a less fragile way.

Fixes #1357
2023-06-08 15:18:06 +03:00
adiholden
3df467583f
feat(cluster): first config set drop all entries not owned by node (#1301)
* feat(cluster): first config set drop all entries not owned by node

Signed-off-by: adi_holden <adi@dragonflydb.io>
2023-05-29 11:25:21 +03:00
Chaka
db5e069412
feat(cluster): Do not allow node IDs to appear more than once. (#1271) 2023-05-22 11:09:01 +03:00
Chaka
7289a83087
feat(cluster): Implement CLUSTER INFO. (#1258)
Implementation supports 3 cases:
1. Emulated mode (as was previously implemented)
2. Non-configured cluster mode
3. Configured cluster mode
2023-05-22 09:29:06 +03:00
adiholden
31043186d3
feat(cluster): cluster config delete now owned slots data (#1241)
* feat(cluster): cluster config delete now owned slots data

Signed-off-by: adi_holden <adi@dragonflydb.io>
2023-05-21 11:29:18 +03:00
Chaka
f80afca9c2
feat(cluster): Implement DFLY CLUSTER CONFIG command. (#1223)
* fix: Lock before accessing slots_

* Implement `DFLY CLUSTER CONFIG` command.

* Move JSON parsing logic to ClusterConfig

* clang-tidy

* Rename test fixture class
2023-05-17 13:02:47 +03:00
Chaka
790e357aaf
fix: Lock before accessing slots_ (#1219) 2023-05-16 10:58:43 +03:00
Chaka
d9007eedf9
feat(server): SetConfig() for ClusterConfig. (#1202)
feat(server): SetConfig() for ClusterConfig.
2023-05-14 15:53:54 +03:00
adiholden
577472eb22
feat(cluster): check command keys ownership (#1194)
* feat(cluster): check command keys ownership on cluster mode

Signed-off-by: adi_holden <adi@dragonflydb.io>
2023-05-10 12:06:52 +03:00