[SCM] CTDB repository - branch master updated - ctdb-2.4-65-g6182bd0

Amitay Isaacs amitay at samba.org
Thu Oct 3 23:18:40 MDT 2013


The branch, master has been updated
       via  6182bd0c19f215a997efe5272e633b1b1bd0c882 (commit)
       via  10aac42f30cc0d56dca42ece17d04ccbc321056d (commit)
       via  59bd4ede15a5958b87e0d253461eb9111885bd2f (commit)
       via  3296559c43e70f755fcf2c06677891e0319c8142 (commit)
       via  5619754343003016ede27014567dbb4701f97928 (commit)
       via  299fa487549e36572b757852d21471f9e23f6e8f (commit)
       via  c5a7f2b4ff011e1393c4ff34864f85e6b472ff07 (commit)
       via  1585a8e275b0143e5e46311b3d5e9785119f735f (commit)
       via  ae0d8f432ef98a72c85a6cd42c503b718bef0e4e (commit)
       via  cd66282c635cf53386d8970b89c895076ea21cbd (commit)
       via  8cb1fbbfe88327c9c7ab68e8eded586dff611e57 (commit)
       via  1e7fca5cdc1d7205cf084e35aace1a5dc46ea294 (commit)
       via  c9a9d14c91f203ce964a426a8a1e2c1715af2098 (commit)
       via  962eb63c6d500e29a03ae087757d81be449888c6 (commit)
       via  873b9cadbcc363a9e5f450b0a1feb1cf2ce1e6c9 (commit)
       via  d94a10f93a0925b17458d009e604966666b3d880 (commit)
       via  8b238852884004a56f76a1762199c338864d1249 (commit)
      from  713c9ecc791e3319a2d109838471833de5a158c8 (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 6182bd0c19f215a997efe5272e633b1b1bd0c882
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Sep 18 14:27:03 2013 +1000

    tests/tool: Remove references in libctdb in file and function names
    
    Main changes are:
    
      libctdb_test.c -> ctdb_test_stubs.c
      ctdb_tool_libctdb.c -> ctdb_functest.c
    
    ctdb_tool_stubby.c is gone, replaced with existing ctdb_test.c.
    
    Functions starting with "libctdb_test_" now start with
    "ctdb_test_stubs_".
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Pair-programmed-with: Amitay Isaacs <amitay at gmail.com>

commit 10aac42f30cc0d56dca42ece17d04ccbc321056d
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Sep 18 14:01:00 2013 +1000

    tests/tool: Rework test programs so they no longer expect libctdb
    
    Instead, override controls using preprocessor magic.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 59bd4ede15a5958b87e0d253461eb9111885bd2f
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Sep 18 13:43:53 2013 +1000

    tests/tool: Fix some comment typos
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 3296559c43e70f755fcf2c06677891e0319c8142
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Sep 18 13:40:52 2013 +1000

    tools/ctdb: Stop return value from being clobbered in control_lvsmaster()
    
    ret is initialised too early and is clobbered by the call to
    ctdb_ctrl_getcapabilities().  Initialising it later means that the
    function returns -1 when no LVS master is found.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 5619754343003016ede27014567dbb4701f97928
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Sep 18 13:40:10 2013 +1000

    client: Fix some format string compiler warnings
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 299fa487549e36572b757852d21471f9e23f6e8f
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Fri Aug 30 23:38:15 2013 +1000

    common: Fix setting of debug level in the client code
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>

commit c5a7f2b4ff011e1393c4ff34864f85e6b472ff07
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Sun Aug 25 21:44:59 2013 +1000

    libctdb: Remove incomplete libctdb
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>

commit 1585a8e275b0143e5e46311b3d5e9785119f735f
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Tue Aug 27 14:46:08 2013 +1000

    tools/ctdb: Pass memory context for returning nodes in parse_nodestring
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>

commit ae0d8f432ef98a72c85a6cd42c503b718bef0e4e
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Sun Aug 25 21:43:29 2013 +1000

    tests: Do not use libctdb code in tests
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>

commit cd66282c635cf53386d8970b89c895076ea21cbd
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Thu Aug 29 17:22:38 2013 +1000

    tools/ctdb: Do not use libctdb for commandline tool
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>

commit 8cb1fbbfe88327c9c7ab68e8eded586dff611e57
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Fri Aug 23 16:52:24 2013 +1000

    client: Add ctdb_ctrl_getdbseqnum() function
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>

commit 1e7fca5cdc1d7205cf084e35aace1a5dc46ea294
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Fri Aug 23 16:52:02 2013 +1000

    client: Add ctdb_ctrl_getdbstatistics() function
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>

commit c9a9d14c91f203ce964a426a8a1e2c1715af2098
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Fri Aug 23 16:51:26 2013 +1000

    client: Add ctdb_client_check_message_handlers() function
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>

commit 962eb63c6d500e29a03ae087757d81be449888c6
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Fri Aug 23 16:49:46 2013 +1000

    client: Remove extra whitespaces
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>

commit 873b9cadbcc363a9e5f450b0a1feb1cf2ce1e6c9
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Fri Aug 23 17:21:24 2013 +1000

    tests: Remove unused test program ctdb_fetch_lock_once
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>

commit d94a10f93a0925b17458d009e604966666b3d880
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Thu Aug 29 16:58:47 2013 +1000

    tools/ctdb: When printing TDB data as a string, use correct length of the string
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>

commit 8b238852884004a56f76a1762199c338864d1249
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Fri Aug 23 16:57:40 2013 +1000

    tools/ctdb: Remove un-implemented ctdb vacuum command
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>

-----------------------------------------------------------------------

Summary of changes:
 Makefile.in                                        |   51 +-
 client/ctdb_client.c                               |  130 ++-
 common/cmdline.c                                   |    7 +
 include/ctdb_client.h                              |    8 +-
 libctdb/TODO                                       |    3 -
 libctdb/control.c                                  |  538 ---------
 libctdb/ctdb.c                                     | 1221 --------------------
 libctdb/io_elem.c                                  |  164 ---
 libctdb/io_elem.h                                  |   41 -
 libctdb/libctdb_private.h                          |  107 --
 libctdb/local_tdb.c                                |  105 --
 libctdb/local_tdb.h                                |   10 -
 libctdb/logging.c                                  |  110 --
 libctdb/messages.c                                 |  237 ----
 libctdb/messages.h                                 |    9 -
 libctdb/sync.c                                     |  358 ------
 libctdb/test/Makefile                              |   23 -
 libctdb/test/attachdb.c                            |  177 ---
 libctdb/test/ctdb-test.c                           |  454 --------
 libctdb/test/ctdb-test.h                           |   28 -
 libctdb/test/databases.c                           |  134 ---
 libctdb/test/expect.c                              |  300 -----
 libctdb/test/expect.h                              |   35 -
 libctdb/test/failtest.c                            |  344 ------
 libctdb/test/failtest.h                            |   15 -
 libctdb/test/log.c                                 |  233 ----
 libctdb/test/log.h                                 |   47 -
 libctdb/test/readrecordlock.c                      |  197 ----
 libctdb/test/run.sh                                |   83 --
 libctdb/test/tests/attachdb1.txt                   |    8 -
 libctdb/test/tests/connect1.txt                    |    3 -
 libctdb/test/tests/connect2.txt                    |    3 -
 libctdb/test/tests/lockrecord1.txt                 |    8 -
 libctdb/test/tests/lockrecord2.txt                 |   13 -
 libctdb/test/tools/create-links                    |   39 -
 libctdb/test/tools/extract-help                    |   10 -
 libctdb/test/tools/gen-help                        |   52 -
 libctdb/test/tools/gen-usage                       |   56 -
 libctdb/test/tools/text.xsl                        |  111 --
 libctdb/test/tools/usage.xsl                       |   17 -
 libctdb/test/tui.c                                 |  460 --------
 libctdb/test/tui.h                                 |   54 -
 libctdb/test/utils.h                               |   86 --
 libctdb/tst.c                                      |  404 -------
 packaging/RPM/ctdb.spec.in                         |    1 -
 tests/src/ctdb_fetch_lock_once.c                   |  146 ---
 tests/src/ctdb_fetch_readonly_once.c               |   73 +-
 tests/src/{ctdb_tool_libctdb.c => ctdb_functest.c} |   57 +-
 tests/src/ctdb_test.c                              |   53 +-
 tests/src/ctdb_test_stubs.c                        |  529 +++++++++
 tests/src/ctdb_tool_stubby.c                       |   38 -
 tests/src/libctdb_test.c                           |  532 ---------
 tests/tool/README                                  |   10 +-
 tests/tool/scripts/local.sh                        |    4 +-
 tests/tool/stubby.lvsmaster.001.sh                 |    2 +-
 tests/tool/stubby.lvsmaster.002.sh                 |    2 +-
 tools/ctdb.c                                       |  321 ++++--
 tools/ctdb_vacuum.c                                |    9 -
 58 files changed, 988 insertions(+), 7282 deletions(-)
 delete mode 100644 libctdb/TODO
 delete mode 100644 libctdb/control.c
 delete mode 100644 libctdb/ctdb.c
 delete mode 100644 libctdb/io_elem.c
 delete mode 100644 libctdb/io_elem.h
 delete mode 100644 libctdb/libctdb_private.h
 delete mode 100644 libctdb/local_tdb.c
 delete mode 100644 libctdb/local_tdb.h
 delete mode 100644 libctdb/logging.c
 delete mode 100644 libctdb/messages.c
 delete mode 100644 libctdb/messages.h
 delete mode 100644 libctdb/sync.c
 delete mode 100644 libctdb/test/Makefile
 delete mode 100644 libctdb/test/attachdb.c
 delete mode 100644 libctdb/test/ctdb-test.c
 delete mode 100644 libctdb/test/ctdb-test.h
 delete mode 100644 libctdb/test/databases.c
 delete mode 100644 libctdb/test/expect.c
 delete mode 100644 libctdb/test/expect.h
 delete mode 100644 libctdb/test/failtest.c
 delete mode 100644 libctdb/test/failtest.h
 delete mode 100644 libctdb/test/log.c
 delete mode 100644 libctdb/test/log.h
 delete mode 100644 libctdb/test/readrecordlock.c
 delete mode 100755 libctdb/test/run.sh
 delete mode 100644 libctdb/test/tests/attachdb1.txt
 delete mode 100644 libctdb/test/tests/connect1.txt
 delete mode 100644 libctdb/test/tests/connect2.txt
 delete mode 100644 libctdb/test/tests/lockrecord1.txt
 delete mode 100644 libctdb/test/tests/lockrecord2.txt
 delete mode 100755 libctdb/test/tools/create-links
 delete mode 100755 libctdb/test/tools/extract-help
 delete mode 100755 libctdb/test/tools/gen-help
 delete mode 100755 libctdb/test/tools/gen-usage
 delete mode 100644 libctdb/test/tools/text.xsl
 delete mode 100644 libctdb/test/tools/usage.xsl
 delete mode 100644 libctdb/test/tui.c
 delete mode 100644 libctdb/test/tui.h
 delete mode 100644 libctdb/test/utils.h
 delete mode 100644 libctdb/tst.c
 delete mode 100644 tests/src/ctdb_fetch_lock_once.c
 rename tests/src/{ctdb_tool_libctdb.c => ctdb_functest.c} (73%)
 create mode 100644 tests/src/ctdb_test_stubs.c
 delete mode 100644 tests/src/ctdb_tool_stubby.c
 delete mode 100644 tests/src/libctdb_test.c


Changeset truncated at 500 lines:

diff --git a/Makefile.in b/Makefile.in
index 41bdb7e..4e03716 100755
--- a/Makefile.in
+++ b/Makefile.in
@@ -88,10 +88,6 @@ CTDB_COMMON_OBJ =  common/ctdb_io.o common/ctdb_util.o \
 	lib/util/debug.o common/rb_tree.o @CTDB_SYSTEM_OBJ@ common/system_common.o \
 	common/ctdb_logging.o common/ctdb_fork.o
 
-CTDB_LIB_OBJ = libctdb/ctdb.o libctdb/io_elem.o libctdb/local_tdb.o \
-	libctdb/messages.o libctdb/sync.o libctdb/control.o \
-	libctdb/logging.o $(SOCKET_WRAPPER_OBJ)
-
 CTDB_TCP_OBJ = tcp/tcp_connect.o tcp/tcp_io.o tcp/tcp_init.o
 
 CTDB_EXTERNAL_OBJ = $(POPT_OBJ) $(TALLOC_OBJ) $(TDB_OBJ) \
@@ -112,14 +108,13 @@ CTDB_SERVER_OBJ = server/ctdbd.o server/ctdb_daemon.o \
 	$(CTDB_CLIENT_OBJ) $(CTDB_TCP_OBJ) @INFINIBAND_WRAPPER_OBJ@
 
 TEST_BINS=tests/bin/ctdb_bench tests/bin/ctdb_fetch tests/bin/ctdb_fetch_one \
-	tests/bin/ctdb_fetch_lock_once \
 	tests/bin/ctdb_fetch_readonly_once tests/bin/ctdb_fetch_readonly_loop \
 	tests/bin/ctdb_store tests/bin/ctdb_trackingdb_test \
 	tests/bin/ctdb_randrec tests/bin/ctdb_persistent \
 	tests/bin/ctdb_traverse tests/bin/rb_test tests/bin/ctdb_transaction \
 	tests/bin/ctdb_takeover_tests tests/bin/ctdb_update_record \
 	tests/bin/ctdb_update_record_persistent \
-	tests/bin/ctdb_tool_libctdb tests/bin/ctdb_tool_stubby \
+	tests/bin/ctdb_functest tests/bin/ctdb_stubtest \
 	tests/bin/ctdb_porting_tests tests/bin/ctdb_lock_tdb \
 	@INFINIBAND_BINS@
 
@@ -132,7 +127,7 @@ DIRS = lib bin tests/bin
 
 .SUFFIXES: .c .o .h
 
-all: showflags dirs $(CTDB_VERSION_H) $(CTDB_SERVER_OBJ) $(CTDB_CLIENT_OBJ) $(CTDB_LIB_OBJ) $(BINS) $(SBINS) $(TEST_BINS)
+all: showflags dirs $(CTDB_VERSION_H) $(CTDB_SERVER_OBJ) $(CTDB_CLIENT_OBJ) $(BINS) $(SBINS) $(TEST_BINS)
 
 showflags:
 	@echo 'ctdb will be compiled with flags:'
@@ -166,28 +161,13 @@ bin/ctdbd: $(CTDB_SERVER_OBJ)
 	@echo Linking $@
 	$(WRAPPER) $(CC) $(CFLAGS) -o $@ $(CTDB_SERVER_OBJ) $(LIB_FLAGS)
 
-libctdb/libctdb.a: $(CTDB_LIB_OBJ)
-	@echo Linking $@
-	-rm -f libctdb.a
-	$(WRAPPER) $(AR) $(ARFLAGS) libctdb/libctdb.a $(CTDB_LIB_OBJ)
-	$(WRAPPER) $(RANLIB) libctdb/libctdb.a
-
-libctdb/libctdb.so.0: $(CTDB_LIB_OBJ)
-	@echo Linking $@
-	$(WRAPPER) $(SHLD) -Wl,-soname=libctdb.so.0 $(CTDB_LIB_OBJ)
-
-libctdb/libctdb.so: libctdb/libctdb.so.0
-	@echo Creating $@
-	$(WRAPPER) rm -f libctdb/libctdb.so
-	$(WRAPPER) ln -s libctdb.so.0 libctdb/libctdb.so
-
 bin/scsi_io: $(CTDB_CLIENT_OBJ) utils/scsi_io/scsi_io.o 
 	@echo Linking $@
 	$(WRAPPER) $(CC) $(CFLAGS) -o $@ utils/scsi_io/scsi_io.o $(CTDB_CLIENT_OBJ) $(LIB_FLAGS)
 
-bin/ctdb: $(CTDB_CLIENT_OBJ) tools/ctdb.o tools/ctdb_vacuum.o libctdb/libctdb.a
+bin/ctdb: $(CTDB_CLIENT_OBJ) tools/ctdb.o tools/ctdb_vacuum.o
 	@echo Linking $@
-	$(WRAPPER) $(CC) $(CFLAGS) -o $@ tools/ctdb.o tools/ctdb_vacuum.o $(CTDB_CLIENT_OBJ) $(LIB_FLAGS) libctdb/libctdb.a
+	$(WRAPPER) $(CC) $(CFLAGS) -o $@ tools/ctdb.o tools/ctdb_vacuum.o $(CTDB_CLIENT_OBJ) $(LIB_FLAGS)
 
 bin/ltdbtool: tools/ltdbtool.o $(TDB_OBJ)
 	@echo Linking $@
@@ -239,13 +219,9 @@ tests/bin/ctdb_fetch_one: $(CTDB_CLIENT_OBJ) tests/src/ctdb_fetch_one.o
 	@echo Linking $@
 	$(WRAPPER) $(CC) $(CFLAGS) -o $@ tests/src/ctdb_fetch_one.o $(CTDB_CLIENT_OBJ) $(LIB_FLAGS)
 
-tests/bin/ctdb_fetch_lock_once: libctdb/libctdb.a tests/src/ctdb_fetch_lock_once.o $(CTDB_EXTERNAL_OBJ)
-	@echo Linking $@
-	$(WRAPPER) $(CC) $(CFLAGS) -o $@ tests/src/ctdb_fetch_lock_once.o $(CTDB_EXTERNAL_OBJ) libctdb/libctdb.a $(LIB_FLAGS)
-
-tests/bin/ctdb_fetch_readonly_once: libctdb/libctdb.a tests/src/ctdb_fetch_readonly_once.o $(CTDB_EXTERNAL_OBJ)
+tests/bin/ctdb_fetch_readonly_once: tests/src/ctdb_fetch_readonly_once.o $(CTDB_CLIENT_OBJ)
 	@echo Linking $@
-	$(WRAPPER) $(CC) $(CFLAGS) -o $@ tests/src/ctdb_fetch_readonly_once.o $(CTDB_EXTERNAL_OBJ) libctdb/libctdb.a $(LIB_FLAGS)
+	$(WRAPPER) $(CC) $(CFLAGS) -o $@ tests/src/ctdb_fetch_readonly_once.o $(CTDB_CLIENT_OBJ) $(LIB_FLAGS)
 
 tests/bin/ctdb_fetch_readonly_loop: $(CTDB_CLIENT_OBJ) tests/src/ctdb_fetch_readonly_loop.o
 	@echo Linking $@
@@ -290,7 +266,7 @@ tests/bin/ctdb_transaction: $(CTDB_CLIENT_OBJ) tests/src/ctdb_transaction.o
 CTDB_SERVER_MOST_OBJ = $(CTDB_SERVER_OBJ:server/ctdbd.o=)
 CTDBD_TEST_C = $(CTDB_SERVER_MOST_OBJ:.o=.c) tests/src/ctdbd_test.c
 
-CTDB_TEST_C = $(CTDB_CLIENT_OBJ:.o=.c) tools/ctdb.c tools/ctdb_vacuum.c  tests/src/ctdb_test.c
+CTDB_TEST_C =  $(CTDB_CLIENT_OBJ:.o=.c) tools/ctdb.c tools/ctdb_vacuum.c tests/src/ctdb_test_stubs.c
 
 CTDB_TEST_OBJ =  $(TALLOC_OBJ) $(TDB_OBJ) \
 	@CTDB_SYSTEM_OBJ@ $(REPLACE_OBJ) $(EXTRA_OBJ) $(TEVENT_OBJ) $(SOCKET_WRAPPER_OBJ)
@@ -301,17 +277,17 @@ tests/bin/ctdb_takeover_tests: $(CTDB_TEST_OBJ) tests/src/ctdb_takeover_tests.o
 	@echo Linking $@
 	$(WRAPPER) $(CC) $(CFLAGS) -o $@ tests/src/ctdb_takeover_tests.o $(CTDB_TEST_OBJ) $(LIB_FLAGS)
 
-tests/src/ctdb_tool_libctdb.o: tests/src/ctdb_tool_libctdb.c tests/src/libctdb_test.c $(CTDB_TEST_C)
+tests/src/ctdb_functest.o: tests/src/ctdb_functest.c tests/src/ctdb_test.c $(CTDB_TEST_C)
 
-tests/bin/ctdb_tool_libctdb: $(CTDB_TEST_OBJ) tests/src/ctdb_tool_libctdb.o
+tests/bin/ctdb_functest: tests/src/ctdb_functest.o $(CTDB_TEST_OBJ) 
 	@echo Linking $@
-	$(WRAPPER) $(CC) $(CFLAGS) -o $@ tests/src/ctdb_tool_libctdb.o $(CTDB_TEST_OBJ) $(POPT_OBJ) $(LIB_FLAGS)
+	$(WRAPPER) $(CC) $(CFLAGS) -o $@ $^ $(POPT_OBJ) $(LIB_FLAGS)
 
-tests/src/ctdb_tool_stubby.o: tests/src/ctdb_tool_stubby.c tests/src/libctdb_test.c $(CTDB_TEST_C)
+tests/src/ctdb_test.o: tests/src/ctdb_test.c $(CTDB_TEST_C)
 
-tests/bin/ctdb_tool_stubby: $(CTDB_TEST_OBJ) tests/src/ctdb_tool_stubby.o
+tests/bin/ctdb_stubtest: tests/src/ctdb_test.o $(CTDB_TEST_OBJ)
 	@echo Linking $@
-	$(WRAPPER) $(CC) $(CFLAGS) -o $@ tests/src/ctdb_tool_stubby.o $(CTDB_TEST_OBJ) $(POPT_OBJ) $(LIB_FLAGS)
+	$(WRAPPER) $(CC) $(CFLAGS) -o $@ $^ $(POPT_OBJ) $(LIB_FLAGS)
 
 tests/bin/ctdb_lock_tdb: tests/src/ctdb_lock_tdb.o $(CTDB_CLIENT_OBJ)
 	@echo Linking $@
@@ -352,7 +328,6 @@ install: all manpages $(PMDA_INSTALL)
 	$(INSTALLCMD) -m 755 bin/ping_pong $(DESTDIR)$(bindir)
 	$(INSTALLCMD) -m 755 bin/ltdbtool $(DESTDIR)$(bindir)
 	$(INSTALLCMD) -m 755 bin/ctdb_lock_helper $(DESTDIR)$(bindir)
-	$(INSTALLCMD) -m 755 libctdb/libctdb.a $(DESTDIR)$(libdir)
 	${INSTALLCMD} -m 644 include/ctdb.h $(DESTDIR)$(includedir)
 	${INSTALLCMD} -m 644 include/ctdb_client.h $(DESTDIR)$(includedir)
 	${INSTALLCMD} -m 644 include/ctdb_protocol.h $(DESTDIR)$(includedir)
diff --git a/client/ctdb_client.c b/client/ctdb_client.c
index 77147c6..997a234 100644
--- a/client/ctdb_client.c
+++ b/client/ctdb_client.c
@@ -476,11 +476,10 @@ int ctdb_call(struct ctdb_db_context *ctdb_db, struct ctdb_call *call)
 int ctdb_client_set_message_handler(struct ctdb_context *ctdb, uint64_t srvid, 
 			     ctdb_msg_fn_t handler,
 			     void *private_data)
-				    
 {
 	int res;
 	int32_t status;
-	
+
 	res = ctdb_control(ctdb, CTDB_CURRENT_NODE, srvid, CTDB_CONTROL_REGISTER_SRVID, 0, 
 			   tdb_null, NULL, NULL, &status, NULL, NULL);
 	if (res != 0 || status != 0) {
@@ -499,7 +498,7 @@ int ctdb_client_remove_message_handler(struct ctdb_context *ctdb, uint64_t srvid
 {
 	int res;
 	int32_t status;
-	
+
 	res = ctdb_control(ctdb, CTDB_CURRENT_NODE, srvid, CTDB_CONTROL_DEREGISTER_SRVID, 0, 
 			   tdb_null, NULL, NULL, &status, NULL, NULL);
 	if (res != 0 || status != 0) {
@@ -512,6 +511,42 @@ int ctdb_client_remove_message_handler(struct ctdb_context *ctdb, uint64_t srvid
 	return 0;
 }
 
+/*
+ * check server ids
+ */
+int ctdb_client_check_message_handlers(struct ctdb_context *ctdb, uint64_t *ids, uint32_t num,
+				       uint8_t *result)
+{
+	TDB_DATA indata, outdata;
+	int res;
+	int32_t status;
+	int i;
+
+	indata.dptr = (uint8_t *)ids;
+	indata.dsize = num * sizeof(*ids);
+
+	res = ctdb_control(ctdb, CTDB_CURRENT_NODE, 0, CTDB_CONTROL_CHECK_SRVIDS, 0,
+			   indata, ctdb, &outdata, &status, NULL, NULL);
+	if (res != 0 || status != 0) {
+		DEBUG(DEBUG_ERR, (__location__ " failed to check srvids\n"));
+		return -1;
+	}
+
+	if (outdata.dsize != num*sizeof(uint8_t)) {
+		DEBUG(DEBUG_ERR, (__location__ " expected %lu bytes, received %zi bytes\n",
+				  (long unsigned int)num*sizeof(uint8_t),
+				  outdata.dsize));
+		talloc_free(outdata.dptr);
+		return -1;
+	}
+
+	for (i=0; i<num; i++) {
+		result[i] = outdata.dptr[i];
+	}
+
+	talloc_free(outdata.dptr);
+	return 0;
+}
 
 /*
   send a message - from client context
@@ -1199,6 +1234,61 @@ int ctdb_ctrl_statistics(struct ctdb_context *ctdb, uint32_t destnode, struct ct
 }
 
 /*
+ * get db statistics
+ */
+int ctdb_ctrl_dbstatistics(struct ctdb_context *ctdb, uint32_t destnode, uint32_t dbid,
+			   TALLOC_CTX *mem_ctx, struct ctdb_db_statistics **dbstat)
+{
+	int ret;
+	TDB_DATA indata, outdata;
+	int32_t res;
+	struct ctdb_db_statistics *wire, *s;
+	char *ptr;
+	int i;
+
+	indata.dptr = (uint8_t *)&dbid;
+	indata.dsize = sizeof(dbid);
+
+	ret = ctdb_control(ctdb, destnode, 0, CTDB_CONTROL_GET_DB_STATISTICS,
+			   0, indata, ctdb, &outdata, &res, NULL, NULL);
+	if (ret != 0 || res != 0) {
+		DEBUG(DEBUG_ERR,(__location__ " ctdb_control for dbstatistics failed\n"));
+		return -1;
+	}
+
+	if (outdata.dsize < offsetof(struct ctdb_db_statistics, hot_keys_wire)) {
+		DEBUG(DEBUG_ERR,(__location__ " Wrong dbstatistics size %zi - expected >= %lu\n",
+				 outdata.dsize,
+				 (long unsigned int)sizeof(struct ctdb_statistics)));
+		return -1;
+	}
+
+	s = talloc_zero(mem_ctx, struct ctdb_db_statistics);
+	if (s == NULL) {
+		talloc_free(outdata.dptr);
+		CTDB_NO_MEMORY(ctdb, s);
+	}
+
+	wire = (struct ctdb_db_statistics *)outdata.dptr;
+	*s = *wire;
+	ptr = &wire->hot_keys_wire[0];
+	for (i=0; i<wire->num_hot_keys; i++) {
+		s->hot_keys[i].key.dptr = talloc_size(mem_ctx, s->hot_keys[i].key.dsize);
+		if (s->hot_keys[i].key.dptr == NULL) {
+			talloc_free(outdata.dptr);
+			CTDB_NO_MEMORY(ctdb, s->hot_keys[i].key.dptr);
+		}
+
+		memcpy(s->hot_keys[i].key.dptr, ptr, s->hot_keys[i].key.dsize);
+		ptr += wire->hot_keys[i].key.dsize;
+	}
+
+	talloc_free(outdata.dptr);
+	*dbstat = s;
+	return 0;
+}
+
+/*
   shutdown a remote ctdb node
  */
 int ctdb_ctrl_shutdown(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode)
@@ -1771,6 +1861,40 @@ int ctdb_ctrl_getdbhealth(struct ctdb_context *ctdb,
 }
 
 /*
+ * get db sequence number
+ */
+int ctdb_ctrl_getdbseqnum(struct ctdb_context *ctdb, struct timeval timeout,
+			  uint32_t destnode, uint32_t dbid, uint64_t *seqnum)
+{
+	int ret;
+	int32_t res;
+	TDB_DATA data, outdata;
+
+	data.dptr = (uint8_t *)&dbid;
+	data.dsize = sizeof(uint64_t);	/* This is just wrong */
+
+	ret = ctdb_control(ctdb, destnode, 0, CTDB_CONTROL_GET_DB_SEQNUM,
+			   0, data, ctdb, &outdata, &res, &timeout, NULL);
+	if (ret != 0 || res != 0) {
+		DEBUG(DEBUG_ERR,("ctdb_control for getdbesqnum failed\n"));
+		return -1;
+	}
+
+	if (outdata.dsize != sizeof(uint64_t)) {
+		DEBUG(DEBUG_ERR,("Invalid return data in get_dbseqnum\n"));
+		talloc_free(outdata.dptr);
+		return -1;
+	}
+
+	if (seqnum != NULL) {
+		*seqnum = *(uint64_t *)outdata.dptr;
+	}
+	talloc_free(outdata.dptr);
+
+	return 0;
+}
+
+/*
   create a database
  */
 int ctdb_ctrl_createdb(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, 
diff --git a/common/cmdline.c b/common/cmdline.c
index 59e8722..cd59d84 100644
--- a/common/cmdline.c
+++ b/common/cmdline.c
@@ -144,6 +144,13 @@ struct ctdb_context *ctdb_cmdline_client(struct tevent_context *ev,
 		}
 	}
 
+	/* Set the debug level */
+	if (isalpha(ctdb_cmdline.debuglevel[0]) || ctdb_cmdline.debuglevel[0] == '-') { 
+		LogLevel = get_debug_by_desc(ctdb_cmdline.debuglevel);
+	} else {
+		LogLevel = strtol(ctdb_cmdline.debuglevel, NULL, 0);
+	}
+
 	ret = ctdb_socket_connect(ctdb);
 	if (ret != 0) {
 		fprintf(stderr, __location__ " Failed to connect to daemon\n");
diff --git a/include/ctdb_client.h b/include/ctdb_client.h
index 28f0aae..35ce6d1 100644
--- a/include/ctdb_client.h
+++ b/include/ctdb_client.h
@@ -159,7 +159,9 @@ int ctdb_client_set_message_handler(struct ctdb_context *ctdb, uint64_t srvid,
 			     void *private_data);
 int ctdb_client_remove_message_handler(struct ctdb_context *ctdb,
 				       uint64_t srvid, void *private_data);
-
+int ctdb_client_check_message_handlers(struct ctdb_context *ctdb,
+				       uint64_t *ids, uint32_t num,
+				       uint8_t *result);
 
 int ctdb_call(struct ctdb_db_context *ctdb_db, struct ctdb_call *call);
 struct ctdb_client_call_state *ctdb_call_send(struct ctdb_db_context *ctdb_db, struct ctdb_call *call);
@@ -199,6 +201,8 @@ struct ctdb_context *ctdb_cmdline_client(struct tevent_context *ev,
 
 struct ctdb_statistics;
 int ctdb_ctrl_statistics(struct ctdb_context *ctdb, uint32_t destnode, struct ctdb_statistics *status);
+int ctdb_ctrl_dbstatistics(struct ctdb_context *ctdb, uint32_t destnode, uint32_t dbid,
+			   TALLOC_CTX *mem_ctx, struct ctdb_db_statistics **dbstat);
 
 int ctdb_ctrl_shutdown(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode);
 
@@ -289,6 +293,8 @@ int ctdb_ctrl_getdbhealth(struct ctdb_context *ctdb,
 			  uint32_t destnode,
 			  uint32_t dbid, TALLOC_CTX *mem_ctx,
 			  const char **reason);
+int ctdb_ctrl_getdbseqnum(struct ctdb_context *ctdb, struct timeval timeout,
+			  uint32_t destnode, uint32_t dbid, uint64_t *seqnum);
 int ctdb_ctrl_createdb(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, TALLOC_CTX *mem_ctx, const char *name, bool persistent);
 
 int ctdb_ctrl_process_exists(struct ctdb_context *ctdb, uint32_t destnode, pid_t pid);
diff --git a/libctdb/TODO b/libctdb/TODO
deleted file mode 100644
index 82bb141..0000000
--- a/libctdb/TODO
+++ /dev/null
@@ -1,3 +0,0 @@
-- Use CTDB_CONTROL_GET_DB_PRIORITY to ensure db locking is done in order.
-- Attach tdb's logging to libctdb logging.
-- Threadsafe version.
diff --git a/libctdb/control.c b/libctdb/control.c
deleted file mode 100644
index 447a1d1..0000000
--- a/libctdb/control.c
+++ /dev/null
@@ -1,538 +0,0 @@
-/*
-   Misc control routines of libctdb
-
-   Copyright (C) Rusty Russell 2010
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, see <http://www.gnu.org/licenses/>.
-*/
-#include <sys/time.h>
-#include <sys/socket.h>
-#include <string.h>
-#include <ctdb.h>
-#include <ctdb_protocol.h>
-#include "libctdb_private.h"
-
-/* Remove type-safety macros. */
-#undef ctdb_getrecmaster_send
-#undef ctdb_getrecmode_send
-#undef ctdb_getpnn_send
-#undef ctdb_getdbstat_send
-#undef ctdb_check_message_handlers_send
-#undef ctdb_getnodemap_send
-#undef ctdb_getpublicips_send
-#undef ctdb_getdbseqnum_send
-#undef ctdb_getifaces_send
-#undef ctdb_getvnnmap_send
-#undef ctdb_getcapabilities_send
-
-bool ctdb_getrecmaster_recv(struct ctdb_connection *ctdb,
-			   struct ctdb_request *req, uint32_t *recmaster)
-{
-	struct ctdb_reply_control *reply;
-
-	reply = unpack_reply_control(req, CTDB_CONTROL_GET_RECMASTER);
-	if (!reply) {
-		return false;
-	}
-	if (reply->status == -1) {
-		DEBUG(ctdb, LOG_ERR, "ctdb_getrecmaster_recv: status -1");
-		return false;
-	}
-	/* Note: data is stashed in status - see ctdb_control_dispatch() */
-	*recmaster = reply->status;
-	return true;
-}
-
-struct ctdb_request *ctdb_getrecmaster_send(struct ctdb_connection *ctdb,
-					    uint32_t destnode,
-					    ctdb_callback_t callback,
-					    void *private_data)
-{
-	return new_ctdb_control_request(ctdb, CTDB_CONTROL_GET_RECMASTER,
-					destnode, NULL, 0,
-					callback, private_data);
-}
-
-bool ctdb_getrecmode_recv(struct ctdb_connection *ctdb,
-			  struct ctdb_request *req, uint32_t *recmode)
-{
-	struct ctdb_reply_control *reply;
-
-	reply = unpack_reply_control(req, CTDB_CONTROL_GET_RECMODE);
-	if (!reply) {
-		return false;
-	}
-	if (reply->status == -1) {
-		DEBUG(ctdb, LOG_ERR, "ctdb_getrecmode_recv: status -1");
-		return false;
-	}
-	/* Note: data is stashed in status - see ctdb_control_dispatch() */
-	*recmode = reply->status;
-	return true;
-}
-
-struct ctdb_request *ctdb_getrecmode_send(struct ctdb_connection *ctdb,
-					    uint32_t destnode,
-					    ctdb_callback_t callback,
-					    void *private_data)
-{
-	return new_ctdb_control_request(ctdb, CTDB_CONTROL_GET_RECMODE,
-					destnode, NULL, 0,
-					callback, private_data);
-}
-
-bool ctdb_getpnn_recv(struct ctdb_connection *ctdb,
-		     struct ctdb_request *req, uint32_t *pnn)
-{
-	struct ctdb_reply_control *reply;
-
-	reply = unpack_reply_control(req, CTDB_CONTROL_GET_PNN);
-	if (!reply) {
-		return false;
-	}
-	if (reply->status == -1) {
-		DEBUG(ctdb, LOG_ERR, "ctdb_getpnn_recv: status -1");
-		return false;
-	}
-	/* Note: data is stashed in status - see ctdb_control_dispatch() */
-	*pnn = reply->status;
-	return true;
-}
-
-struct ctdb_request *ctdb_getpnn_send(struct ctdb_connection *ctdb,
-				      uint32_t destnode,
-				      ctdb_callback_t callback,
-				      void *private_data)
-{
-	return new_ctdb_control_request(ctdb, CTDB_CONTROL_GET_PNN, destnode,
-					NULL, 0, callback, private_data);
-}
-
-bool ctdb_getdbstat_recv(struct ctdb_connection *ctdb,
-			 struct ctdb_request *req,
-			 struct ctdb_db_statistics **stat)
-{
-	struct ctdb_reply_control *reply;
-	struct ctdb_db_statistics *s, *wire;
-	int i;
-	char *ptr;
-
-	reply = unpack_reply_control(req, CTDB_CONTROL_GET_DB_STATISTICS);
-	if (!reply) {
-		return false;
-	}


-- 
CTDB repository


More information about the samba-cvs mailing list