File tree Expand file tree Collapse file tree 4 files changed +17
-9
lines changed Expand file tree Collapse file tree 4 files changed +17
-9
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ include $(top_builddir)/src/Makefile.global
19
19
include $(top_srcdir ) /contrib/contrib-global.mk
20
20
endif
21
21
22
- check : regresscheck
22
+ check : isolationcheck
23
23
24
24
submake-regress :
25
25
$(MAKE ) -C $(top_builddir ) /src/test/regress all
Original file line number Diff line number Diff line change 20
20
21
21
#include "pg_stat_wait.h"
22
22
23
- CollectorShmqHeader * hdr ;
23
+ CollectorShmqHeader * hdr = NULL ;
24
24
25
25
static void * pgsw ;
26
26
shm_toc * toc ;
@@ -52,13 +52,18 @@ CollectorShmemSize(void)
52
52
return size ;
53
53
}
54
54
55
- void
56
- AllocateCollectorMem ( void )
55
+ CollectorShmqHeader *
56
+ GetCollectorMem ( bool init )
57
57
{
58
58
bool found ;
59
59
Size segsize = CollectorShmemSize ();
60
60
61
61
pgsw = ShmemInitStruct ("pg_stat_wait" , segsize , & found );
62
+ if (!init && !found )
63
+ {
64
+ ereport (ERROR , (errcode (ERRCODE_INTERNAL_ERROR ),
65
+ errmsg ("A collector memory wasn't initialized yet" )));
66
+ }
62
67
63
68
if (!found )
64
69
{
@@ -76,6 +81,7 @@ AllocateCollectorMem(void)
76
81
toc = shm_toc_attach (PG_STAT_WAIT_MAGIC , pgsw );
77
82
hdr = shm_toc_lookup (toc , 0 );
78
83
}
84
+ return hdr ;
79
85
}
80
86
81
87
void
Original file line number Diff line number Diff line change @@ -18,7 +18,6 @@ PG_MODULE_MAGIC;
18
18
void _PG_init (void );
19
19
void _PG_fini (void );
20
20
21
- extern CollectorShmqHeader * hdr ;
22
21
extern shm_toc * toc ;
23
22
24
23
static shmem_startup_hook_type prev_shmem_startup_hook = NULL ;
@@ -35,7 +34,7 @@ pgsw_shmem_startup(void)
35
34
if (prev_shmem_startup_hook )
36
35
prev_shmem_startup_hook ();
37
36
38
- AllocateCollectorMem ( );
37
+ GetCollectorMem (true );
39
38
}
40
39
}
41
40
@@ -582,13 +581,16 @@ PG_FUNCTION_INFO_V1(pg_stat_wait_get_history);
582
581
Datum
583
582
pg_stat_wait_get_history (PG_FUNCTION_ARGS )
584
583
{
585
- History * observations ;
586
- FuncCallContext * funcctx ;
584
+ History * observations ;
585
+ FuncCallContext * funcctx ;
586
+ CollectorShmqHeader * hdr ;
587
587
588
588
if (!WaitsHistoryOn )
589
589
ereport (ERROR , (errcode (ERRCODE_CONFIG_FILE_ERROR ),
590
590
errmsg ("Waits history turned off" )));
591
591
592
+ hdr = GetCollectorMem (false);
593
+
592
594
if (SRF_IS_FIRSTCALL ())
593
595
{
594
596
shm_mq * mq ;
Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ extern PGDLLIMPORT bool historySkipLatch;
75
75
76
76
77
77
Size CollectorShmemSize (void );
78
- void AllocateCollectorMem ( void );
78
+ CollectorShmqHeader * GetCollectorMem ( bool init );
79
79
void RegisterWaitsCollector (void );
80
80
void AllocHistory (History * , int );
81
81
int GetCurrentWaitsState (PGPROC * , HistoryItem * , int );
You can’t perform that action at this time.
0 commit comments