Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
dfdd59e9
Commit
dfdd59e9
authored
Jan 15, 2004
by
Jan Wieck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adjusted calculation of shared memory requirements to new
ARC buffer replacement strategy. Jan
parent
cfd7fb7e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
47 deletions
+56
-47
src/backend/storage/buffer/buf_init.c
src/backend/storage/buffer/buf_init.c
+9
-3
src/backend/storage/buffer/freelist.c
src/backend/storage/buffer/freelist.c
+1
-42
src/include/storage/buf_internals.h
src/include/storage/buf_internals.h
+46
-2
No files found.
src/backend/storage/buffer/buf_init.c
View file @
dfdd59e9
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/storage/buffer/buf_init.c,v 1.6
0 2003/12/20 17:31:21 momjian
Exp $
* $PostgreSQL: pgsql/src/backend/storage/buffer/buf_init.c,v 1.6
1 2004/01/15 16:14:26 wieck
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -231,13 +231,19 @@ BufferShmemSize(void)
size
+=
hash_estimate_size
(
SHMEM_INDEX_SIZE
,
sizeof
(
ShmemIndexEnt
));
/* size of buffer descriptors */
size
+=
MAXALIGN
((
NBuffers
+
1
)
*
sizeof
(
BufferDesc
));
size
+=
MAXALIGN
(
NBuffers
*
sizeof
(
BufferDesc
));
/* size of the shared replacement strategy control block */
size
+=
MAXALIGN
(
sizeof
(
BufferStrategyControl
));
/* size of the ARC directory blocks */
size
+=
MAXALIGN
(
NBuffers
*
2
*
sizeof
(
BufferStrategyCDB
));
/* size of data pages */
size
+=
NBuffers
*
MAXALIGN
(
BLCKSZ
);
/* size of buffer hash table */
size
+=
hash_estimate_size
(
NBuffers
,
sizeof
(
BufferLookupEnt
));
size
+=
hash_estimate_size
(
NBuffers
*
2
,
sizeof
(
BufferLookupEnt
));
return
size
;
}
src/backend/storage/buffer/freelist.c
View file @
dfdd59e9
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/storage/buffer/freelist.c,v 1.3
8 2003/11/29 19:51:56 pgsql
Exp $
* $PostgreSQL: pgsql/src/backend/storage/buffer/freelist.c,v 1.3
9 2004/01/15 16:14:26 wieck
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -32,13 +32,6 @@
#include "storage/proc.h"
#include "access/xact.h"
#define STRAT_LIST_UNUSED -1
#define STRAT_LIST_B1 0
#define STRAT_LIST_T1 1
#define STRAT_LIST_T2 2
#define STRAT_LIST_B2 3
#define STRAT_NUM_LISTS 4
#ifndef MAX
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#endif
...
...
@@ -46,40 +39,6 @@
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#endif
/*
* The Cache Directory Block (CDB) of the Adaptive Replacement Cache (ARC)
*/
typedef
struct
bufstratcdb
{
int
prev
;
/* links in the queue */
int
next
;
int
list
;
/* current list */
BufferTag
buf_tag
;
/* buffer key */
Buffer
buf_id
;
/* currently assigned data buffer */
TransactionId
t1_xid
;
/* the xid this entry went onto T1 */
}
BufferStrategyCDB
;
/*
* The shared ARC control information.
*/
typedef
struct
bufstratcontrol
{
int
target_T1_size
;
/* What T1 size are we aiming for */
int
listUnusedCDB
;
/* All unused StrategyCDB */
int
listHead
[
STRAT_NUM_LISTS
];
/* ARC lists B1, T1, T2 and B2 */
int
listTail
[
STRAT_NUM_LISTS
];
int
listSize
[
STRAT_NUM_LISTS
];
Buffer
listFreeBuffers
;
/* List of unused buffers */
long
num_lookup
;
/* Some hit statistics */
long
num_hit
[
STRAT_NUM_LISTS
];
time_t
stat_report
;
BufferStrategyCDB
cdb
[
1
];
/* The cache directory */
}
BufferStrategyControl
;
static
BufferStrategyControl
*
StrategyControl
=
NULL
;
static
BufferStrategyCDB
*
StrategyCDB
=
NULL
;
...
...
src/include/storage/buf_internals.h
View file @
dfdd59e9
/*-------------------------------------------------------------------------
*
* buf_internals.h
* Internal definitions for buffer manager.
* Internal definitions for buffer manager and the buffer replacement
* strategy.
*
*
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/storage/buf_internals.h,v 1.6
6 2003/12/14 00:34:47 neilc
Exp $
* $PostgreSQL: pgsql/src/include/storage/buf_internals.h,v 1.6
7 2004/01/15 16:14:26 wieck
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -135,6 +136,49 @@ typedef struct
Buffer
id
;
}
BufferLookupEnt
;
/*
* Definitions for the buffer replacement strategy
*/
#define STRAT_LIST_UNUSED -1
#define STRAT_LIST_B1 0
#define STRAT_LIST_T1 1
#define STRAT_LIST_T2 2
#define STRAT_LIST_B2 3
#define STRAT_NUM_LISTS 4
/*
* The Cache Directory Block (CDB) of the Adaptive Replacement Cache (ARC)
*/
typedef
struct
{
int
prev
;
/* links in the queue */
int
next
;
int
list
;
/* current list */
BufferTag
buf_tag
;
/* buffer key */
Buffer
buf_id
;
/* currently assigned data buffer */
TransactionId
t1_xid
;
/* the xid this entry went onto T1 */
}
BufferStrategyCDB
;
/*
* The shared ARC control information.
*/
typedef
struct
{
int
target_T1_size
;
/* What T1 size are we aiming for */
int
listUnusedCDB
;
/* All unused StrategyCDB */
int
listHead
[
STRAT_NUM_LISTS
];
/* ARC lists B1, T1, T2 and B2 */
int
listTail
[
STRAT_NUM_LISTS
];
int
listSize
[
STRAT_NUM_LISTS
];
Buffer
listFreeBuffers
;
/* List of unused buffers */
long
num_lookup
;
/* Some hit statistics */
long
num_hit
[
STRAT_NUM_LISTS
];
time_t
stat_report
;
BufferStrategyCDB
cdb
[
1
];
/* The cache directory */
}
BufferStrategyControl
;
/* counters in buf_init.c */
extern
long
int
ReadBufferCount
;
extern
long
int
ReadLocalBufferCount
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment