4

I have a Django app with a postgresql 9.3 DB (hosted on Ubuntu VM), and very recently the VM ran out of disk space (resulting in no space left on device errors showing up in my logs).

I cleared the space on the device and everything came back online.

But now, for a minority of my requests, I've started receiving a django.db.utils:DatabaseError alert, with the description failed to re-find parent key in index "links_grouptraffic_time" for split pages 24582/24583. links_grouptraffic is one of my data models, and time is an attribute within that data model.

Can someone explain the background of what this means, and a remedy for this problem? Thanks in advance!


2
  • Seems like a corrupted index. Is there anything related in the Postgres logfile? Commented Apr 20, 2016 at 7:25
  • Also, which exact version do you run? Commented Apr 20, 2016 at 7:27

1 Answer 1

8

Your database is likely corrupted, especially the indexes. You can rebuild all indexes and check all tables on a database by:

REINDEX SYSTEM; -- run once
REINDEX DATABASE <your dbname>; -- run for each database
VACUUM (FULL VERBOSE ANALYZE); -- also run for each database after reindexing
7
  • Fair enough. Although, shouldn't I just run reindex index links_grouptraffic_time, since that's the index the error relates to? Commented Apr 20, 2016 at 7:30
  • That is the error that you "stumbled upon" so far. If you used your database and ran out of space, you'll likely have similar errors in any indexes of tables updated while out of space. Commented Apr 20, 2016 at 7:32
  • I had the same error on postgres 9.6 and used these steps: reindex system <dbname>; reindex database <dbname>; vacuum (full) <dbname>; Commented Apr 1, 2019 at 11:27
  • In My case I am not able to start database. So Can I reindex?
    – Sanjay
    Commented Oct 14, 2020 at 4:06
  • 1
    @Sanjay it depends on the kind and extent of damage to your database. In order to recover information from a corrupted database, you will require some basic understanding of what are the files in a postgresql system's PGDATA folder (e.g. /var/lib/postgresql/xx/main). Your database is in base. You may be able to recover your database by saving a copy of your PGDATA folder, then reinitialise your repository (i.e. initdb), start it, create a new empty database in (e.g. CREATE DATABASE recovered), stop the service, replace the contents of that new database with your old database, then start. Commented Oct 17, 2020 at 5:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.