Documentation
¶
Overview ¶
Package teardown drops the schema that a test or a benchmark worked in.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DropSchema ¶
DropSchema drops schema, if it exists, on a connection of pool, once the statements that the pool's users gave up have ended.
A statement whose context ended can go on in the database. Its caller has returned, so a worker that was told to stop has stopped, and the pool closes the statement's connection in the background, until the server has ended the statement. Until then the statement may take locks, in another order than a drop of its schema does, and PostgreSQL ends one of the two as a deadlock. So DropSchema first waits until the pool has closed every such connection.
The wait cannot always tell that the statements have ended: not on a pool that others use meanwhile, not after closeLimit, and not through a proxy, which closes the connection at once while the server works on. Only then, DropSchema tries a drop again that PostgreSQL ended as a deadlock, a few times. Otherwise such a deadlock is a mistake in the order of the caller's clean-up, and DropSchema returns it.
Types ¶
This section is empty.