summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Paquier2012-10-31 23:49:27 +0000
committerMichael Paquier2012-10-31 23:49:27 +0000
commit714e09b2b65e268b3ee167c1edf35fdfb05bad85 (patch)
tree260843490bdad2cc537c765ece31dff52ca43936
parentcdd8b22ce1e59d78576e1e4270b219f2644586a5 (diff)
Refactor Makefile of GTM binaries and remove unnecessary build dependencies
All the Makefiles of src/gtm are changed to fit in a better way the Postgres style used inside src/backend. It is now possible to invocate make directly inside src/gtm/main or src/gtm/proxy to generate only the related binary. there are not anymore annoying dependencies with the order folders have to be compiled. Some strange dependencies are also fixed in this commit. A couple of functions related only to GTM-Standby using structures defined in gtm/main were located in src/gtm/recovery, which is also a folder GTM-Proxy has a dependency to, so this was leading to unncessary dependencies with the GTM main and GTM-proxy main messing up all the building process. Those GTM-only files are moved to gtm/main to avoid such problems. Prior to this commit, src/gtm was creating and installing a series of so libraries that are indeed not necessary for the installation as they are only server side features. It is not that difficult to reallow them but for the time being it is better to keep a GTM installation as light as possible.
-rw-r--r--src/backend/Makefile13
-rw-r--r--src/gtm/Makefile35
-rw-r--r--src/gtm/client/Makefile18
-rw-r--r--src/gtm/client/strlcpy.c72
-rw-r--r--src/gtm/common/Makefile28
-rw-r--r--src/gtm/config/Makefile15
-rw-r--r--src/gtm/gtm_ctl/Makefile36
-rw-r--r--src/gtm/libpq/Makefile14
-rw-r--r--src/gtm/main/Makefile40
-rw-r--r--src/gtm/main/gtm_standby.c49
-rw-r--r--src/gtm/main/register_gtm.c (renamed from src/gtm/recovery/register_gtm.c)45
-rw-r--r--src/gtm/main/replication.c (renamed from src/gtm/recovery/replication.c)0
-rw-r--r--src/gtm/path/Makefile15
-rw-r--r--src/gtm/proxy/Makefile41
-rw-r--r--src/gtm/recovery/Makefile16
-rw-r--r--src/include/gtm/gtm_standby.h5
16 files changed, 185 insertions, 257 deletions
diff --git a/src/backend/Makefile b/src/backend/Makefile
index 611d29fa87..828c084ceb 100644
--- a/src/backend/Makefile
+++ b/src/backend/Makefile
@@ -50,8 +50,8 @@ OBJS = $(SUBDIROBJS) $(LOCALOBJS) \
$(top_builddir)/src/interfaces/libpq/pqexpbuffer.o \
$(top_builddir)/src/port/libpgport_srv.a \
$(top_builddir)/src/gtm/client/libgtmclient.a \
- $(top_builddir)/src/gtm/common/libgtm.a \
- $(top_builddir)/src/gtm/libpq/libpqcomm.a
+ $(top_builddir)/src/gtm/common/libgtmcommon.a \
+ $(top_builddir)/src/interfaces/libpq/libpq.a
# We put libpgport into OBJS, so remove it from LIBS; also add libldap
LIBS := $(filter-out -lpgport, $(LIBS)) $(LDAP_LIBS_BE)
@@ -147,6 +147,15 @@ catalog/schemapg.h: | submake-schemapg
$(top_builddir)/src/port/libpgport_srv.a: | submake-libpgport
+# Those are rules to create dependent GTM libraries automatically
+$(top_builddir)/src/interfaces/libpq/libpq.a:
+ $(MAKE) -C $(top_builddir)/src/interfaces/libpq libpq.a
+
+$(top_builddir)/src/gtm/common/libgtmcommon.a:
+ $(MAKE) -C $(top_builddir)/src/gtm/common libgtmcommon.a
+
+$(top_builddir)/src/gtm/client/libgtmclient.a:
+ $(MAKE) -C $(top_builddir)/src/gtm/client libgtmclient.a
# The postgres.o target is needed by the rule in Makefile.global that
# creates the exports file when MAKE_EXPORTS = true.
diff --git a/src/gtm/Makefile b/src/gtm/Makefile
index 40ee1b7168..26a4b6f0da 100644
--- a/src/gtm/Makefile
+++ b/src/gtm/Makefile
@@ -12,37 +12,6 @@ subdir = src/gtm
top_builddir = ../..
include $(top_builddir)/src/Makefile.global
-WANTED_DIRS=common config path libpq client recovery main proxy gtm_ctl
+SUBDIRS = client common config gtm_ctl libpq main path proxy recovery
-all:
- @for dir in $(WANTED_DIRS); do \
- $(MAKE) -C $$dir $@ || exit; \
- done
-
-clobber:
- @for dir in $(WANTED_DIRS); do \
- $(MAKE) -C $$dir $@ || exit; \
- done
-
-clean:
- @for dir in $(WANTED_DIRS); do \
- $(MAKE) -C $$dir $@ || exit; \
- done
-
-distclean: clean
-
-maintainer-clean: distclean
-
-install: all
- $(INSTALL_PROGRAM) main/gtm$(X) '$(DESTDIR)$(bindir)/gtm$(X)'
- $(INSTALL_PROGRAM) gtm_ctl/gtm_ctl$(X) '$(DESTDIR)$(bindir)/gtm_ctl$(X)'
- $(INSTALL_PROGRAM) proxy/gtm_proxy$(X) '$(DESTDIR)$(bindir)/gtm_proxy$(X)'
- $(INSTALL_DATA) $(srcdir)/main/gtm.conf.sample '$(DESTDIR)$(datadir)/gtm.conf.sample'
- $(INSTALL_DATA) $(srcdir)/proxy/gtm_proxy.conf.sample '$(DESTDIR)$(datadir)/gtm_proxy.conf.sample'
-
-uninstall:
- rm -f $(DESTDIR)$(bindir)/gtm$(X)
- rm -f $(DESTDIR)$(bindir)/gtm_ctl$(X)
- rm -f $(DESTDIR)$(bindir)/gtm_proxy$(X)
- rm -f $(DESTDIR)$(datadir)/gtm.conf.sample
- rm -f $(DESTDIR)$(datadir)/gtm_proxy.conf.sample
+$(recurse)
diff --git a/src/gtm/client/Makefile b/src/gtm/client/Makefile
index e8204bb4b9..56dba648ce 100644
--- a/src/gtm/client/Makefile
+++ b/src/gtm/client/Makefile
@@ -11,22 +11,20 @@ top_builddir=../../..
include $(top_builddir)/src/Makefile.global
subdir=src/gtm/client
-NAME=gtmclient
-SO_MAJOR_VERSION= 1
-SO_MINOR_VERSION= 0
+override CPPFLAGS := -I$(libpq_srcdir) $(CPPFLAGS)
+LIBS += $(PTHREAD_LIBS)
-OBJS=fe-misc.o fe-connect.o pqexpbuffer.o ip.o strlcpy.o gtm_client.o fe-protocol.o
-LDFLAGS=-L$(top_build_dir)/common -L$(top_build_dir)/libpq
+include $(top_srcdir)/src/backend/common.mk
-LIBS=-lpthread
+OBJS = fe-misc.o fe-connect.o gtm_client.o fe-protocol.o ip.o pqexpbuffer.o
-all:all-lib
+all: libgtmclient.a
-include $(top_srcdir)/src/Makefile.shlib
+libgtmclient.a: $(OBJS)
+ $(AR) $(AROPT) $@ $^
clean:
- rm -f $(OBJS)
- rm -f libgtmclient.a libgtmclient.so libgtmclient.so.1 libgtmclient.so.1.0
+ rm -f $(OBJS) libgtmclient.a
distclean: clean
diff --git a/src/gtm/client/strlcpy.c b/src/gtm/client/strlcpy.c
deleted file mode 100644
index 48cdf5e2c9..0000000000
--- a/src/gtm/client/strlcpy.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/*-------------------------------------------------------------------------
- *
- * strlcpy.c
- * strncpy done right
- *
- * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
- * Portions Copyright (c) 2010-2012 Postgres-XC Development Group
- *
- *
- * IDENTIFICATION
- * $PostgreSQL: pgsql/src/port/strlcpy.c,v 1.5 2008/01/01 19:46:00 momjian Exp $
- *
- * This file was taken from OpenBSD and is used on platforms that don't
- * provide strlcpy(). The OpenBSD copyright terms follow.
- *-------------------------------------------------------------------------
- */
-
-/* $OpenBSD: strlcpy.c,v 1.11 2006/05/05 15:27:38 millert Exp $ */
-
-/*
- * Copyright (c) 1998 Todd C. Miller <[email protected]>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include "gtm/gtm_c.h"
-
-
-/*
- * Copy src to string dst of size siz. At most siz-1 characters
- * will be copied. Always NUL terminates (unless siz == 0).
- * Returns strlen(src); if retval >= siz, truncation occurred.
- * Function creation history: http://www.gratisoft.us/todd/papers/strlcpy.html
- */
-size_t
-strlcpy(char *dst, const char *src, size_t siz)
-{
- char *d = dst;
- const char *s = src;
- size_t n = siz;
-
- /* Copy as many bytes as will fit */
- if (n != 0)
- {
- while (--n != 0)
- {
- if ((*d++ = *s++) == '\0')
- break;
- }
- }
-
- /* Not enough room in dst, add NUL and traverse rest of src */
- if (n == 0)
- {
- if (siz != 0)
- *d = '\0'; /* NUL-terminate dst */
- while (*s++)
- ;
- }
-
- return (s - src - 1); /* count does not include NUL */
-}
diff --git a/src/gtm/common/Makefile b/src/gtm/common/Makefile
index d9b345151a..c43e000ead 100644
--- a/src/gtm/common/Makefile
+++ b/src/gtm/common/Makefile
@@ -8,32 +8,24 @@
#
#-----------------------------------------------------------------------------
top_builddir=../../..
-subdir=src/gtm/common
-
include $(top_builddir)/src/Makefile.global
+subdir=src/gtm/common
-override CPPFLAGS := -I. -I$(srcdir) $(CPPFLAGS)
-
-NAME=gtm
-
-SO_MAJOR_VERSION= 1
-SO_MINOR_VERSION= 0
-
-LDFLAGS=-L$(top_builddir)/common -L$(top_builddir)/libpq
+override CPPFLAGS := -I. -I$(libpq_srcdir) $(CPPFLAGS)
LIBS += $(PTHREAD_LIBS)
-OBJS = aset.o mcxt.o gtm_utils.o elog.o assert.o stringinfo.o gtm_lock.o \
- gtm_list.o gtm_serialize.o gtm_serialize_debug.o
+include $(top_srcdir)/src/backend/common.mk
+
+OBJS = gtm_utils.o gtm_lock.o gtm_serialize.o gtm_serialize_debug.o \
+ aset.o assert.o elog.o mcxt.o stringinfo.o gtm_list.o
-all:all-lib
+all: libgtmcommon.a
-# Shared library stuff
-include $(top_srcdir)/src/Makefile.shlib
+libgtmcommon.a: $(OBJS)
+ $(AR) $(AROPT) $@ $^
-# Note that gtm_opt_scanner.c is not deleted by make clean as we want it in distribution tarballs
clean:
- rm -f $(OBJS)
- rm -f libgtm.so libgtm.so.1 libgtm.so.1.0
+ rm -f $(OBJS) libgtmcommon.a
distclean: clean
diff --git a/src/gtm/config/Makefile b/src/gtm/config/Makefile
index ffc0398a1c..e0a7c8f300 100644
--- a/src/gtm/config/Makefile
+++ b/src/gtm/config/Makefile
@@ -12,18 +12,16 @@ include $(top_builddir)/src/Makefile.global
subdir=src/gtm/config
override CPPFLAGS := -I. -I$(libpq_srcdir) $(CPPFLAGS)
+LIBS += $(PTHREAD_LIBS)
-NAME = gtmconfig
-
-SO_MAJOR_VERSION= 1
-SO_MINOR_VERSION= 0
+include $(top_srcdir)/src/backend/common.mk
OBJS = gtm_opt_handler.o
-all: all-lib
+all: libgtmconfig.a
-# Shared library stuff
-include $(top_srcdir)/src/Makefile.shlib
+libgtmconfig.a: $(OBJS)
+ $(AR) $(AROPT) $@ $^
gtm_opt_handler.o: gtm_opt_scanner.c
@@ -36,8 +34,7 @@ endif
# Note that gtm_opt_scanner.c is not deleted by make clean as we want it in distribution tarballs
clean:
- rm -f $(OBJS)
- rm -f rm -f libgtmconfig.so libgtmconfig.so.1 libgtmconfig.so.1.0
+ rm -f $(OBJS) libgtmconfig.a
distclean: clean
diff --git a/src/gtm/gtm_ctl/Makefile b/src/gtm/gtm_ctl/Makefile
index 6b079b7832..8cfe3321cb 100644
--- a/src/gtm/gtm_ctl/Makefile
+++ b/src/gtm/gtm_ctl/Makefile
@@ -11,24 +11,36 @@ top_builddir=../../..
include $(top_builddir)/src/Makefile.global
subdir=src/gtm/gtm_ctl
-OBJS=gtm_ctl.o
+override CPPFLAGS := -I$(libpq_srcdir) $(CPPFLAGS)
-OTHERS=../common/libgtm.a ../libpq/libpqcomm.a ../client/libgtmclient.a ../path/libgtmpath.a
+OBJS = gtm_ctl.o \
+ $(top_builddir)/src/gtm/client/libgtmclient.a \
+ $(top_builddir)/src/gtm/common/libgtmcommon.a \
+ $(top_builddir)/src/interfaces/libpq/libpq.a
-LDFLAGS=-L$(top_builddir)/common -L$(top_builddir)/libpq
+all:gtm_ctl
+gtm_ctl: $(OBJS) | submake-libpq submake-libpgport
+ $(CC) $(CFLAGS) $^ $(libpq_pgport) $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@$(X)
-LIBS=-lpthread
+install: all installdirs
+ $(INSTALL_PROGRAM) gtm_ctl$(X) '$(DESTDIR)$(bindir)/gtm_ctl$(X)'
-gtm_ctl:$(OBJS)
- $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) $^ $(OTHERS) -o gtm_ctl
+installdirs:
+ $(MKDIR_P) '$(DESTDIR)$(bindir)'
-all:gtm_ctl
+uninstall:
+ rm -f '$(DESTDIR)$(bindir)/gtm_ctl$(X)'
+
+clean distclean maintainer-clean:
+ rm -f gtm_ctl$(X) $(OBJS)
-clean:
- rm -f $(OBJS)
- rm -f gtm_ctl
+# Be sure that the necessary archives are compiled
+$(top_builddir)/src/interfaces/libpq/libpq.a:
+ $(MAKE) -C ../../interfaces/libpq libpq.a
-distclean: clean
+$(top_builddir)/src/gtm/common/libgtmcommon.a:
+ $(MAKE) -C ../../gtm/common libgtmcommon.a
-maintainer-clean: distclean
+$(top_builddir)/src/gtm/client/libgtmclient.a:
+ $(MAKE) -C ../../gtm/client libgtmclient.a
diff --git a/src/gtm/libpq/Makefile b/src/gtm/libpq/Makefile
index dd22b0dcb1..4cbd004628 100644
--- a/src/gtm/libpq/Makefile
+++ b/src/gtm/libpq/Makefile
@@ -11,19 +11,17 @@ top_builddir=../../..
include $(top_builddir)/src/Makefile.global
subdir=src/gtm/libpq
-NAME=pqcomm
-SO_MAJOR_VERSION= 1
-SO_MINOR_VERSION= 0
+include $(top_srcdir)/src/backend/common.mk
-OBJS=ip.o pqcomm.o pqformat.o strlcpy.o pqsignal.o
+OBJS = ip.o pqcomm.o pqformat.o strlcpy.o pqsignal.o
-all:all-lib
+all: libgtmpq.a
-include $(top_srcdir)/src/Makefile.shlib
+libgtmpq.a: $(OBJS)
+ $(AR) $(AROPT) $@ $^
clean:
- rm -f $(OBJS)
- rm -f libpqcomm.so libpqcomm.so.1 libpqcomm.so.1.0
+ rm -f $(OBJS) libgtmpq.a
distclean: clean
diff --git a/src/gtm/main/Makefile b/src/gtm/main/Makefile
index 60990e94e4..f85d977eac 100644
--- a/src/gtm/main/Makefile
+++ b/src/gtm/main/Makefile
@@ -15,24 +15,38 @@ ifneq ($(PORTNAME), win32)
override CFLAGS += $(PTHREAD_CFLAGS)
endif
-OBJS=main.o gtm_thread.o gtm_txn.o gtm_seq.o gtm_snap.o gtm_time.o gtm_standby.o gtm_opt.o
+SUBDIRS = $(top_builddir)/src/gtm/client \
+ $(top_builddir)/src/gtm/common \
+ $(top_builddir)/src/gtm/config \
+ $(top_builddir)/src/gtm/libpq \
+ $(top_builddir)/src/gtm/path \
+ $(top_builddir)/src/gtm/recovery
-OTHERS= ../libpq/libpqcomm.a ../config/libgtmconfig.a ../path/libgtmpath.a \
- ../recovery/libgtmrecovery.a ../client/libgtmclient.a ../common/libgtm.a ../../port/libpgport.a
+include $(top_srcdir)/src/backend/common.mk
-LDFLAGS=-L$(top_builddir)/common -L$(top_builddir)/libpq
+OBJS = $(SUBDIROBJS) \
+ $(top_builddir)/src/port/libpgport_srv.a \
+ main.o gtm_thread.o gtm_txn.o gtm_seq.o gtm_snap.o gtm_time.o \
+ gtm_standby.o gtm_opt.o register_gtm.o replication.o
-LIBS=-lpthread
+LIBS += $(PTHREAD_LIBS)
-gtm:$(OBJS)
- $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) $^ $(OTHERS) -o gtm
+all: gtm
-all:gtm
+gtm: $(OBJS) | submake-libpgport
+ $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) $(call expand_subsys,$^) -o $@
-clean:
- rm -f $(OBJS)
- rm -f gtm
+install: all installdirs
+ $(INSTALL_PROGRAM) gtm$(X) '$(DESTDIR)$(bindir)/gtm$(X)'
+ $(INSTALL_DATA) $(srcdir)/gtm.conf.sample '$(DESTDIR)$(datadir)/gtm.conf.sample'
-distclean: clean
+installdirs:
+ $(MKDIR_P) '$(DESTDIR)$(bindir)' '$(DESTDIR)$(datadir)'
-maintainer-clean: distclean
+uninstall:
+ rm -f '$(DESTDIR)$(bindir)/gtm$(X)' '$(DESTDIR)$(datadir)/gtm.conf.sample'
+
+clean distclean maintainer-clean:
+ rm -f gtm$(X) $(OBJS)
+
+$(top_builddir)/src/port/libpgport_srv.a: | submake-libpgport
diff --git a/src/gtm/main/gtm_standby.c b/src/gtm/main/gtm_standby.c
index f99b70cf90..d5d3c5c8f2 100644
--- a/src/gtm/main/gtm_standby.c
+++ b/src/gtm/main/gtm_standby.c
@@ -18,12 +18,15 @@
#include "gtm/elog.h"
#include "gtm/gtm.h"
#include "gtm/gtm_c.h"
-#include "gtm/standby_utils.h"
#include "gtm/gtm_client.h"
#include "gtm/gtm_seq.h"
#include "gtm/gtm_serialize.h"
#include "gtm/gtm_utils.h"
+#include "gtm/libpq.h"
+#include "gtm/pqformat.h"
#include "gtm/register.h"
+#include "gtm/standby_utils.h"
+#include "gtm/stringinfo.h"
GTM_Conn *GTM_ActiveConn = NULL;
static char standbyHostName[NI_MAXHOST];
@@ -513,3 +516,47 @@ gtm_standby_connectToActiveGTM(void)
return PQconnectGTM(connect_string);
}
+
+void
+ProcessGTMBeginBackup(Port *myport, StringInfo message)
+{
+ int ii;
+ GTM_ThreadInfo *my_threadinfo;
+ StringInfoData buf;
+
+ pq_getmsgend(message);
+ my_threadinfo = GetMyThreadInfo;
+
+ for (ii = 0; ii < GTMThreads->gt_array_size; ii++)
+ {
+ if (GTMThreads->gt_threads[ii] && GTMThreads->gt_threads[ii] != my_threadinfo)
+ GTM_RWLockAcquire(&GTMThreads->gt_threads[ii]->thr_lock, GTM_LOCKMODE_WRITE);
+ }
+ my_threadinfo->thr_status = GTM_THREAD_BACKUP;
+ pq_beginmessage(&buf, 'S');
+ pq_sendint(&buf, BEGIN_BACKUP_RESULT, 4);
+ pq_endmessage(myport, &buf);
+ pq_flush(myport);
+}
+
+void
+ProcessGTMEndBackup(Port *myport, StringInfo message)
+{
+ int ii;
+ GTM_ThreadInfo *my_threadinfo;
+ StringInfoData buf;
+
+ pq_getmsgend(message);
+ my_threadinfo = GetMyThreadInfo;
+
+ for (ii = 0; ii < GTMThreads->gt_array_size; ii++)
+ {
+ if (GTMThreads->gt_threads[ii] && GTMThreads->gt_threads[ii] != my_threadinfo)
+ GTM_RWLockRelease(&GTMThreads->gt_threads[ii]->thr_lock);
+ }
+ my_threadinfo->thr_status = GTM_THREAD_RUNNING;
+ pq_beginmessage(&buf, 'S');
+ pq_sendint(&buf, END_BACKUP_RESULT, 4);
+ pq_endmessage(myport, &buf);
+ pq_flush(myport);
+}
diff --git a/src/gtm/recovery/register_gtm.c b/src/gtm/main/register_gtm.c
index 6dcb393acf..ee039ba79c 100644
--- a/src/gtm/recovery/register_gtm.c
+++ b/src/gtm/main/register_gtm.c
@@ -429,51 +429,6 @@ ProcessPGXCNodeList(Port *myport, StringInfo message)
elog(LOG, "ProcessPGXCNodeList() ok.");
}
-void
-ProcessGTMBeginBackup(Port *myport, StringInfo message)
-{
- int ii;
- GTM_ThreadInfo *my_threadinfo;
- StringInfoData buf;
-
- pq_getmsgend(message);
- my_threadinfo = GetMyThreadInfo;
-
- for (ii = 0; ii < GTMThreads->gt_array_size; ii++)
- {
- if (GTMThreads->gt_threads[ii] && GTMThreads->gt_threads[ii] != my_threadinfo)
- GTM_RWLockAcquire(&GTMThreads->gt_threads[ii]->thr_lock, GTM_LOCKMODE_WRITE);
- }
- my_threadinfo->thr_status = GTM_THREAD_BACKUP;
- pq_beginmessage(&buf, 'S');
- pq_sendint(&buf, BEGIN_BACKUP_RESULT, 4);
- pq_endmessage(myport, &buf);
- pq_flush(myport);
-}
-
-void
-ProcessGTMEndBackup(Port *myport, StringInfo message)
-{
- int ii;
- GTM_ThreadInfo *my_threadinfo;
- StringInfoData buf;
-
- pq_getmsgend(message);
- my_threadinfo = GetMyThreadInfo;
-
- for (ii = 0; ii < GTMThreads->gt_array_size; ii++)
- {
- if (GTMThreads->gt_threads[ii] && GTMThreads->gt_threads[ii] != my_threadinfo)
- GTM_RWLockRelease(&GTMThreads->gt_threads[ii]->thr_lock);
- }
- my_threadinfo->thr_status = GTM_THREAD_RUNNING;
- pq_beginmessage(&buf, 'S');
- pq_sendint(&buf, END_BACKUP_RESULT, 4);
- pq_endmessage(myport, &buf);
- pq_flush(myport);
-}
-
-
static void
finishStandbyConn(GTM_ThreadInfo *thrinfo)
{
diff --git a/src/gtm/recovery/replication.c b/src/gtm/main/replication.c
index 5fe822b6b4..5fe822b6b4 100644
--- a/src/gtm/recovery/replication.c
+++ b/src/gtm/main/replication.c
diff --git a/src/gtm/path/Makefile b/src/gtm/path/Makefile
index 186b3b1876..4e6a159b19 100644
--- a/src/gtm/path/Makefile
+++ b/src/gtm/path/Makefile
@@ -11,21 +11,18 @@ top_builddir=../../..
include $(top_builddir)/src/Makefile.global
subdir=src/gtm/path
-NAME=gtmpath
-SO_MAJOR_VERSION= 1
-SO_MINOR_VERSION= 0
+include $(top_srcdir)/src/backend/common.mk
-OBJS=path.o
+OBJS = path.o
-all:all-lib
+all: libgtmpath.a
-include $(top_srcdir)/src/Makefile.shlib
+libgtmpath.a: $(OBJS)
+ $(AR) $(AROPT) $@ $^
clean:
- rm -f $(OBJS)
- rm -f libgtmpath.a libgtmpath.so libgtmpath.so.1 libgtmpath.so.1.0
+ rm -f $(OBJS) libgtmpath.a
distclean: clean
maintainer-clean: distclean
-
diff --git a/src/gtm/proxy/Makefile b/src/gtm/proxy/Makefile
index 9dc84504fe..f6b0b1e335 100644
--- a/src/gtm/proxy/Makefile
+++ b/src/gtm/proxy/Makefile
@@ -15,23 +15,38 @@ ifneq ($(PORTNAME), win32)
override CFLAGS += $(PTHREAD_CFLAGS)
endif
-OBJS = proxy_main.o proxy_thread.o proxy_utils.o gtm_proxy_opt.o
+SUBDIRS = $(top_builddir)/src/gtm/client \
+ $(top_builddir)/src/gtm/common \
+ $(top_builddir)/src/gtm/config \
+ $(top_builddir)/src/gtm/libpq \
+ $(top_builddir)/src/gtm/path \
+ $(top_builddir)/src/gtm/recovery
-OTHERS = ../config/libgtmconfig.a ../libpq/libpqcomm.a ../path/libgtmpath.a \
- ../recovery/libgtmrecovery.a ../client/libgtmclient.a ../common/libgtm.a
+include $(top_srcdir)/src/backend/common.mk
-LDFLAGS=-L$(top_builddir)/common -L$(top_builddir)/libpq
-LIBS=-lpthread
+OBJS = $(SUBDIROBJS) \
+ $(top_builddir)/src/port/libpgport_srv.a \
+ $(top_builddir)/src/port/pgsleep.o \
+ proxy_main.o proxy_thread.o proxy_utils.o gtm_proxy_opt.o
-gtm_proxy: $(OBJS)
- $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) $^ $(OTHERS) ../../port/libpgport_srv.a -o $@
+LIBS += $(PTHREAD_LIBS)
-all:gtm_proxy
+all: gtm_proxy
-clean:
- rm -f $(OBJS)
- rm -f gtm_proxy
+gtm_proxy: $(OBJS) | submake-libpgport
+ $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) $(call expand_subsys,$^) -o $@
-distclean: clean
+install: all installdirs
+ $(INSTALL_PROGRAM) gtm_proxy$(X) '$(DESTDIR)$(bindir)/gtm_proxy$(X)'
+ $(INSTALL_DATA) $(srcdir)/gtm_proxy.conf.sample '$(DESTDIR)$(datadir)/gtm_proxy.conf.sample'
-maintainer-clean: distclean
+installdirs:
+ $(MKDIR_P) '$(DESTDIR)$(bindir)' '$(DESTDIR)$(datadir)'
+
+uninstall:
+ rm -f '$(DESTDIR)$(bindir)/gtm_proxy$(X)' '$(DESTDIR)$(datadir)/gtm_proxy.conf.sample'
+
+clean distclean maintainer-clean:
+ rm -f gtm_proxy$(X) $(OBJS)
+
+$(top_builddir)/src/port/libpgport_srv.a: | submake-libpgport
diff --git a/src/gtm/recovery/Makefile b/src/gtm/recovery/Makefile
index e98e0f69fd..f604d2bb65 100644
--- a/src/gtm/recovery/Makefile
+++ b/src/gtm/recovery/Makefile
@@ -11,21 +11,17 @@ top_builddir=../../..
include $(top_builddir)/src/Makefile.global
subdir=src/gtm/recovery
-NAME=gtmrecovery
-SO_MAJOR_VERSION= 1
-SO_MINOR_VERSION= 0
+include $(top_srcdir)/src/backend/common.mk
-OBJS=register_common.o register_gtm.o replication.o standby_utils.o
+OBJS = register_common.o standby_utils.o
-OTHERS=../client/libgtmclient.a
+all: libgtmrecovery.a
-all:all-lib
-
-include $(top_srcdir)/src/Makefile.shlib
+libgtmrecovery.a: $(OBJS)
+ $(AR) $(AROPT) $@ $^
clean:
- rm -f $(OBJS)
- rm -f libgtmrecovery.a libgtmrecovery.so libgtmrecovery.so.1 libgtmrecovery.so.1.0
+ rm -f $(OBJS) libgtmrecovery.a
distclean: clean
diff --git a/src/include/gtm/gtm_standby.h b/src/include/gtm/gtm_standby.h
index e9fa57f6bf..448fc49fbc 100644
--- a/src/include/gtm/gtm_standby.h
+++ b/src/include/gtm/gtm_standby.h
@@ -51,8 +51,9 @@ void gtm_standby_closeActiveConn(void);
void gtm_standby_finishActiveConn(void);
-
-
+/* Functions to process backup */
+void ProcessGTMBeginBackup(Port *myport, StringInfo message);
+void ProcessGTMEndBackup(Port *myport, StringInfo message);
/*
* Startup mode