Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8d928e3

Browse files
committed
Rename BufferAccessStrategyData.ring_size to nbuffers
The new name better reflects what the field is - the size of the buffers[]array. ring_size sounded more like it is in units of bytes.An upcoming commit allows a BufferAccessStrategy of custom sizes, so itseems relevant to improve this beforehand.Author: Melanie PlagemanReviewed-by: David RowleyDiscussion:https://postgr.es/m/CAAKRu_YefVbhg4rAxU2frYFdTap61UftH-kUNQZBvAs%2BYK81Zg%40mail.gmail.com
1 parent4830f10 commit8d928e3

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

‎src/backend/storage/buffer/freelist.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ typedef struct BufferAccessStrategyData
7474
/* Overall strategy type */
7575
BufferAccessStrategyTypebtype;
7676
/* Number of elements in buffers[] array */
77-
intring_size;
77+
intnbuffers;
7878

7979
/*
8080
* Index of the "current" slot in the ring, ie, the one most recently
@@ -541,7 +541,7 @@ BufferAccessStrategy
541541
GetAccessStrategy(BufferAccessStrategyTypebtype)
542542
{
543543
BufferAccessStrategystrategy;
544-
intring_size;
544+
intnbuffers;
545545

546546
/*
547547
* Select ring size to use. See buffer/README for rationales.
@@ -556,13 +556,13 @@ GetAccessStrategy(BufferAccessStrategyType btype)
556556
returnNULL;
557557

558558
caseBAS_BULKREAD:
559-
ring_size=256*1024 /BLCKSZ;
559+
nbuffers=256*1024 /BLCKSZ;
560560
break;
561561
caseBAS_BULKWRITE:
562-
ring_size=16*1024*1024 /BLCKSZ;
562+
nbuffers=16*1024*1024 /BLCKSZ;
563563
break;
564564
caseBAS_VACUUM:
565-
ring_size=256*1024 /BLCKSZ;
565+
nbuffers=256*1024 /BLCKSZ;
566566
break;
567567

568568
default:
@@ -572,16 +572,16 @@ GetAccessStrategy(BufferAccessStrategyType btype)
572572
}
573573

574574
/* Make sure ring isn't an undue fraction of shared buffers */
575-
ring_size=Min(NBuffers /8,ring_size);
575+
nbuffers=Min(NBuffers /8,nbuffers);
576576

577577
/* Allocate the object and initialize all elements to zeroes */
578578
strategy= (BufferAccessStrategy)
579579
palloc0(offsetof(BufferAccessStrategyData,buffers)+
580-
ring_size*sizeof(Buffer));
580+
nbuffers*sizeof(Buffer));
581581

582582
/* Set fields that don't start out zero */
583583
strategy->btype=btype;
584-
strategy->ring_size=ring_size;
584+
strategy->nbuffers=nbuffers;
585585

586586
returnstrategy;
587587
}
@@ -615,7 +615,7 @@ GetBufferFromRing(BufferAccessStrategy strategy, uint32 *buf_state)
615615

616616

617617
/* Advance to next ring slot */
618-
if (++strategy->current >=strategy->ring_size)
618+
if (++strategy->current >=strategy->nbuffers)
619619
strategy->current=0;
620620

621621
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp