mirror of
https://github.com/postgres/postgres.git
synced 2025-11-04 20:11:56 +03:00
Index SLRUs by 64-bit integers rather than by 32-bit integers
We've had repeated bugs in the area of handling SLRU wraparound in the past, some of which have caused data loss. Switching to an indexing system for SLRUs that does not wrap around should allow us to get rid of a whole bunch of problems and improve the overall reliability of the system. This particular patch however only changes the indexing and doesn't address the wraparound per se. This is going to be done in the following patches. Author: Maxim Orlov, Aleksander Alekseev, Alexander Korotkov, Teodor Sigaev Author: Nikita Glukhov, Pavel Borisov, Yura Sokolov Reviewed-by: Jacob Champion, Heikki Linnakangas, Alexander Korotkov Reviewed-by: Japin Li, Pavel Borisov, Tom Lane, Peter Eisentraut, Andres Freund Reviewed-by: Andrey Borodin, Dilip Kumar, Aleksander Alekseev Discussion: https://postgr.es/m/CACG%3DezZe1NQSCnfHOr78AtAZxJZeCvxrts0ygrxYwe%3DpyyjVWA%40mail.gmail.com Discussion: https://postgr.es/m/CAJ7c6TPDOYBYrnCAeyndkBktO0WG2xSdYduTF0nxq%2BvfkmTF5Q%40mail.gmail.com
This commit is contained in:
@@ -437,7 +437,7 @@ static void SetPossibleUnsafeConflict(SERIALIZABLEXACT *roXact, SERIALIZABLEXACT
|
||||
static void ReleaseRWConflict(RWConflict conflict);
|
||||
static void FlagSxactUnsafe(SERIALIZABLEXACT *sxact);
|
||||
|
||||
static bool SerialPagePrecedesLogically(int page1, int page2);
|
||||
static bool SerialPagePrecedesLogically(int64 page1, int64 page2);
|
||||
static void SerialInit(void);
|
||||
static void SerialAdd(TransactionId xid, SerCommitSeqNo minConflictCommitSeqNo);
|
||||
static SerCommitSeqNo SerialGetMinConflictCommitSeqNo(TransactionId xid);
|
||||
@@ -724,7 +724,7 @@ FlagSxactUnsafe(SERIALIZABLEXACT *sxact)
|
||||
* Analogous to CLOGPagePrecedes().
|
||||
*/
|
||||
static bool
|
||||
SerialPagePrecedesLogically(int page1, int page2)
|
||||
SerialPagePrecedesLogically(int64 page1, int64 page2)
|
||||
{
|
||||
TransactionId xid1;
|
||||
TransactionId xid2;
|
||||
@@ -744,7 +744,7 @@ SerialPagePrecedesLogicallyUnitTests(void)
|
||||
{
|
||||
int per_page = SERIAL_ENTRIESPERPAGE,
|
||||
offset = per_page / 2;
|
||||
int newestPage,
|
||||
int64 newestPage,
|
||||
oldestPage,
|
||||
headPage,
|
||||
targetPage;
|
||||
@@ -809,7 +809,8 @@ SerialInit(void)
|
||||
SerialSlruCtl->PagePrecedes = SerialPagePrecedesLogically;
|
||||
SimpleLruInit(SerialSlruCtl, "Serial",
|
||||
NUM_SERIAL_BUFFERS, 0, SerialSLRULock, "pg_serial",
|
||||
LWTRANCHE_SERIAL_BUFFER, SYNC_HANDLER_NONE);
|
||||
LWTRANCHE_SERIAL_BUFFER, SYNC_HANDLER_NONE,
|
||||
false);
|
||||
#ifdef USE_ASSERT_CHECKING
|
||||
SerialPagePrecedesLogicallyUnitTests();
|
||||
#endif
|
||||
@@ -842,9 +843,9 @@ static void
|
||||
SerialAdd(TransactionId xid, SerCommitSeqNo minConflictCommitSeqNo)
|
||||
{
|
||||
TransactionId tailXid;
|
||||
int targetPage;
|
||||
int64 targetPage;
|
||||
int slotno;
|
||||
int firstZeroPage;
|
||||
int64 firstZeroPage;
|
||||
bool isNewPage;
|
||||
|
||||
Assert(TransactionIdIsValid(xid));
|
||||
|
||||
Reference in New Issue
Block a user