Few comments on commit 857f9c36 (skip full index scans ) - Mailing list pgsql-hackers

From Amit Kapila
Subject Few comments on commit 857f9c36 (skip full index scans )
Date
Msg-id CAA4eK1JdS2AZbcYtcR8rFzRZe3ONozyEN-Y79Toqj39s3B9Tjg@mail.gmail.com
Whole thread Raw
Responses Re: Few comments on commit 857f9c36 (skip full index scans )  (Alexander Korotkov <a.korotkov@postgrespro.ru>)
Re: Few comments on commit 857f9c36 (skip full index scans )  (Masahiko Sawada <sawada.mshk@gmail.com>)
Re: Few comments on commit 857f9c36 (skip full index scans )  (Teodor Sigaev <teodor@sigaev.ru>)
List pgsql-hackers
Hi,

Review comments on commit 857f9c36:
1.
@@ -2049,6 +2055,10 @@ _bt_newroot(Relation rel, Buffer lbuf, Buffer rbuf)
    metapg = BufferGetPage(metabuf);
    metad = BTPageGetMeta(metapg);

+   /* upgrade metapage if needed */
+   if (metad->btm_version < BTREE_VERSION)
+       _bt_upgrademetapage(metapg);
+

The metapage upgrade should be performed under critical section.

2.
@@ -191,6 +304,10 @@ _bt_getroot(Relation rel, int access)
        LockBuffer(metabuf, BUFFER_LOCK_UNLOCK);
        LockBuffer(metabuf, BT_WRITE);

+       /* upgrade metapage if needed */
+       if (metad->btm_version < BTREE_VERSION)
+           _bt_upgrademetapage(metapg);
+

Same as above.

In other cases like _bt_insertonpg, the upgrade is done inside the
critical section.  It seems the above cases are missed.

3.
+   TransactionId btm_oldest_btpo_xact; /* oldest btpo_xact among of
+                                        * deleted pages */

/among of/among all

Attached patch to fix the above comments.

-- 
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com

Attachment

pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: Keeping temporary tables in shared buffers
Next
From: Michael Paquier
Date:
Subject: Re: pg_replication_slot_advance to return NULL instead of 0/0 ifslot not advanced