pg.ddx.io pgsql-jdbc@postgresql.org mailing list archivehelp / color / mirror / Atom feed
temp table problem due to thread concurrency ( ERROR: could not open file "base/ ) ? 2+ messages / 2 participants [nested] [flat]
* temp table problem due to thread concurrency ( ERROR: could not open file "base/ ) ? @ 2014-05-07 15:45 Jan-Peter Seifert <Jan-Peter.Seifert@gmx.de> 2014-05-07 18:13 ` Re: temp table problem due to thread concurrency ( ERROR: could not open file "base/ ) ? David G Johnston <david.g.johnston@gmail.com> 0 siblings, 1 reply; 2+ messages in thread From: Jan-Peter Seifert @ 2014-05-07 15:45 UTC (permalink / raw) To: pgsql-jdbc <html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div class="signature">Hello,</div> <div class="signature"> </div> <div class="signature">a 'bulk loading' routine using temporary tables suddenly failed during tests for no obvious reasons. At some point one of the updates on the temporary table fails with the error message "ERROR: could not open file "base/...".</div> <div class="signature"> </div> <div class="signature">-Execute is used for executing the statements.</div> <div class="signature">-Autocommit mode is used because of possible large load size.</div> <div class="signature">-At the beginning of a load script another script drops all temporary tables - using a select on pg_tables for getting the table names.</div> <div class="signature">-Then 'normal' temporary tables (with no 'ON COMMIT DROP') with a fixed name are created and filled via insert first - followed by several updates. One of those updates fails.</div> <div class="signature"> </div> <div class="signature">An strace revealed that another process dropped the temporary table in question before the failing update - most likely the drop script. This also happens when in the same transaction. Additionally we used ON COMMIT DROP and DISCARD TEMP and DISCARD PLANS instead of dropping all temporary tables. However, DISCARD TEMP obviously blocks the INSERT when within a transaction.</div> <div class="signature"> </div> <div class="signature">Removing the drop script and dropping the temporary tables created at the beginning of the load at the end seems to help or am I mistaken?</div> <div class="signature"> </div> <div class="signature">So is every 'JDBC' execute using its own thread/process? If so is there a way to force them to execute in succession and not in parallel/concurrently?</div> <div class="signature"> </div> <div class="signature">Could you tell me, please?</div> <div class="signature"> </div> <div class="signature">Thank you very much!</div> <div class="signature"> </div> <div class="signature">Best wishes,</div> <div class="signature"> </div> <div class="signature">Peter</div> <div class="signature"> </div> <div class="signature"> </div> <div class="signature"> </div> <div class="signature"> </div> <div class="signature"> </div></div></body></html> ^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: temp table problem due to thread concurrency ( ERROR: could not open file "base/ ) ? 2014-05-07 15:45 temp table problem due to thread concurrency ( ERROR: could not open file "base/ ) ? Jan-Peter Seifert <Jan-Peter.Seifert@gmx.de> @ 2014-05-07 18:13 ` David G Johnston <david.g.johnston@gmail.com> 0 siblings, 0 replies; 2+ messages in thread From: David G Johnston @ 2014-05-07 18:13 UTC (permalink / raw) To: pgsql-jdbc Why cannot you just: Open Connection Begin; Create TEMP Tables Do stuff with TEMP Tables Commit; Close Connection (auto-drops TEMP tables) Also, figuring out if you code is broken is much easier if we can actually see the code; describing it only in plain English doesn't usually result in people providing useful answers. Both code and description are usually needed. Temporary tables are session-local and so as long as you do not actively share a connection dropping temporary tables and these kinds of concurrency errors should be impossible. Since you are seeing them, and you feel the need to drop temporary tables, either you are doing things wrong or at minimum doing unnecessary work. Server processes (PostgreSQL is process, not thread, based) are connection (and thus session) oriented. Client threads/processes are whatever you tell your code to do; connections themselves are not inherently thread-safe so if you are multi-threading and sharing connections you are doing something highly discouraged and, given the errors, are doing so incorrectly. David J. -- View this message in context: http://postgresql.1045698.n5.nabble.com/temp-table-problem-due-to-thread-concurrency-ERROR-could-not... Sent from the PostgreSQL - jdbc mailing list archive at Nabble.com. -- Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-jdbc ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2014-05-07 18:13 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2014-05-07 15:45 temp table problem due to thread concurrency ( ERROR: could not open file "base/ ) ? Jan-Peter Seifert <Jan-Peter.Seifert@gmx.de> 2014-05-07 18:13 ` David G Johnston <david.g.johnston@gmail.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox