Hi,

We currently provide no way to learn about a postgres instance having
corruption than searching the logs for corruption events than matching by
sqlstate, for ERRCODE_DATA_CORRUPTED and ERRCODE_INDEX_CORRUPTED.

Unfortunately, there is a case of such an sqlstate that's not at all indicating
corruption, namely REINDEX CONCURRENTLY when the index is invalid:

                        if (!indexRelation->rd_index->indisvalid)
                            ereport(WARNING,
                                    (errcode(ERRCODE_INDEX_CORRUPTED),
                                     errmsg("cannot reindex invalid index 
\"%s.%s\" concurrently, skipping",
                                            
get_namespace_name(get_rel_namespace(cellOid)),
                                            get_rel_name(cellOid))));

The only thing required to get to this is an interrupted CREATE INDEX
CONCURRENTLY, which I don't think can be fairly characterized as "corruption".

ISTM something like ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE would be more
appropriate?

Greetings,

Andres Freund


Reply via email to