Re: [HACKERS] Lazy hash table for XidInMVCCSnapshot (helps Zipfian a bit) - Mailing list pgsql-hackers

From Amit Kapila
Subject Re: [HACKERS] Lazy hash table for XidInMVCCSnapshot (helps Zipfian a bit)
Date
Msg-id CAA4eK1JxXVcXo7djDqx4+qhguv9h3fZuqBF36CBXUmJNMtjaWQ@mail.gmail.com
Whole thread Raw
In response to Re: [HACKERS] Lazy hash table for XidInMVCCSnapshot (helps Zipfian abit)  (Yura Sokolov <funny.falcon@gmail.com>)
Responses Re: [HACKERS] Lazy hash table for XidInMVCCSnapshot (helps Zipfian abit)  (Yura Sokolov <funny.falcon@gmail.com>)
List pgsql-hackers
On Sat, Mar 10, 2018 at 7:41 AM, Yura Sokolov <funny.falcon@gmail.com> wrote:
> 08.03.2018 03:42, Tomas Vondra пишет:
>> One reason against building the hash table in GetSnapshotData is that
>> we'd build it even when the snapshot is never queried. Or when it is
>> queried, but we only need to check xmin/xmax.
>
> Thank you for analyze, Tomas.
>
> Stephen is right about bug in snapmgr.c
> Attached version fixes bug, and also simplifies XidInXip a bit.
>

@@ -2167,8 +2175,7 @@ RestoreSnapshot(char *start_address)
  /* Copy SubXIDs, if present. */
  if (serialized_snapshot.subxcnt > 0)
  {
- snapshot->subxip = ((TransactionId *) (snapshot + 1)) +
- serialized_snapshot.xcnt;
+ snapshot->subxip = ((TransactionId *) (snapshot + 1)) + xcnt;
  memcpy(snapshot->subxip, serialized_xids + serialized_snapshot.xcnt,
    serialized_snapshot.subxcnt * sizeof(TransactionId));
  }


It is not clear why you want to change this in RestoreSnapshot when
nothing related is changed in SerializeSnapshot?  Can you please add
some comments to clarify it?

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


pgsql-hackers by date:

Previous
From: David Steele
Date:
Subject: Re: [PATCH] Verify Checksums during Basebackups
Next
From: Andres Freund
Date:
Subject: Re: Changing WAL Header to reduce contention duringReserveXLogInsertLocation()