198 lines
9.6 KiB
Plaintext
198 lines
9.6 KiB
Plaintext
CREATE EXTENSION test_resowner;
|
|
-- This is small enough that everything fits in the small array
|
|
SELECT test_resowner_priorities(2, 3);
|
|
NOTICE: releasing resources before locks
|
|
NOTICE: releasing string: child before locks priority 1
|
|
NOTICE: releasing string: child before locks priority 1
|
|
NOTICE: releasing string: child before locks priority 2
|
|
NOTICE: releasing string: parent before locks priority 1
|
|
NOTICE: releasing string: parent before locks priority 1
|
|
NOTICE: releasing string: parent before locks priority 2
|
|
NOTICE: releasing locks
|
|
NOTICE: releasing resources after locks
|
|
NOTICE: releasing string: child after locks priority 1
|
|
NOTICE: releasing string: child after locks priority 1
|
|
NOTICE: releasing string: child after locks priority 2
|
|
NOTICE: releasing string: parent after locks priority 1
|
|
NOTICE: releasing string: parent after locks priority 1
|
|
NOTICE: releasing string: parent after locks priority 2
|
|
test_resowner_priorities
|
|
--------------------------
|
|
|
|
(1 row)
|
|
|
|
-- Same test with more resources, to exercise the hash table
|
|
SELECT test_resowner_priorities(2, 32);
|
|
NOTICE: releasing resources before locks
|
|
NOTICE: releasing string: child before locks priority 1
|
|
NOTICE: releasing string: child before locks priority 1
|
|
NOTICE: releasing string: child before locks priority 1
|
|
NOTICE: releasing string: child before locks priority 1
|
|
NOTICE: releasing string: child before locks priority 1
|
|
NOTICE: releasing string: child before locks priority 1
|
|
NOTICE: releasing string: child before locks priority 1
|
|
NOTICE: releasing string: child before locks priority 1
|
|
NOTICE: releasing string: child before locks priority 1
|
|
NOTICE: releasing string: child before locks priority 1
|
|
NOTICE: releasing string: child before locks priority 1
|
|
NOTICE: releasing string: child before locks priority 1
|
|
NOTICE: releasing string: child before locks priority 1
|
|
NOTICE: releasing string: child before locks priority 1
|
|
NOTICE: releasing string: child before locks priority 1
|
|
NOTICE: releasing string: child before locks priority 1
|
|
NOTICE: releasing string: child before locks priority 2
|
|
NOTICE: releasing string: child before locks priority 2
|
|
NOTICE: releasing string: child before locks priority 2
|
|
NOTICE: releasing string: child before locks priority 2
|
|
NOTICE: releasing string: child before locks priority 2
|
|
NOTICE: releasing string: child before locks priority 2
|
|
NOTICE: releasing string: child before locks priority 2
|
|
NOTICE: releasing string: child before locks priority 2
|
|
NOTICE: releasing string: child before locks priority 2
|
|
NOTICE: releasing string: child before locks priority 2
|
|
NOTICE: releasing string: child before locks priority 2
|
|
NOTICE: releasing string: child before locks priority 2
|
|
NOTICE: releasing string: child before locks priority 2
|
|
NOTICE: releasing string: child before locks priority 2
|
|
NOTICE: releasing string: child before locks priority 2
|
|
NOTICE: releasing string: child before locks priority 2
|
|
NOTICE: releasing string: parent before locks priority 1
|
|
NOTICE: releasing string: parent before locks priority 1
|
|
NOTICE: releasing string: parent before locks priority 1
|
|
NOTICE: releasing string: parent before locks priority 1
|
|
NOTICE: releasing string: parent before locks priority 1
|
|
NOTICE: releasing string: parent before locks priority 1
|
|
NOTICE: releasing string: parent before locks priority 1
|
|
NOTICE: releasing string: parent before locks priority 1
|
|
NOTICE: releasing string: parent before locks priority 1
|
|
NOTICE: releasing string: parent before locks priority 1
|
|
NOTICE: releasing string: parent before locks priority 1
|
|
NOTICE: releasing string: parent before locks priority 1
|
|
NOTICE: releasing string: parent before locks priority 1
|
|
NOTICE: releasing string: parent before locks priority 1
|
|
NOTICE: releasing string: parent before locks priority 1
|
|
NOTICE: releasing string: parent before locks priority 1
|
|
NOTICE: releasing string: parent before locks priority 2
|
|
NOTICE: releasing string: parent before locks priority 2
|
|
NOTICE: releasing string: parent before locks priority 2
|
|
NOTICE: releasing string: parent before locks priority 2
|
|
NOTICE: releasing string: parent before locks priority 2
|
|
NOTICE: releasing string: parent before locks priority 2
|
|
NOTICE: releasing string: parent before locks priority 2
|
|
NOTICE: releasing string: parent before locks priority 2
|
|
NOTICE: releasing string: parent before locks priority 2
|
|
NOTICE: releasing string: parent before locks priority 2
|
|
NOTICE: releasing string: parent before locks priority 2
|
|
NOTICE: releasing string: parent before locks priority 2
|
|
NOTICE: releasing string: parent before locks priority 2
|
|
NOTICE: releasing string: parent before locks priority 2
|
|
NOTICE: releasing string: parent before locks priority 2
|
|
NOTICE: releasing string: parent before locks priority 2
|
|
NOTICE: releasing locks
|
|
NOTICE: releasing resources after locks
|
|
NOTICE: releasing string: child after locks priority 1
|
|
NOTICE: releasing string: child after locks priority 1
|
|
NOTICE: releasing string: child after locks priority 1
|
|
NOTICE: releasing string: child after locks priority 1
|
|
NOTICE: releasing string: child after locks priority 1
|
|
NOTICE: releasing string: child after locks priority 1
|
|
NOTICE: releasing string: child after locks priority 1
|
|
NOTICE: releasing string: child after locks priority 1
|
|
NOTICE: releasing string: child after locks priority 1
|
|
NOTICE: releasing string: child after locks priority 1
|
|
NOTICE: releasing string: child after locks priority 1
|
|
NOTICE: releasing string: child after locks priority 1
|
|
NOTICE: releasing string: child after locks priority 1
|
|
NOTICE: releasing string: child after locks priority 1
|
|
NOTICE: releasing string: child after locks priority 1
|
|
NOTICE: releasing string: child after locks priority 1
|
|
NOTICE: releasing string: child after locks priority 2
|
|
NOTICE: releasing string: child after locks priority 2
|
|
NOTICE: releasing string: child after locks priority 2
|
|
NOTICE: releasing string: child after locks priority 2
|
|
NOTICE: releasing string: child after locks priority 2
|
|
NOTICE: releasing string: child after locks priority 2
|
|
NOTICE: releasing string: child after locks priority 2
|
|
NOTICE: releasing string: child after locks priority 2
|
|
NOTICE: releasing string: child after locks priority 2
|
|
NOTICE: releasing string: child after locks priority 2
|
|
NOTICE: releasing string: child after locks priority 2
|
|
NOTICE: releasing string: child after locks priority 2
|
|
NOTICE: releasing string: child after locks priority 2
|
|
NOTICE: releasing string: child after locks priority 2
|
|
NOTICE: releasing string: child after locks priority 2
|
|
NOTICE: releasing string: child after locks priority 2
|
|
NOTICE: releasing string: parent after locks priority 1
|
|
NOTICE: releasing string: parent after locks priority 1
|
|
NOTICE: releasing string: parent after locks priority 1
|
|
NOTICE: releasing string: parent after locks priority 1
|
|
NOTICE: releasing string: parent after locks priority 1
|
|
NOTICE: releasing string: parent after locks priority 1
|
|
NOTICE: releasing string: parent after locks priority 1
|
|
NOTICE: releasing string: parent after locks priority 1
|
|
NOTICE: releasing string: parent after locks priority 1
|
|
NOTICE: releasing string: parent after locks priority 1
|
|
NOTICE: releasing string: parent after locks priority 1
|
|
NOTICE: releasing string: parent after locks priority 1
|
|
NOTICE: releasing string: parent after locks priority 1
|
|
NOTICE: releasing string: parent after locks priority 1
|
|
NOTICE: releasing string: parent after locks priority 1
|
|
NOTICE: releasing string: parent after locks priority 1
|
|
NOTICE: releasing string: parent after locks priority 2
|
|
NOTICE: releasing string: parent after locks priority 2
|
|
NOTICE: releasing string: parent after locks priority 2
|
|
NOTICE: releasing string: parent after locks priority 2
|
|
NOTICE: releasing string: parent after locks priority 2
|
|
NOTICE: releasing string: parent after locks priority 2
|
|
NOTICE: releasing string: parent after locks priority 2
|
|
NOTICE: releasing string: parent after locks priority 2
|
|
NOTICE: releasing string: parent after locks priority 2
|
|
NOTICE: releasing string: parent after locks priority 2
|
|
NOTICE: releasing string: parent after locks priority 2
|
|
NOTICE: releasing string: parent after locks priority 2
|
|
NOTICE: releasing string: parent after locks priority 2
|
|
NOTICE: releasing string: parent after locks priority 2
|
|
NOTICE: releasing string: parent after locks priority 2
|
|
NOTICE: releasing string: parent after locks priority 2
|
|
test_resowner_priorities
|
|
--------------------------
|
|
|
|
(1 row)
|
|
|
|
-- Basic test with lots more resources, to test extending the hash table
|
|
SELECT test_resowner_many(
|
|
3, -- # of different resource kinds
|
|
100000, -- before-locks resources to remember
|
|
500, -- before-locks resources to forget
|
|
100000, -- after-locks resources to remember
|
|
500 -- after-locks resources to forget
|
|
);
|
|
NOTICE: remembering 100000 before-locks resources
|
|
NOTICE: remembering 100000 after-locks resources
|
|
NOTICE: forgetting 500 before-locks resources
|
|
NOTICE: forgetting 500 after-locks resources
|
|
NOTICE: releasing resources before locks
|
|
NOTICE: releasing locks
|
|
NOTICE: releasing resources after locks
|
|
test_resowner_many
|
|
--------------------
|
|
|
|
(1 row)
|
|
|
|
-- Test resource leak warning
|
|
SELECT test_resowner_leak();
|
|
WARNING: resource was not closed: test string "my string"
|
|
NOTICE: releasing string: my string
|
|
test_resowner_leak
|
|
--------------------
|
|
|
|
(1 row)
|
|
|
|
-- Negative tests, using a resource owner after release-phase has started.
|
|
set client_min_messages='warning'; -- order between ERROR and NOTICE varies
|
|
SELECT test_resowner_remember_between_phases();
|
|
ERROR: ResourceOwnerEnlarge called after release started
|
|
SELECT test_resowner_forget_between_phases();
|
|
ERROR: ResourceOwnerForget called for test resource after release started
|
|
reset client_min_messages;
|