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

Commit8bd21f5

Browse files
author
Sokolov Yura
committed
cfs: set CFS_GC_LOCK to be dependent on MAX_BACKENDS
1 parent67f29e1 commit8bd21f5

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

‎src/backend/storage/file/cfs.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@
4545
#include"port/atomics.h"
4646
#include"pgstat.h"
4747
#include"portability/mem.h"
48+
#include"postmaster/bgworker.h"
49+
#include"postmaster/postmaster.h"
4850
#include"storage/fd.h"
4951
#include"storage/cfs.h"
5052
#include"storage/ipc.h"
@@ -53,7 +55,6 @@
5355
#include"utils/rel.h"
5456
#include"utils/builtins.h"
5557
#include"utils/resowner_private.h"
56-
#include"postmaster/bgworker.h"
5758

5859

5960
/*
@@ -398,6 +399,12 @@ int cfs_shmem_size()
398399
voidcfs_initialize()
399400
{
400401
boolfound;
402+
403+
StaticAssertStmt((CFS_GC_LOCK& (CFS_GC_LOCK-1))==0,
404+
"CFS_GC_LOCK should be single bit");
405+
StaticAssertStmt(CFS_GC_LOCK>MAX_BACKENDS,
406+
"CFS_GC_LOCK should be larger than MAX_BACKENDS");
407+
401408
cfs_state= (CfsState*)ShmemInitStruct("CFS Control",
402409
sizeof(CfsState)+sizeof(pg_atomic_uint32)*MaxBackends,&found);
403410
if (!found)

‎src/include/storage/cfs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
#defineCFS_VERSION "0.45"
1010

11-
#defineCFS_GC_LOCK0x10000000
11+
#defineCFS_GC_LOCK(MAX_BACKENDS+1)
1212

1313
#defineCFS_LOCK_MIN_TIMEOUT 100/* microseconds: initial timeout of GC lock acquisition */
1414
#defineCFS_LOCK_MAX_TIMEOUT 10000/* microseconds */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp