]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Fix some minor issues in repack ereport()s
authorÁlvaro Herrera <alvherre@kurilemu.de>
Thu, 28 May 2026 14:46:12 +0000 (16:46 +0200)
committerÁlvaro Herrera <alvherre@kurilemu.de>
Thu, 28 May 2026 14:46:12 +0000 (16:46 +0200)
A few of them were missing errcode(), and a couple could use some
wordsmithing.

Author: Baji Shaik <baji.pgdev@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Discussion: https://postgr.es/m/CA+fm-ROdgh0rEVuXoViBk4TVgjodrN=MTR_RYuOuKLZ9voX4YA@mail.gmail.com

src/backend/commands/repack.c
src/backend/commands/repack_worker.c

index c5d85eced483c0513c8762111df137121028fdf4..94f2eaa23461202e078f92509b418de1a6a34282 100644 (file)
@@ -2581,7 +2581,7 @@ apply_concurrent_changes(BufFile *file, ChangeContext *chgcxt)
                        /* Find the tuple to be deleted */
                        found = find_target_tuple(rel, chgcxt, spilled_tuple, ondisk_tuple);
                        if (!found)
-                               elog(ERROR, "failed to find target tuple");
+                               elog(ERROR, "could not find target tuple");
                        apply_concurrent_delete(rel, ondisk_tuple);
                }
                else if (kind == CHANGE_UPDATE_NEW)
@@ -2597,7 +2597,7 @@ apply_concurrent_changes(BufFile *file, ChangeContext *chgcxt)
                        /* Find the tuple to be updated or deleted. */
                        found = find_target_tuple(rel, chgcxt, key, ondisk_tuple);
                        if (!found)
-                               elog(ERROR, "failed to find target tuple");
+                               elog(ERROR, "could not find target tuple");
 
                        /*
                         * If 'tup' contains TOAST pointers, they point to the old
@@ -2674,7 +2674,9 @@ apply_concurrent_update(Relation rel, TupleTableSlot *spilled_tuple,
                                                         &tmfd, &lockmode, &update_indexes);
        if (res != TM_Ok)
                ereport(ERROR,
-                               errmsg("failed to apply concurrent UPDATE"));
+                               errcode(ERRCODE_T_R_SERIALIZATION_FAILURE),
+                               errmsg("could not apply concurrent %s on relation \"%s\"",
+                                          "UPDATE", RelationGetRelationName(rel)));
 
        if (update_indexes != TU_None)
        {
@@ -2710,7 +2712,9 @@ apply_concurrent_delete(Relation rel, TupleTableSlot *slot)
 
        if (res != TM_Ok)
                ereport(ERROR,
-                               errmsg("failed to apply concurrent DELETE"));
+                               errcode(ERRCODE_T_R_SERIALIZATION_FAILURE),
+                               errmsg("could not apply concurrent %s on relation \"%s\"",
+                                          "DELETE", RelationGetRelationName(rel)));
 
        pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3005,7 +3009,7 @@ initialize_change_context(ChangeContext *chgcxt,
                }
        }
        if (chgcxt->cc_ident_index == NULL)
-               elog(ERROR, "failed to find identity index");
+               elog(ERROR, "could not find identity index");
 
        /* Set up for scanning said identity index */
        {
index 4f82eb46bec479fb37445083192f5ebf0bf9cfd6..ddf070eae0727fab1c9ec7b3728792728b4c0cc8 100644 (file)
@@ -432,6 +432,7 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
                                priv->end_of_wal = false;
                        else
                                ereport(ERROR,
+                                               errcode(ERRCODE_DATA_CORRUPTED),
                                                errmsg("could not read WAL record"));
                }
 
@@ -479,6 +480,7 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
                        if (res != WAIT_LSN_RESULT_SUCCESS &&
                                res != WAIT_LSN_RESULT_TIMEOUT)
                                ereport(ERROR,
+                                               errcode(ERRCODE_INTERNAL_ERROR),
                                                errmsg("waiting for WAL failed"));
                }
        }