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

Commitdfdd59e

Browse files
Jan WieckJan Wieck
Jan Wieck
authored and
Jan Wieck
committed
Adjusted calculation of shared memory requirements to new
ARC buffer replacement strategy.Jan
1 parentcfd7fb7 commitdfdd59e

File tree

3 files changed

+56
-47
lines changed

3 files changed

+56
-47
lines changed

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/storage/buffer/buf_init.c,v 1.60 2003/12/20 17:31:21 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/storage/buffer/buf_init.c,v 1.61 2004/01/15 16:14:26 wieck Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -231,13 +231,19 @@ BufferShmemSize(void)
231231
size+=hash_estimate_size(SHMEM_INDEX_SIZE,sizeof(ShmemIndexEnt));
232232

233233
/* size of buffer descriptors */
234-
size+=MAXALIGN((NBuffers+1)*sizeof(BufferDesc));
234+
size+=MAXALIGN(NBuffers*sizeof(BufferDesc));
235+
236+
/* size of the shared replacement strategy control block */
237+
size+=MAXALIGN(sizeof(BufferStrategyControl));
238+
239+
/* size of the ARC directory blocks */
240+
size+=MAXALIGN(NBuffers*2*sizeof(BufferStrategyCDB));
235241

236242
/* size of data pages */
237243
size+=NBuffers*MAXALIGN(BLCKSZ);
238244

239245
/* size of buffer hash table */
240-
size+=hash_estimate_size(NBuffers,sizeof(BufferLookupEnt));
246+
size+=hash_estimate_size(NBuffers*2,sizeof(BufferLookupEnt));
241247

242248
returnsize;
243249
}

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

Lines changed: 1 addition & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/storage/buffer/freelist.c,v 1.38 2003/11/29 19:51:56 pgsql Exp $
11+
* $PostgreSQL: pgsql/src/backend/storage/buffer/freelist.c,v 1.39 2004/01/15 16:14:26 wieck Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -32,54 +32,13 @@
3232
#include"storage/proc.h"
3333
#include"access/xact.h"
3434

35-
#defineSTRAT_LIST_UNUSED-1
36-
#defineSTRAT_LIST_B10
37-
#defineSTRAT_LIST_T11
38-
#defineSTRAT_LIST_T22
39-
#defineSTRAT_LIST_B23
40-
#defineSTRAT_NUM_LISTS4
41-
4235
#ifndefMAX
4336
#defineMAX(a,b) (((a) > (b)) ? (a) : (b))
4437
#endif
4538
#ifndefMIN
4639
#defineMIN(a,b) (((a) < (b)) ? (a) : (b))
4740
#endif
4841

49-
/*
50-
* The Cache Directory Block (CDB) of the Adaptive Replacement Cache (ARC)
51-
*/
52-
typedefstructbufstratcdb
53-
{
54-
intprev;/* links in the queue */
55-
intnext;
56-
intlist;/* current list */
57-
BufferTagbuf_tag;/* buffer key */
58-
Bufferbuf_id;/* currently assigned data buffer */
59-
TransactionIdt1_xid;/* the xid this entry went onto T1 */
60-
}BufferStrategyCDB;
61-
62-
/*
63-
* The shared ARC control information.
64-
*/
65-
typedefstructbufstratcontrol
66-
{
67-
68-
inttarget_T1_size;/* What T1 size are we aiming for */
69-
intlistUnusedCDB;/* All unused StrategyCDB */
70-
intlistHead[STRAT_NUM_LISTS];/* ARC lists B1, T1, T2 and B2 */
71-
intlistTail[STRAT_NUM_LISTS];
72-
intlistSize[STRAT_NUM_LISTS];
73-
BufferlistFreeBuffers;/* List of unused buffers */
74-
75-
longnum_lookup;/* Some hit statistics */
76-
longnum_hit[STRAT_NUM_LISTS];
77-
time_tstat_report;
78-
79-
BufferStrategyCDBcdb[1];/* The cache directory */
80-
}BufferStrategyControl;
81-
82-
8342
staticBufferStrategyControl*StrategyControl=NULL;
8443
staticBufferStrategyCDB*StrategyCDB=NULL;
8544

‎src/include/storage/buf_internals.h

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
/*-------------------------------------------------------------------------
22
*
33
* buf_internals.h
4-
* Internal definitions for buffer manager.
4+
* Internal definitions for buffer manager and the buffer replacement
5+
* strategy.
56
*
67
*
78
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
89
* Portions Copyright (c) 1994, Regents of the University of California
910
*
10-
* $PostgreSQL: pgsql/src/include/storage/buf_internals.h,v 1.66 2003/12/14 00:34:47 neilc Exp $
11+
* $PostgreSQL: pgsql/src/include/storage/buf_internals.h,v 1.67 2004/01/15 16:14:26 wieck Exp $
1112
*
1213
*-------------------------------------------------------------------------
1314
*/
@@ -135,6 +136,49 @@ typedef struct
135136
Bufferid;
136137
}BufferLookupEnt;
137138

139+
/*
140+
* Definitions for the buffer replacement strategy
141+
*/
142+
#defineSTRAT_LIST_UNUSED-1
143+
#defineSTRAT_LIST_B10
144+
#defineSTRAT_LIST_T11
145+
#defineSTRAT_LIST_T22
146+
#defineSTRAT_LIST_B23
147+
#defineSTRAT_NUM_LISTS4
148+
149+
/*
150+
* The Cache Directory Block (CDB) of the Adaptive Replacement Cache (ARC)
151+
*/
152+
typedefstruct
153+
{
154+
intprev;/* links in the queue */
155+
intnext;
156+
intlist;/* current list */
157+
BufferTagbuf_tag;/* buffer key */
158+
Bufferbuf_id;/* currently assigned data buffer */
159+
TransactionIdt1_xid;/* the xid this entry went onto T1 */
160+
}BufferStrategyCDB;
161+
162+
/*
163+
* The shared ARC control information.
164+
*/
165+
typedefstruct
166+
{
167+
168+
inttarget_T1_size;/* What T1 size are we aiming for */
169+
intlistUnusedCDB;/* All unused StrategyCDB */
170+
intlistHead[STRAT_NUM_LISTS];/* ARC lists B1, T1, T2 and B2 */
171+
intlistTail[STRAT_NUM_LISTS];
172+
intlistSize[STRAT_NUM_LISTS];
173+
BufferlistFreeBuffers;/* List of unused buffers */
174+
175+
longnum_lookup;/* Some hit statistics */
176+
longnum_hit[STRAT_NUM_LISTS];
177+
time_tstat_report;
178+
179+
BufferStrategyCDBcdb[1];/* The cache directory */
180+
}BufferStrategyControl;
181+
138182
/* counters in buf_init.c */
139183
externlongintReadBufferCount;
140184
externlongintReadLocalBufferCount;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp