From a273c2567fc6bab92b0268c5ebc584ffecf53e3a Mon Sep 17 00:00:00 2001 From: Don Hardman Date: Wed, 4 Dec 2024 15:13:59 +0700 Subject: [PATCH] Use system tables for sharding --- src/Plugin/Sharding/CreateHandler.php | 2 +- src/Plugin/Sharding/DropHandler.php | 2 +- src/Plugin/Sharding/Queue.php | 2 +- src/Plugin/Sharding/State.php | 2 +- src/Plugin/Sharding/Table.php | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Plugin/Sharding/CreateHandler.php b/src/Plugin/Sharding/CreateHandler.php index 0913387b..26ab9db4 100644 --- a/src/Plugin/Sharding/CreateHandler.php +++ b/src/Plugin/Sharding/CreateHandler.php @@ -150,7 +150,7 @@ protected static function getShardingFn(): Closure { $timeout = $payload->getShardingTimeout(); while (true) { // TODO: think about the way to refactor it and remove duplication - $q = "select value[0] as value from _sharding_state where `key` = 'table:{$payload->table}'"; + $q = "select value[0] as value from system.sharding_state where `key` = 'table:{$payload->table}'"; $resp = $client->sendRequest($q); $result = $resp->getResult(); /** @var array{0:array{data?:array{0:array{value:string}}}} $result */ diff --git a/src/Plugin/Sharding/DropHandler.php b/src/Plugin/Sharding/DropHandler.php index 221860bd..c417ef23 100644 --- a/src/Plugin/Sharding/DropHandler.php +++ b/src/Plugin/Sharding/DropHandler.php @@ -120,7 +120,7 @@ protected function validate(): ?Task { */ protected function getTableState(string $table): array { // TODO: think about the way to refactor it and remove duplication - $q = "select value[0] as value from _sharding_state where `key` = 'table:{$table}'"; + $q = "select value[0] as value from system.sharding_state where `key` = 'table:{$table}'"; $resp = $this->manticoreClient->sendRequest($q); /** @var array{0:array{data?:array{0:array{value:string}}}} $result */ diff --git a/src/Plugin/Sharding/Queue.php b/src/Plugin/Sharding/Queue.php index c9adfe76..3ba6cee9 100644 --- a/src/Plugin/Sharding/Queue.php +++ b/src/Plugin/Sharding/Queue.php @@ -35,7 +35,7 @@ public function __construct( protected Cluster $cluster, protected Client $client ) { - $this->table = '_sharding_queue'; + $this->table = 'system.sharding_queue'; } /** diff --git a/src/Plugin/Sharding/State.php b/src/Plugin/Sharding/State.php index 3ca4cef8..12ce293c 100644 --- a/src/Plugin/Sharding/State.php +++ b/src/Plugin/Sharding/State.php @@ -25,7 +25,7 @@ final class State { public function __construct( protected Client $client ) { - $this->table = '_sharding_state'; + $this->table = 'system.sharding_state'; } /** diff --git a/src/Plugin/Sharding/Table.php b/src/Plugin/Sharding/Table.php index 0e082c29..798bf4a7 100644 --- a/src/Plugin/Sharding/Table.php +++ b/src/Plugin/Sharding/Table.php @@ -27,7 +27,7 @@ public function __construct( protected readonly string $structure, protected readonly string $extra ) { - $this->table = '_sharding_table'; + $this->table = 'system.sharding_table'; } /**