High table creation rate results in “File exists” error

From: Radek Slupik <radek(at)channable(dot)com>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: High table creation rate results in “File exists” error
Date: 2020-01-21 13:04:24
Message-ID: CAAMrnERXphFTr+6k61Bd6Q7HJ7gzSfTW=JLEtqsDATWb0JfXug@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi,

We occasionally run into an internal error when creating tables. The error
message is «could not create file "base/17006/2851173576": File exists»
with SQLSTATE 58P02. The attachment is included with this email contains
the PostgreSQL logs. Note that some identifiers are renamed in the logs
because they contain sensitive information, but identifier names are
unlikely the source of the error.

An old mailing list thread [1] suggests a problem related to OID
wraparound. Our use case involves creating and dropping thousands of tables
every day. The CREATE TABLE statements for these tables are similar to the
one in the attached logs, but with different table names and columns.
Nonetheless, the error is difficult to reproduce as it happens only
sporadically. Retrying the CREATE TABLE statement fixes the problem
temporarily.

Some more information about our PostgreSQL instance and usage:

- PostgreSQL version: PostgreSQL 10.6 (Ubuntu 10.6-1.pgdg16.04+1) on
x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 5.4.0-6ubuntu1~16.04.10) 5.4.0
20160609, 64-bit.
- The DBMS did not crash or abruptly shut down recently.
- The file base/17006/2851173576 was actually in use by an index, as
indicated by pg_class.relfilenode.
- Autovacuum is disabled for these tables. Logging is disabled for these
tables upon creation, but enabled after filling them with data.
- The query “SELECT max(oid) FROM pg_class” reports 4,294,603,797, which
is close to 2³² - 1.

Kind regards,

Radek Slupik
Channable

[1]:
https://www.postgresql.org/message-id/CAP_rwwmVcFqZJ72WkyxcFrGPY6XpDSUj_UrxfCMnRYT4hCGfBg%40mail.gmail.com

Attachment Content-Type Size
file-exists-error.log text/x-log 853 bytes

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tomas Vondra 2020-01-21 13:52:13 Re: High table creation rate results in “File exists” error
Previous Message Raúl Marín 2020-01-21 09:50:12 Re: BUG #16199: pg_restore stuck on interrupts