Commit a75a72a
committed
Node: Add Multi-Database Support for Cluster Mode (Valkey 9.0) (#4657)
* - Implement database selection for cluster clients when database_id != 0
- Send SELECT command to all cluster nodes using MultiNode routing
- Add comprehensive error handling with clear error messages
- Include test for database selection error handling in cluster mode
- Support backward compatibility with servers that don't support multi-db cluster mode
- Enable cluster-databases=16 for Valkey 9.0+ in cluster manager
This enables cluster clients to work with non-default databases on Valkey 9.0+
servers configured with cluster-databases support, while gracefully handling
older servers that don't support this feature.
Signed-off-by: affonsov <67347924+affonsov@users.noreply.github.com>
* update valkey9 multi db tests
Signed-off-by: affonsov <67347924+affonsov@users.noreply.github.com>
* fix lint
Signed-off-by: affonsov <67347924+affonsov@users.noreply.github.com>
* fixing valkey 9 cluster tests
Signed-off-by: affonsov <67347924+affonsov@users.noreply.github.com>
* add to route to all nodes in the core
Signed-off-by: affonsov <67347924+affonsov@users.noreply.github.com>
* rust lint fix
Signed-off-by: affonsov <67347924+affonsov@users.noreply.github.com>
* implement database selection in cluster mode via connection parameters
- Add database_id field to ClusterParams and BuilderParams structs
- Add database() method to ClusterClientBuilder for setting database ID
- Pass database_id through connection info instead of post-connection SELECT
- Remove SELECT command from cluster routing
- Remove post-connection SELECT command logic from create_cluster_client
- Add comprehensive tests for database isolation and reconnection behavior
- Verify database ID persistence across node reconnections
- Test multi-database cluster support with proper isolation verification
This change moves database selection from a post-connection SELECT command
to a connection parameter, which is more reliable for cluster mode and
handles reconnections automatically. The approach works with servers that
support multi-database cluster configurations (like Valkey 9.0+).
Signed-off-by: affonsov <67347924+affonsov@users.noreply.github.com>
* add valkey9 constraint in the core tests
Signed-off-by: affonsov <67347924+affonsov@users.noreply.github.com>
* fix core test not skipping test when version was lower than valkey 9
Signed-off-by: affonsov <67347924+affonsov@users.noreply.github.com>
* Fix version check
Signed-off-by: affonsov <67347924+affonsov@users.noreply.github.com>
* refactored test test_set_database_id_after_reconnection to be similar from standalone
removed is_valkey_9_or_higher
Signed-off-by: affonsov <67347924+affonsov@users.noreply.github.com>
* removed tests and cleanup
Signed-off-by: affonsov <67347924+affonsov@users.noreply.github.com>
* renamed builder.database to builder.database_id
Signed-off-by: affonsov <67347924+affonsov@users.noreply.github.com>
* node changes
Signed-off-by: affonsov <67347924+affonsov@users.noreply.github.com>
* move tests to sharedtests.ts
Signed-off-by: affonsov <67347924+affonsov@users.noreply.github.com>
* reafactoring to select to all nodes being in the core
Signed-off-by: affonsov <67347924+affonsov@users.noreply.github.com>
* node: Remove SELECT command support from cluster client
- Remove select() method from GlideClusterClient
- Remove createSelect import from cluster client
- Remove extensive test coverage for SELECT functionality
- Remove database ID validation tests from client internals
- Add minimal database ID test for cluster client configuration
- Clean up ConfigurationError import that's no longer needed
This change removes the SELECT command implementation that was added
for Valkey 9.0+ cluster support, likely due to reliability concerns
with database switching in cluster mode or to simplify the API.
Signed-off-by: affonsov <67347924+affonsov@users.noreply.github.com>
* added changelog
Signed-off-by: affonsov <67347924+affonsov@users.noreply.github.com>
* fix test, and removed comment
Signed-off-by: affonsov <67347924+affonsov@users.noreply.github.com>
---------
Signed-off-by: affonsov <67347924+affonsov@users.noreply.github.com>1 parent 8342c16 commit a75a72a
File tree
6 files changed
+97
-14
lines changed- node
- src
- tests
6 files changed
+97
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
563 | 563 | | |
564 | 564 | | |
565 | 565 | | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
566 | 573 | | |
567 | 574 | | |
568 | 575 | | |
| |||
610 | 617 | | |
611 | 618 | | |
612 | 619 | | |
| 620 | + | |
613 | 621 | | |
614 | 622 | | |
615 | 623 | | |
| |||
655 | 663 | | |
656 | 664 | | |
657 | 665 | | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
658 | 693 | | |
659 | 694 | | |
660 | 695 | | |
| |||
1164 | 1199 | | |
1165 | 1200 | | |
1166 | 1201 | | |
1167 | | - | |
1168 | | - | |
1169 | | - | |
1170 | 1202 | | |
1171 | 1203 | | |
1172 | 1204 | | |
1173 | 1205 | | |
1174 | 1206 | | |
1175 | 1207 | | |
| 1208 | + | |
1176 | 1209 | | |
1177 | 1210 | | |
1178 | 1211 | | |
| |||
8952 | 8985 | | |
8953 | 8986 | | |
8954 | 8987 | | |
| 8988 | + | |
8955 | 8989 | | |
8956 | 8990 | | |
8957 | 8991 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4384 | 4384 | | |
4385 | 4385 | | |
4386 | 4386 | | |
| 4387 | + | |
| 4388 | + | |
| 4389 | + | |
| 4390 | + | |
| 4391 | + | |
| 4392 | + | |
| 4393 | + | |
| 4394 | + | |
4387 | 4395 | | |
4388 | 4396 | | |
4389 | 4397 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
105 | | - | |
| 105 | + | |
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
111 | | - | |
| 111 | + | |
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
117 | | - | |
| 117 | + | |
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
| |||
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | 130 | | |
135 | 131 | | |
136 | 132 | | |
| |||
173 | 169 | | |
174 | 170 | | |
175 | 171 | | |
176 | | - | |
177 | 172 | | |
178 | 173 | | |
179 | 174 | | |
| |||
409 | 404 | | |
410 | 405 | | |
411 | 406 | | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
412 | 422 | | |
413 | 423 | | |
414 | 424 | | |
415 | 425 | | |
416 | 426 | | |
417 | 427 | | |
418 | 428 | | |
419 | | - | |
| 429 | + | |
420 | 430 | | |
421 | 431 | | |
| 432 | + | |
422 | 433 | | |
423 | 434 | | |
424 | 435 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
166 | 166 | | |
167 | 167 | | |
168 | 168 | | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
169 | 174 | | |
170 | 175 | | |
171 | 176 | | |
| |||
544 | 549 | | |
545 | 550 | | |
546 | 551 | | |
547 | | - | |
| 552 | + | |
548 | 553 | | |
549 | 554 | | |
550 | 555 | | |
551 | 556 | | |
552 | | - | |
| 557 | + | |
553 | 558 | | |
554 | 559 | | |
555 | 560 | | |
| |||
561 | 566 | | |
562 | 567 | | |
563 | 568 | | |
| 569 | + | |
564 | 570 | | |
565 | 571 | | |
566 | 572 | | |
| |||
589 | 595 | | |
590 | 596 | | |
591 | 597 | | |
| 598 | + | |
592 | 599 | | |
593 | 600 | | |
594 | 601 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2868 | 2868 | | |
2869 | 2869 | | |
2870 | 2870 | | |
| 2871 | + | |
| 2872 | + | |
| 2873 | + | |
| 2874 | + | |
| 2875 | + | |
| 2876 | + | |
| 2877 | + | |
| 2878 | + | |
| 2879 | + | |
| 2880 | + | |
| 2881 | + | |
| 2882 | + | |
| 2883 | + | |
| 2884 | + | |
| 2885 | + | |
| 2886 | + | |
| 2887 | + | |
| 2888 | + | |
| 2889 | + | |
| 2890 | + | |
| 2891 | + | |
| 2892 | + | |
2871 | 2893 | | |
0 commit comments