pg_dump: Dumping the contents of table “_hyper_3_833_chunk” failed: PQgetResult() failed.
pg_dump: Error message from server: ERROR: missing chunk number 0 for toast value 10775681 in pg_toast_10749695
pg_dump: The command was: COPY _timescaledb_internal._hyper_3_833_chunk (request_time, request_id, widget_id, dashboard_id, username, query, result_size) TO stdout;
pg_dumpall: pg_dump failed on database “some_db”, exiting
vacuum full doesnt repair
INFO: vacuuming “_timescaledb_internal._hyper_3_833_chunk”
ERROR: missing chunk number 0 for toast value 10775681 in pg_toast_10749695
Hello @Pawel_S, here is a small function that can potentially help you to find the corrupted records:
CREATE OR REPLACE FUNCTION cache_read_corruption_check()
RETURNS bool LANGUAGE plpgsql AS $$
DECLARE
v_row record;
found_error bool = false;
BEGIN
FOR v_row IN SELECT * FROM cache_read order by 1 asc
LOOP
BEGIN
perform length(v_row.bio); -- using the toast triggers the error
EXCEPTION WHEN internal_error OR data_corrupted OR index_corrupted THEN
RAISE NOTICE 'failed to work with the toast of id: % - %', v_row.id, v_row.ctid;
found_error = true;
END;
END LOOP;
RETURN found_error;
END $$;
It can probably help you to find the remaining records.
SQL Error [42703]: ERROR: record “v_row” has no field “bio”
Where: SQL statement “SELECT length(v_row.bio)”
PL/pgSQL function cache_read_corruption_check() line 9 at PERFORM
FYI. cache_read has 12909888 records
corupted data are in this segment request_time > ‘2023-01-24 14:41:02.559 +0100’ and request_time < ‘2023-01-24 14:52:38.831 +0100’;
Recently I’ve have found another corrupted data and delete it.
Quering suspicious area of data without error
select * from cache_read where request_time > ‘2023-01-23 14:41:02.559 +0100’
backup has been successfuly created. It seems that issue was not related with timescaledb. Abut anyway thanks for help. Closing …
Hello!
I haven’t tried my chunky tool on Timesscaledb, and I haven’t had to.
Since Timescaledb is an extension for Postgres, I think that my utility will also work with Timescaledb.