Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use correct errorCode for the errors thrown during recovery #7146

Merged
merged 1 commit into from
Aug 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/backend/distributed/commands/multi_copy.c
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,8 @@
*/
if (RecoveryInProgress() && WritableStandbyCoordinator)
{
ereport(ERROR, (errmsg("COPY command to Citus tables is not allowed in "
ereport(ERROR, (errcode(ERRCODE_READ_ONLY_SQL_TRANSACTION),

Check warning on line 428 in src/backend/distributed/commands/multi_copy.c

View check run for this annotation

Codecov / codecov/patch

src/backend/distributed/commands/multi_copy.c#L428

Added line #L428 was not covered by tests
errmsg("COPY command to Citus tables is not allowed in "
"read-only mode"),
errhint("All COPY commands to citus tables happen via 2PC, "
"and 2PC requires the database to be in a writable state."),
Expand Down
6 changes: 4 additions & 2 deletions src/backend/distributed/metadata/metadata_cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,8 @@
{
if (RecoveryInProgress() && !WritableStandbyCoordinator)
{
ereport(ERROR, (errmsg("writing to worker nodes is not currently allowed"),
ereport(ERROR, (errcode(ERRCODE_READ_ONLY_SQL_TRANSACTION),

Check warning on line 357 in src/backend/distributed/metadata/metadata_cache.c

View check run for this annotation

Codecov / codecov/patch

src/backend/distributed/metadata/metadata_cache.c#L357

Added line #L357 was not covered by tests
errmsg("writing to worker nodes is not currently allowed"),
errdetail("the database is read-only")));
}

Expand Down Expand Up @@ -415,7 +416,8 @@

if (modifiedTableReplicated)
{
ereport(ERROR, (errmsg("writing to worker nodes is not currently "
ereport(ERROR, (errcode(ERRCODE_READ_ONLY_SQL_TRANSACTION),

Check warning on line 419 in src/backend/distributed/metadata/metadata_cache.c

View check run for this annotation

Codecov / codecov/patch

src/backend/distributed/metadata/metadata_cache.c#L419

Added line #L419 was not covered by tests
errmsg("writing to worker nodes is not currently "
"allowed for replicated tables such as reference "
"tables or hash distributed tables with replication "
"factor greater than 1."),
Expand Down