citusdata / citusdata/citus

Copy errors out if worker fails during commit in 2PC with more than one replica

Open
#1,766 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
12.8k
Forks
794
Avg merge
2d 14h
Merged PRs (30d)
31

Description

If there are more than one replica; COPY should not error out, placement should be marked as INACTIVE but it  errors out with connection error (PQcancel) and placement is not market as inactive.
To reproduce;
```SQL
set citus.shard_replication_factor to 2;
set citus.multi_shard_commit_protocol to '2pc';

create table test(id int);
select create_distributed_table('test', 'id');
begin;
copy test from STDIN;
1
2
3
\.
```
Now you should kill one of the workers, and then
```SQL
commit;
```
the error I get is the following;
```
WARNING: 57P01: terminating connection due to unexpected postmaster exit
LOCATION: ReportResultError, remote_commands.c:289
WARNING: 01000: connection error: localhost:9701
DETAIL: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
LOCATION: ReportConnectionError, remote_commands.c:243
WARNING: 01000: failed to roll back prepared transaction 'citus_0_79544_26_94'
HINT: Run "ROLLBACK PREPARED 'citus_0_79544_26_94'" on localhost:9701
LOCATION: WarnAboutLeakedPreparedTransaction, remote_transaction.c:1277
WARNING: 01000: connection error: localhost:9701
DETAIL: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
LOCATION: ReportConnectionError, remote_commands.c:243
WARNING: 01000: failed to roll back prepared transaction 'citus_0_79544_26_96'
HINT: Run "ROLLBACK PREPARED 'citus_0_79544_26_96'" on localhost:9701
LOCATION: WarnAboutLeakedPreparedTransaction, remote_transaction.c:1277
WARNING: 01000: connection error: localhost:9701
DETAIL: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
LOCATION: ReportConnectionError, remote_commands.c:243
WARNING: 01000: failed to roll back prepared transaction 'citus_0_79544_26_99'
HINT: Run "ROLLBACK PREPARED 'citus_0_79544_26_99'" on localhost:9701
LOCATION: WarnAboutLeakedPreparedTransaction, remote_transaction.c:1277
WARNING: 01000: could not cancel connection: PQcancel() -- connect() failed: Connection refused

LOCATION: ShutdownConnection, connection_management.c:368
ERROR: XX000: failure on connection marked as essential: localhost:9701
LOCATION: MarkRemoteTransactionFailed, remote_transaction.c:652
Time: 8.787 ms
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.