InvalidShardedQueryException.php 1.0 KB

1234567891011121314151617181920212223242526272829
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-only
  6. */
  7. namespace OC\DB\QueryBuilder\Sharded;
  8. /**
  9. * Queries on sharded table has the following limitations:
  10. *
  11. * 1. Either the shard key (e.g. "storage") or primary key (e.g. "fileid") must be mentioned in the query.
  12. * Or the query must be explicitly marked as running across all shards.
  13. *
  14. * For queries where it isn't possible to set one of these keys in the query normally, you can set it using `hintShardKey`
  15. *
  16. * 2. Insert statements must always explicitly set the shard key
  17. * 3. A query on a sharded table is not allowed to join on the same table
  18. * 4. Right joins are not allowed on sharded tables
  19. * 5. Updating the shard key where the new shard key maps to a different shard is not allowed
  20. *
  21. * Moving rows to a different shard needs to be implemented manually. `CrossShardMoveHelper` provides
  22. * some tools to help make this easier.
  23. */
  24. class InvalidShardedQueryException extends \Exception {
  25. }