Skip to content

Commit f2ae7a4

Browse files
committed
pathman: reload config after all backends disconnected
1 parent 3e800ec commit f2ae7a4

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

contrib/pg_pathman/init.c

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,6 @@ HTAB *relations = NULL;
1818
HTAB *range_restrictions = NULL;
1919
bool initialization_needed = true;
2020

21-
typedef struct ShmemConfig
22-
{
23-
bool config_loaded;
24-
} ShmemConfig;
25-
ShmemConfig *shmem_cfg;
26-
2721
static FmgrInfo *qsort_type_cmp_func;
2822
static bool globalByVal;
2923

@@ -34,12 +28,8 @@ static int cmp_range_entries(const void *p1, const void *p2);
3428
void
3529
init_shmem_config()
3630
{
37-
bool found;
3831
create_relations_hashtable();
3932
create_range_restrictions_hashtable();
40-
shmem_cfg = (ShmemConfig *)
41-
ShmemInitStruct("pathman shmem config", sizeof(ShmemConfig), &found);
42-
shmem_cfg->config_loaded = false;
4333
}
4434

4535
/*
@@ -54,12 +44,11 @@ load_config(void)
5444
new_segment_created = init_dsm_segment(INITIAL_BLOCKS_COUNT, 32);
5545

5646
/* if config is not loaded */
57-
if (shmem_cfg && !shmem_cfg->config_loaded)
47+
if (new_segment_created)
5848
{
5949
LWLockAcquire(load_config_lock, LW_EXCLUSIVE);
6050
load_relations_hashtable(new_segment_created);
6151
LWLockRelease(load_config_lock);
62-
shmem_cfg->config_loaded = true;
6352
}
6453
}
6554

@@ -528,4 +517,4 @@ remove_relation_info(Oid relid)
528517
}
529518
prel->children_count = 0;
530519
hash_search(relations, (const void *) &key, HASH_REMOVE, 0);
531-
}
520+
}

0 commit comments

Comments
 (0)