Commit Graph

157 Commits (368e4dbb745603d14d67cd2fc4b4899e930274fe)

Author SHA1 Message Date
Burak Velioglu 368e4dbb74
Move truncate trigger 2022-01-22 23:51:23 +03:00
Burak Velioglu bee36628a1
Use GetFullTableCreationCommands 2022-01-22 22:47:53 +03:00
Burak Velioglu 3bb1a1fe6c
Merge branch 'master' into velioglu/table_wo_seq_prototype 2022-01-21 01:09:20 +03:00
Burak Velioglu 0932ea9a46
Address reviews 2022-01-20 14:19:09 +03:00
Teja Mupparti 54862f8c22 (1) Functions will be delegated even when present in the scope of an explicit
BEGIN/COMMIT transaction block or in a UDF calling another UDF.
(2) Prohibit/Limit the delegated function not to do a 2PC (or any work on a
remote connection).
(3) Have a safety net to ensure the (2) i.e. we should block the connections
from the delegated procedure or make sure that no 2PC happens on the node.
(4) Such delegated functions are restricted to use only the distributed argument
value.

Note: To limit the scope of the project we are considering only Functions(not
procedures) for the initial work.

DESCRIPTION: Introduce a new flag "force_delegation" in create_distributed_function(),
which will allow a function to be delegated in an explicit transaction block.

Fixes #3265

Once the function is delegated to the worker, on that node during the planning

distributed_planner()
TryToDelegateFunctionCall()
CheckDelegatedFunctionExecution()
EnableInForceDelegatedFuncExecution()
Save the distribution argument (Constant)
ExecutorStart()
CitusBeginScan()
IsShardKeyValueAllowed()
Ensure to not use non-distribution argument.

ExecutorRun()
AdaptiveExecutor()
StartDistributedExecution()
EnsureNoRemoteExecutionFromWorkers()
Ensure all the shards are local to the node in the remoteTaskList.
NonPushableInsertSelectExecScan()
InitializeCopyShardState()
EnsureNoRemoteExecutionFromWorkers()
Ensure all the shards are local to the node in the placementList.

This also fixes a minor issue: Properly handle expressions+parameters in distribution arguments
2022-01-19 16:43:33 -08:00
Burak Velioglu ea3063e6d2
Check extension owner once 2022-01-20 01:58:32 +03:00
Burak Velioglu 05b4711962
Use function to get inter table relation 2022-01-20 01:47:37 +03:00
Burak Velioglu 3dbaf5886b
Address reviews 2022-01-20 01:17:26 +03:00
Burak Velioglu d93b46559e
Rename metadata to node metadata on multiple points 2022-01-20 01:02:58 +03:00
Burak Velioglu 09cfb24b16
Update should sync check
src/backend/distributed/test/distributed_intermediate_results-29ca979d.o.tmp
2022-01-20 00:31:06 +03:00
Burak Velioglu 97a1720a17
Address reviews 2022-01-19 23:31:14 +03:00
Burak Velioglu 065db645b9
Move table related part out from metadata 2022-01-19 14:27:13 +03:00
Burak Velioglu 7b84c72aae
Address reviews 2022-01-19 11:26:12 +03:00
Burak Velioglu 9e81344eaa
Fix metadata sync 2022-01-17 23:41:56 +03:00
Burak Velioglu 1f83607224
Comment out master_create_dist_table check 2022-01-17 17:13:27 +03:00
Burak Velioglu 4dab78a55a
Minor updates 2022-01-17 16:40:50 +03:00
Burak Velioglu 5d1eae732c
Update metadata sync function names 2022-01-17 15:02:53 +03:00
Burak Velioglu 381871890f
Move DetachPartitionCommandList back 2022-01-16 21:20:39 +03:00
Burak Velioglu e107fb7519
Move DistributedObjectMetadataSyncCommandList back 2022-01-16 21:02:16 +03:00
Burak Velioglu 04511cc5e0
Adress reviews 2022-01-16 16:44:21 +03:00
Burak Velioglu 5e2e5c3470
Fix indentation for shell table func 2022-01-16 16:24:59 +03:00
Burak Velioglu 02526f1bee
Minor refactors 2022-01-13 01:01:47 +03:00
Burak Velioglu ad67942cda
Sequence and add node fix 2022-01-12 15:24:09 +03:00
Burak Velioglu 36fb662bf4
Merge branch 'master' into velioglu/table_wo_seq_prototype 2022-01-07 12:43:35 +03:00
Ahmet Gedemenli 45e423136c
Support foreign tables in MX (#5461) 2022-01-06 18:50:34 +03:00
Önder Kalacı 5305aa4246
Do not drop sequences when dropping metadata (#5584)
Dropping sequences means we need to recreate
and hence losing the sequence.

With this commit, we keep the existing sequences
such that resyncing wouldn't drop the sequence.

We do that by breaking the dependency of the sequence
from the table.
2022-01-06 09:48:34 +01:00
Burak Velioglu 299043dfaa
Update activate node 2022-01-05 16:33:11 +03:00
Burak Velioglu e610a147a1
Remove unnecessary comments on tests 2021-12-28 11:37:02 +03:00
Burak Velioglu ab29b939b2
Indentation fix 2021-12-20 12:39:03 +03:00
Burak Velioglu b9d1ab38af
Move shell table creation out 2021-12-18 21:28:24 +03:00
Burak Velioglu f66b1d5116
Fix list creation 2021-12-17 17:17:49 +03:00
Burak Velioglu 3636b7c9c5
Start handling local tables 2021-12-16 14:57:46 +03:00
Burak Velioglu a6cdd43d42
Fix metadata changes and use same connection for all 2021-12-16 00:04:53 +03:00
Burak Velioglu fea68a43ad
Start moving table dependent metadata 2021-12-15 18:04:59 +03:00
Burak Velioglu 14f8cd5a75
Handle sequences 2021-12-10 17:57:19 +03:00
Burak Velioglu 5762bfb454
Shell table work prototype 2021-12-09 12:09:32 +03:00
Burak Velioglu 21194c3b9d
Mark sequence distributed explicitly while syncing metadata
Since sequences are not marked as distributed while creating table if no
metadata worker node exists, we are marking all sequences distributed
while syncing metadata explicitly.
2021-12-06 19:25:51 +03:00
Burak Velioglu ed8e32de5e
Sync pg_dist_object on an update and propagate while syncing to a new node
Before that PR we were updating citus.pg_dist_object metadata, which keeps
the metadata related to objects on Citus, only on the coordinator node. In
order to allow using those object from worker nodes (or erroring out with
proper error message) we've started to propagate that metedata to worker
nodes as well.
2021-12-06 19:25:50 +03:00
Onder Kalaci d405993b57 Make sure to use a dedicated metadata connection
With this commit, we make sure to use a dedicated connection per
node for all the metadata operations within the same transaction.

This is needed because the same metadata (e.g., metadata includes
the distributed table on the workers) can be modified accross
multiple connections.

With this connection we guarantee that there is a single metadata connection.
But note that this connection can be used for any other operation.
In other words, this connection is not only reserved for metadata
operations.
2021-11-26 14:36:28 +01:00
Onder Kalaci 121f5c4271 Active placements can only be on active nodes
We re-define the meaning of active shard placement. It used
to only be defined via shardstate == SHARD_STATE_ACTIVE.

Now, we also add one more check. The worker node that the
placement is on should be active as well.

This is a preparation for supporting citus_disable_node()
for MX with multiple failures at the same time.

With this change, the maintanince daemon only needs to
sync the "node metadata" (e.g., pg_dist_node), not the
shard metadata.
2021-11-26 09:14:33 +01:00
Hanefi Onaldi c0d43d4905
Prevent cache usage on citus_drop_trigger codepaths 2021-11-18 20:24:51 +03:00
Marco Slot 9e6ca23286 Remove cstore_fdw-related logic 2021-11-16 13:59:03 +01:00
Önder Kalacı 8c0bc94b51
Enable replication factor > 1 in metadata syncing (#5392)
- [x] Add some more regression test coverage
- [x] Make sure returning works fine in case of
     local execution + remote execution
     (task->partiallyLocalOrRemote works as expected, already added tests)
- [x] Implement locking properly (and add isolation tests)
     - [x] We do #shardcount round-trips on `SerializeNonCommutativeWrites`.
           We made it a single round-trip.
- [x] Acquire locks for subselects on the workers & add isolation tests
- [x] Add a GUC to prevent modification from the workers, hence increase the
      coordinator-only throughput
       - The performance slightly drops (~%15), unless
         `citus.allow_modifications_from_workers_to_replicated_tables`
         is set to false
2021-11-15 15:10:18 +03:00
Halil Ozan Akgul c0785d570c Remove EnsureSuperUser from start and stop metadata sync to node 2021-11-01 18:01:49 +03:00
Ahmet Gedemenli 67dca4363d
Dont auto-undistribute user-added citus local tables (#5314)
* Disable auto-undistribute for user-added citus local tables
2021-10-28 12:10:26 +03:00
Philip Dubé cc50682158 Fix typos. Spurred spotting "connectios" in logs 2021-10-25 13:54:09 +00:00
Halil Ozan Akgul e3446692f3 Fix the bug by adding comma before the values 2021-10-15 18:42:23 +03:00
Ahmet Gedemenli d19793c174 Add partitioning support for citus local tables
Add/fix tests

Fix creating partitions

Add test for mx - partition creating case

Enable cascading to partitioned tables

Fix mx partition adding test

Fix cascading through fkeys

Style

Disable converting with non-inherited fkeys

Fix detach bug

Early return in case of cascade & Add tests

Style

Fix undistribute_table bug & Fix test outputs

Remove RemovePartitionRelationIds

Test with undistribute_table

Add test for mx+convert+undistribute

Remove redundant usage of CreatePartitionedCitusLocalTable

Add some comments

Introduce bulk functions for generating attach/detach partition commands

Fix: Convert partitioned tables after adding fkey

Change the error message for partitions

Introduce function ErrorIfPartitionTableAddedToMetadata

Polish attach/detach command generation functions

Use time_partitions for testing

Move mx tests to citus_local_tables_mx

Add new partitioned table to cascade test

Add test with time series management UDFs

Fix test output

Fix: Assertion fail on relation access tracking

Style

Refactor creating partitioned citus local tables

Remove CreatePartitionedCitusLocalTable

Style

Error out if converting multi-level table

Revert some old tests

Error out adding partitioned partition

Polish

Polish/address

Fix create table partition of case

Use CascadeOperationForRelationIdList if no cascade needed

Fix create partition bug

Revert / Add new tests to mx

Style

Fix dropping fkey bug

Add test with IF NOT EXISTS

Convert to CLT when doing ATTACH PARTITION

Add comments

Add more tests with time series management

Edit the error message for converting the child

Use OR instead of AND in ErrorIfUnsupportedAlterTableStmt

Edit/improve tests

Disable ddl prop when dropping default column definitions

Disable/enable ddl prop just before/after the command

Add comment

Add sequence test

Add trigger test

Remove NeedCascadeViaForeignKeys

Add one more insert to sequence test

Add comment

Style

Fix test output shard ids

Update comments

Disable creating fkey on partitions

Move partition check to CreateCitusLocalTable

Add comment

Add check for  attachingmulti-level  partition

Add test for pg_constraint

Check pg_dist_partition in tests

Add test inserting on the worker
2021-10-11 10:45:07 +03:00
Onder Kalaci cea937f52f Add missing version checks for citus_internal_XXX functions 2021-09-20 09:54:35 +02:00
Naisila Puka a69abe3be0
Fixes bug about int and smallint sequences on MX (#5254)
* Introduce worker_nextval udf for int&smallint column defaults

* Fix current tests and add new ones for worker_nextval
2021-09-09 23:41:07 +03:00