Re: [HACKERS] SERIALIZABLE with parallel query - Mailing list pgsql-hackers

From Haribabu Kommi
Subject Re: [HACKERS] SERIALIZABLE with parallel query
Date
Msg-id CAJrrPGdMtQNd2yc4gD38byXQ+MdVEjHbonovQk1iD6+LvTLNBw@mail.gmail.com
Whole thread Raw
In response to Re: [HACKERS] SERIALIZABLE with parallel query  (Thomas Munro <thomas.munro@enterprisedb.com>)
Responses Re: [HACKERS] SERIALIZABLE with parallel query  (Thomas Munro <thomas.munro@enterprisedb.com>)
List pgsql-hackers


On Tue, Sep 19, 2017 at 11:42 AM, Thomas Munro <thomas.munro@enterprisedb.com> wrote:
On Fri, Sep 1, 2017 at 5:11 PM, Thomas Munro
<thomas.munro@enterprisedb.com> wrote:
> On Wed, Jun 28, 2017 at 11:21 AM, Thomas Munro
> <thomas.munro@enterprisedb.com> wrote:
>> [ssi-parallel-v5.patch]
>
> Rebased.

Rebased again.

During testing of this patch, I found some behavior difference
with the support of parallel query, while experimenting with the provided
test case in the patch.

But I tested the V6 patch, and I don't think that this version contains
any fixes other than rebase.

Test steps:

CREATE TABLE bank_account (id TEXT PRIMARY KEY, balance DECIMAL NOT NULL);
INSERT INTO bank_account (id, balance) VALUES ('X', 0), ('Y', 0);

Session -1:

BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
SELECT balance FROM bank_account WHERE id = 'Y';

Session -2:

BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
SET max_parallel_workers_per_gather = 2;
SET force_parallel_mode = on;
set parallel_setup_cost = 0;
set parallel_tuple_cost = 0;
set min_parallel_table_scan_size = 0;
set enable_indexscan = off;
set enable_bitmapscan = off;

SELECT balance FROM bank_account WHERE id = 'X';

Session -1:

update bank_account set balance = 10 where id = 'X';

Session -2:

update bank_account set balance = 10 where id = 'Y';
ERROR:  could not serialize access due to read/write dependencies among transactions
DETAIL:  Reason code: Canceled on identification as a pivot, during write.
HINT:  The transaction might succeed if retried.

Without the parallel query of select statement in session-2,
the update statement in session-2 is passed.

 
Regards,
Hari Babu
Fujitsu Australia

pgsql-hackers by date:

Previous
From: Masahiko Sawada
Date:
Subject: Re: [HACKERS] pgbench: Skipping the creating primary keys after initialization
Next
From: Andres Freund
Date:
Subject: Re: [HACKERS] Statement timeout behavior in extended queries