summaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
authorKoichi Suzuki2011-12-14 02:21:28 +0000
committerKoichi Suzuki2011-12-14 02:21:28 +0000
commita53dd68ce6ab8a66ae7b4f7487b3b1aa78423894 (patch)
treec0bd6238ace6a0d955e31e2200cc32ee75786174 /src/backend
parentf5bc8bc529edaf30617c2c23682df1367d06fd02 (diff)
This commit allows GTM-Standby to connect to GTM anytime. Without this patch,
GTM-Standby must connect to GTM before any clients are connected. This patch eliminates this restriction. In this patch, I used thr_lock RW lock which was not used so far. When GTM-Standby connects to GTM, GTM recognizes that this is another GTM (then, standby) and registers this as another GTM, which will be used later by main thread and worker thread. For running worker thread to begin backup to standby, it must connect to it. Before backup from each running worker threads begin, all the existing transaction status and sequence status must be backed up. For this purpose, when GTM-standby connects to GTM, it issues new message MSG_BEGIN_BACKUP. When GTM receives this, GTM locks all the worker thread to make status static. Then GTM-Standby issues commands to backup everything. When backup is done, GTM-Standby issues MSG_END_BACKUP, whcih release the lock of each worker thread. When the lock is released, each worker thread checks if there're new GTM-Standby connected. If so, each worker thread connects to GTM-Standby and begin backup of each worker thread. There're no update in the document. Affected files are: modified: src/backend/utils/mmgr/mcxt.c modified: src/gtm/client/fe-protocol.c modified: src/gtm/client/gtm_client.c modified: src/gtm/common/gtm_serialize.c modified: src/gtm/common/mcxt.c modified: src/gtm/gtm_ctl/Makefile modified: src/gtm/main/Makefile modified: src/gtm/main/gtm_opt.c modified: src/gtm/main/gtm_standby.c modified: src/gtm/main/gtm_thread.c modified: src/gtm/main/main.c modified: src/gtm/proxy/Makefile modified: src/gtm/proxy/gtm_proxy_opt.c modified: src/gtm/recovery/Makefile renamed: src/gtm/recovery/register.c -> src/gtm/recovery/register_common.c new file: src/gtm/recovery/register_gtm.c modified: src/include/gen_alloc.h modified: src/include/gtm/gtm.h modified: src/include/gtm/gtm_c.h modified: src/include/gtm/gtm_client.h modified: src/include/gtm/gtm_msg.h modified: src/include/gtm/gtm_opt.h modified: src/include/gtm/gtm_standby.h modified: src/include/gtm/gtm_txn.h modified: src/include/gtm/register.h
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/utils/mmgr/mcxt.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/backend/utils/mmgr/mcxt.c b/src/backend/utils/mmgr/mcxt.c
index 887241be0a..92473a3b43 100644
--- a/src/backend/utils/mmgr/mcxt.c
+++ b/src/backend/utils/mmgr/mcxt.c
@@ -739,10 +739,16 @@ void *current_memcontext()
return((void *)CurrentMemoryContext);
}
+void *allocTopCxt(size_t s)
+{
+ return MemoryContextAlloc(TopMemoryContext, (Size)s);
+}
+
Gen_Alloc genAlloc_class = {(void *)MemoryContextAlloc,
(void *)MemoryContextAllocZero,
(void *)repalloc,
(void *)pfree,
- (void *)current_memcontext};
+ (void *)current_memcontext,
+ (void *)allocTopCxt};
#endif