mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-10 15:02:56 +00:00
Handle init fork in specialk way
This commit is contained in:
committed by
Konstantin Knizhnik
parent
1ca23b47fd
commit
8e150568ec
@@ -322,7 +322,11 @@ typedef enum
|
||||
RELKIND_UNLOGGED_BUILD
|
||||
} RelKind;
|
||||
|
||||
/* entry type stored in relkind_hash */
|
||||
/*
|
||||
* Entry type stored in relkind_hash. We have just one entry for the whole relation, i.e. we don't have separate entries for the individual forks.
|
||||
* It gets a little complicated with unlogged relations. The main fork of an unlogged relation is considered UNLOGGED, but its init-fork is
|
||||
* treated as PERMANENT. It is specially checked in neon_write.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
NRelFileInfo rel;
|
||||
|
||||
@@ -1610,6 +1610,10 @@ neon_write(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum, const vo
|
||||
switch (reln->smgr_relpersistence)
|
||||
{
|
||||
case 0:
|
||||
if (forknum == INIT_FORKNUM)
|
||||
{
|
||||
break; /* init fork is always permanent */
|
||||
}
|
||||
relkind = get_cached_relkind(rinfo);
|
||||
if (relkind == RELKIND_UNKNOWN)
|
||||
{
|
||||
@@ -1715,6 +1719,10 @@ neon_writev(SMgrRelation reln, ForkNumber forknum, BlockNumber blkno,
|
||||
switch (reln->smgr_relpersistence)
|
||||
{
|
||||
case 0:
|
||||
if (forknum == INIT_FORKNUM)
|
||||
{
|
||||
break; /* init fork is always permanent */
|
||||
}
|
||||
relkind = get_cached_relkind(rinfo);
|
||||
if (relkind == RELKIND_UNKNOWN)
|
||||
{
|
||||
|
||||
@@ -91,9 +91,9 @@ relkind_cache_startup(void)
|
||||
/*
|
||||
* In the worst case, the hash needs to be large enough for the case that all backends are performing an unlogged index build at the same time.
|
||||
* Or actually twice that, because while performing an unlogged index build, each backend can also be trying to write out a page for another
|
||||
* relation and hence hold one more entry in the cache pinned.
|
||||
* relation and hence hold one more entry in the cache pinned. Use MaxConnections instead of MaxBackends because only normal backends can perform unlogged build.
|
||||
*/
|
||||
size_t hash_size = Max(2 * MaxBackends, relkind_hash_size);
|
||||
size_t hash_size = Max(2 * MaxConnections, relkind_hash_size);
|
||||
relkind_hash_lock = (LWLockId) GetNamedLWLockTranche("neon_relkind");
|
||||
finish_unlogged_build_lock = (LWLockId)(GetNamedLWLockTranche("neon_relkind") + 1);
|
||||
info.keysize = sizeof(NRelFileInfo);
|
||||
|
||||
Reference in New Issue
Block a user