The branch, master has been updated via df41818 ctdb-daemon: Drop the implementation of CHECK_SRVIDS control via 0772cf4 ctdb-protocol: Drop unused protocol data structures via 66694d8 ctdb-protocol: Drop marshalling code for CHECK_SRVIDS control via 4041cd7 ctdb-client: Drop client code to send CHECK_SRVIDS control via 31c2d0a ctdb-tools: Drop check_srvids command from ctdb tool via 0f424a1 ctdb-protocol: Mark CTDB_CONTROL_CHECK_SRVIDS obsolete via 578a1b1 ctdb-client: Server id exists should check if the pid still exists from 79f5d05 ctdb-tools: Remove duplicate code
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit df41818bef4f980313120f8a6f58dc8be7dddbd9 Author: Amitay Isaacs <ami...@gmail.com> Date: Thu Aug 10 14:50:02 2017 +1000 ctdb-daemon: Drop the implementation of CHECK_SRVIDS control Signed-off-by: Amitay Isaacs <ami...@gmail.com> Reviewed-by: Martin Schwenke <mar...@meltin.net> Autobuild-User(master): Martin Schwenke <mart...@samba.org> Autobuild-Date(master): Mon Aug 14 13:00:16 CEST 2017 on sn-devel-144 commit 0772cf45b4ba52f7d16eafc5597edab44edd3590 Author: Amitay Isaacs <ami...@gmail.com> Date: Fri Aug 4 14:30:41 2017 +1000 ctdb-protocol: Drop unused protocol data structures Signed-off-by: Amitay Isaacs <ami...@gmail.com> Reviewed-by: Martin Schwenke <mar...@meltin.net> commit 66694d89262acd9ce4ed50df935f7ac4b39ae7c9 Author: Amitay Isaacs <ami...@gmail.com> Date: Fri Aug 4 14:27:26 2017 +1000 ctdb-protocol: Drop marshalling code for CHECK_SRVIDS control Signed-off-by: Amitay Isaacs <ami...@gmail.com> Reviewed-by: Martin Schwenke <mar...@meltin.net> commit 4041cd759482260b8579a85faf4b9370308b99f1 Author: Amitay Isaacs <ami...@gmail.com> Date: Fri Aug 4 14:25:04 2017 +1000 ctdb-client: Drop client code to send CHECK_SRVIDS control Signed-off-by: Amitay Isaacs <ami...@gmail.com> Reviewed-by: Martin Schwenke <mar...@meltin.net> commit 31c2d0af04aba6974fd69e1b8a7f21d8d34e5c0a Author: Amitay Isaacs <ami...@gmail.com> Date: Fri Aug 4 14:24:33 2017 +1000 ctdb-tools: Drop check_srvids command from ctdb tool Signed-off-by: Amitay Isaacs <ami...@gmail.com> Reviewed-by: Martin Schwenke <mar...@meltin.net> commit 0f424a118813c9f0afc060bdc39a4f0b84eeb6e3 Author: Amitay Isaacs <ami...@gmail.com> Date: Fri Aug 4 14:06:25 2017 +1000 ctdb-protocol: Mark CTDB_CONTROL_CHECK_SRVIDS obsolete Signed-off-by: Amitay Isaacs <ami...@gmail.com> Reviewed-by: Martin Schwenke <mar...@meltin.net> commit 578a1b1757687719c49772fc43a1ac89c6c846ad Author: Amitay Isaacs <ami...@gmail.com> Date: Fri Aug 4 14:22:31 2017 +1000 ctdb-client: Server id exists should check if the pid still exists This matches what the older client code and samba does. Signed-off-by: Amitay Isaacs <ami...@gmail.com> Reviewed-by: Martin Schwenke <mar...@meltin.net> ----------------------------------------------------------------------- Summary of changes: ctdb/client/client_control_sync.c | 42 ------------------- ctdb/client/client_sync.h | 5 --- ctdb/client/client_util.c | 10 ++--- ctdb/client/ctdb_client.c | 37 ----------------- ctdb/doc/ctdb.1.xml | 19 --------- ctdb/include/ctdb_client.h | 3 -- ctdb/include/ctdb_private.h | 2 - ctdb/protocol/protocol.h | 14 +------ ctdb/protocol/protocol_api.h | 6 --- ctdb/protocol/protocol_client.c | 27 ------------ ctdb/protocol/protocol_control.c | 8 ---- ctdb/protocol/protocol_private.h | 10 ----- ctdb/protocol/protocol_types.c | 78 ----------------------------------- ctdb/server/ctdb_control.c | 2 +- ctdb/server/ctdb_daemon.c | 31 -------------- ctdb/tests/src/protocol_client_test.c | 9 ---- ctdb/tests/src/protocol_types_test.c | 62 ---------------------------- ctdb/tools/ctdb.c | 40 ------------------ 18 files changed, 7 insertions(+), 398 deletions(-) Changeset truncated at 500 lines: diff --git a/ctdb/client/client_control_sync.c b/ctdb/client/client_control_sync.c index 43a941d..fd31823 100644 --- a/ctdb/client/client_control_sync.c +++ b/ctdb/client/client_control_sync.c @@ -2194,48 +2194,6 @@ int ctdb_ctrl_set_db_readonly(TALLOC_CTX *mem_ctx, struct tevent_context *ev, return 0; } -int ctdb_ctrl_check_srvids(TALLOC_CTX *mem_ctx, struct tevent_context *ev, - struct ctdb_client_context *client, - int destnode, struct timeval timeout, - uint64_t *srvid, int count, uint8_t **result) -{ - struct ctdb_uint64_array srvid_list; - struct ctdb_uint8_array *u8_array; - struct ctdb_req_control request; - struct ctdb_reply_control *reply; - int ret; - - srvid_list.num = count; - srvid_list.val = srvid; - - ctdb_req_control_check_srvids(&request, &srvid_list); - ret = ctdb_client_control(mem_ctx, ev, client, destnode, timeout, - &request, &reply); - if (ret != 0) { - DEBUG(DEBUG_ERR, - ("Control CHECK_SRVIDS failed to node %u, ret=%d\n", - destnode, ret)); - return ret; - } - - ret = ctdb_reply_control_check_srvids(reply, &request, &u8_array); - if (ret != 0) { - DEBUG(DEBUG_ERR, - ("Control CHECK_SRVIDS failed, ret=%d\n", ret)); - return ret; - } - - if (u8_array->num != count) { - DEBUG(DEBUG_ERR, - ("Control CHECK_SRVIDS returned invalid data %d != %d\n", - u8_array->num, count)); - return ret; - } - - *result = talloc_steal(mem_ctx, u8_array->val); - return 0; -} - int ctdb_ctrl_traverse_start_ext(TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct ctdb_client_context *client, diff --git a/ctdb/client/client_sync.h b/ctdb/client/client_sync.h index a4b5c49..ceda00f 100644 --- a/ctdb/client/client_sync.h +++ b/ctdb/client/client_sync.h @@ -397,11 +397,6 @@ int ctdb_ctrl_set_db_readonly(TALLOC_CTX *mem_ctx, struct tevent_context *ev, int destnode, struct timeval timeout, uint32_t db_id); -int ctdb_ctrl_check_srvids(TALLOC_CTX *mem_ctx, struct tevent_context *ev, - struct ctdb_client_context *client, - int destnode, struct timeval timeout, - uint64_t *srvid, int count, uint8_t **result); - int ctdb_ctrl_traverse_start_ext(TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct ctdb_client_context *client, diff --git a/ctdb/client/client_util.c b/ctdb/client/client_util.c index f5d0309..c68135f 100644 --- a/ctdb/client/client_util.c +++ b/ctdb/client/client_util.c @@ -117,17 +117,17 @@ int ctdb_server_id_exists(TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct ctdb_client_context *client, struct ctdb_server_id *sid, bool *exists) { - uint8_t *result; + int result; int ret; - ret = ctdb_ctrl_check_srvids(mem_ctx, ev, client, sid->vnn, - tevent_timeval_zero(), - &sid->unique_id, 1, &result); + ret = ctdb_ctrl_process_exists(mem_ctx, ev, client, sid->vnn, + tevent_timeval_zero(), + sid->pid, &result); if (ret != 0) { return ret; } - if (result[0] == 1) { + if (result == 1) { *exists = true; } else { *exists = false; diff --git a/ctdb/client/ctdb_client.c b/ctdb/client/ctdb_client.c index 5ec3d00..47f99bc 100644 --- a/ctdb/client/ctdb_client.c +++ b/ctdb/client/ctdb_client.c @@ -559,43 +559,6 @@ int ctdb_client_remove_message_handler(struct ctdb_context *ctdb, } /* - * 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 */ int ctdb_client_send_message(struct ctdb_context *ctdb, uint32_t pnn, diff --git a/ctdb/doc/ctdb.1.xml b/ctdb/doc/ctdb.1.xml index 3aceb73..dbcbd32 100644 --- a/ctdb/doc/ctdb.1.xml +++ b/ctdb/doc/ctdb.1.xml @@ -1834,25 +1834,6 @@ HEALTH: NO-HEALTHY-NODES - ERROR - Backup of corrupted TDB in '/usr/local/var/li </para> </refsect2> - <refsect2> - <title>check_srvids <parameter>SRVID</parameter> ...</title> - <para> - This command checks whether a set of srvid message ports are - registered on the node or not. The command takes a list of - values to check. - </para> - <refsect3> - <title>Example</title> - <screen> -# ctdb check_srvids 1 2 3 14765 -Server id 0:1 does not exist -Server id 0:2 does not exist -Server id 0:3 does not exist -Server id 0:14765 exists - </screen> - </refsect3> - </refsect2> - </refsect1> <!-- UNDOCUMENTED: showban stats disablemonitor enablemonitor diff --git a/ctdb/include/ctdb_client.h b/ctdb/include/ctdb_client.h index d4fd771..329e354 100644 --- a/ctdb/include/ctdb_client.h +++ b/ctdb/include/ctdb_client.h @@ -95,9 +95,6 @@ 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); /* send a ctdb message */ int ctdb_client_send_message(struct ctdb_context *ctdb, uint32_t pnn, diff --git a/ctdb/include/ctdb_private.h b/ctdb/include/ctdb_private.h index 067777a..5b95b60 100644 --- a/ctdb/include/ctdb_private.h +++ b/ctdb/include/ctdb_private.h @@ -551,8 +551,6 @@ int daemon_register_message_handler(struct ctdb_context *ctdb, uint32_t client_id, uint64_t srvid); int daemon_deregister_message_handler(struct ctdb_context *ctdb, uint32_t client_id, uint64_t srvid); -int daemon_check_srvids(struct ctdb_context *ctdb, TDB_DATA indata, - TDB_DATA *outdata); int ctdb_start_daemon(struct ctdb_context *ctdb, bool do_fork); diff --git a/ctdb/protocol/protocol.h b/ctdb/protocol/protocol.h index ee409f7..67a66c7 100644 --- a/ctdb/protocol/protocol.h +++ b/ctdb/protocol/protocol.h @@ -348,7 +348,7 @@ enum ctdb_controls {CTDB_CONTROL_PROCESS_EXISTS = 0, CTDB_CONTROL_GET_STAT_HISTORY = 127, CTDB_CONTROL_SCHEDULE_FOR_DELETION = 128, CTDB_CONTROL_SET_DB_READONLY = 129, - CTDB_CONTROL_CHECK_SRVIDS = 130, + CTDB_CONTROL_CHECK_SRVIDS = 130, /* obsolete */ CTDB_CONTROL_TRAVERSE_START_EXT = 131, CTDB_CONTROL_GET_DB_STATISTICS = 132, CTDB_CONTROL_SET_DB_STICKY = 133, @@ -800,16 +800,6 @@ struct ctdb_key_data { TDB_DATA key; }; -struct ctdb_uint8_array { - int num; - uint8_t *val; -}; - -struct ctdb_uint64_array { - int num; - uint64_t *val; -}; - struct ctdb_db_statistics { struct { uint32_t num_calls; @@ -876,7 +866,6 @@ struct ctdb_req_control_data { uint64_t srvid; struct ctdb_iface *iface; struct ctdb_key_data *key; - struct ctdb_uint64_array *u64_array; struct ctdb_traverse_start_ext *traverse_start_ext; struct ctdb_traverse_all_ext *traverse_all_ext; } data; @@ -910,7 +899,6 @@ struct ctdb_reply_control_data { struct ctdb_public_ip_info *ipinfo; struct ctdb_iface_list *iface_list; struct ctdb_statistics_list *stats_list; - struct ctdb_uint8_array *u8_array; struct ctdb_db_statistics *dbstats; enum ctdb_runstate runstate; uint32_t num_records; diff --git a/ctdb/protocol/protocol_api.h b/ctdb/protocol/protocol_api.h index a887544..75ded4f 100644 --- a/ctdb/protocol/protocol_api.h +++ b/ctdb/protocol/protocol_api.h @@ -517,12 +517,6 @@ void ctdb_req_control_set_db_readonly(struct ctdb_req_control *request, uint32_t db_id); int ctdb_reply_control_set_db_readonly(struct ctdb_reply_control *reply); -void ctdb_req_control_check_srvids(struct ctdb_req_control *request, - struct ctdb_uint64_array *u64_array); -int ctdb_reply_control_check_srvids(struct ctdb_reply_control *reply, - TALLOC_CTX *mem_ctx, - struct ctdb_uint8_array **u8_array); - void ctdb_req_control_traverse_start_ext(struct ctdb_req_control *request, struct ctdb_traverse_start_ext *traverse); int ctdb_reply_control_traverse_start_ext(struct ctdb_reply_control *reply); diff --git a/ctdb/protocol/protocol_client.c b/ctdb/protocol/protocol_client.c index daa70cc..dbe13d0 100644 --- a/ctdb/protocol/protocol_client.c +++ b/ctdb/protocol/protocol_client.c @@ -1915,33 +1915,6 @@ int ctdb_reply_control_set_db_readonly(struct ctdb_reply_control *reply) /* CTDB_CONTROL_CHECK_SRVIDS */ -void ctdb_req_control_check_srvids(struct ctdb_req_control *request, - struct ctdb_uint64_array *u64_array) -{ - request->opcode = CTDB_CONTROL_CHECK_SRVIDS; - request->pad = 0; - request->srvid = 0; - request->client_id = 0; - request->flags = 0; - - request->rdata.opcode = CTDB_CONTROL_CHECK_SRVIDS; - request->rdata.data.u64_array = u64_array; -} - -int ctdb_reply_control_check_srvids(struct ctdb_reply_control *reply, - TALLOC_CTX *mem_ctx, - struct ctdb_uint8_array **u8_array) -{ - if (reply->rdata.opcode != CTDB_CONTROL_CHECK_SRVIDS) { - return EPROTO; - } - - if (reply->status == 0) { - *u8_array = talloc_steal(mem_ctx, reply->rdata.data.u8_array); - } - return reply->status; -} - /* CTDB_CONTROL_TRAVERSE_START_EXT */ void ctdb_req_control_traverse_start_ext(struct ctdb_req_control *request, diff --git a/ctdb/protocol/protocol_control.c b/ctdb/protocol/protocol_control.c index 3c5c7ce..b999d79 100644 --- a/ctdb/protocol/protocol_control.c +++ b/ctdb/protocol/protocol_control.c @@ -356,7 +356,6 @@ static size_t ctdb_req_control_data_len(struct ctdb_req_control_data *cd) break; case CTDB_CONTROL_CHECK_SRVIDS: - len = ctdb_uint64_array_len(cd->data.u64_array); break; case CTDB_CONTROL_TRAVERSE_START_EXT: @@ -639,7 +638,6 @@ static void ctdb_req_control_data_push(struct ctdb_req_control_data *cd, break; case CTDB_CONTROL_CHECK_SRVIDS: - ctdb_uint64_array_push(cd->data.u64_array, buf); break; case CTDB_CONTROL_TRAVERSE_START_EXT: @@ -962,8 +960,6 @@ static int ctdb_req_control_data_pull(uint8_t *buf, size_t buflen, break; case CTDB_CONTROL_CHECK_SRVIDS: - ret = ctdb_uint64_array_pull(buf, buflen, mem_ctx, - &cd->data.u64_array); break; case CTDB_CONTROL_TRAVERSE_START_EXT: @@ -1344,7 +1340,6 @@ static size_t ctdb_reply_control_data_len(struct ctdb_reply_control_data *cd) break; case CTDB_CONTROL_CHECK_SRVIDS: - len = ctdb_uint8_array_len(cd->data.u8_array); break; case CTDB_CONTROL_TRAVERSE_START_EXT: @@ -1540,7 +1535,6 @@ static void ctdb_reply_control_data_push(struct ctdb_reply_control_data *cd, break; case CTDB_CONTROL_CHECK_SRVIDS: - ctdb_uint8_array_push(cd->data.u8_array, buf); break; case CTDB_CONTROL_GET_DB_STATISTICS: @@ -1728,8 +1722,6 @@ static int ctdb_reply_control_data_pull(uint8_t *buf, size_t buflen, break; case CTDB_CONTROL_CHECK_SRVIDS: - ret = ctdb_uint8_array_pull(buf, buflen, mem_ctx, - &cd->data.u8_array); break; case CTDB_CONTROL_GET_DB_STATISTICS: diff --git a/ctdb/protocol/protocol_private.h b/ctdb/protocol/protocol_private.h index f887ce5..4d854c2 100644 --- a/ctdb/protocol/protocol_private.h +++ b/ctdb/protocol/protocol_private.h @@ -42,16 +42,6 @@ void ctdb_double_push(double val, uint8_t *buf); int ctdb_double_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx, double *out); -size_t ctdb_uint8_array_len(struct ctdb_uint8_array *array); -void ctdb_uint8_array_push(struct ctdb_uint8_array *array, uint8_t *buf); -int ctdb_uint8_array_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx, - struct ctdb_uint8_array **out); - -size_t ctdb_uint64_array_len(struct ctdb_uint64_array *array); -void ctdb_uint64_array_push(struct ctdb_uint64_array *array, uint8_t *buf); -int ctdb_uint64_array_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx, - struct ctdb_uint64_array **out); - size_t ctdb_pid_len(pid_t pid); void ctdb_pid_push(pid_t pid, uint8_t *buf); int ctdb_pid_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx, diff --git a/ctdb/protocol/protocol_types.c b/ctdb/protocol/protocol_types.c index 4115e38..5bdabca 100644 --- a/ctdb/protocol/protocol_types.c +++ b/ctdb/protocol/protocol_types.c @@ -111,84 +111,6 @@ int ctdb_double_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx, return 0; } -size_t ctdb_uint8_array_len(struct ctdb_uint8_array *array) -{ - return array->num * sizeof(uint8_t); -} - -void ctdb_uint8_array_push(struct ctdb_uint8_array *array, uint8_t *buf) -{ - if (array->num > 0) { - memcpy(buf, array->val, array->num * sizeof(uint8_t)); - } -} - -int ctdb_uint8_array_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx, - struct ctdb_uint8_array **out) -{ - struct ctdb_uint8_array *array; - - array = talloc(mem_ctx, struct ctdb_uint8_array); - if (array == NULL) { - return ENOMEM; - } - - array->num = buflen / sizeof(uint8_t); - - if (array->num > 0) { - array->val = talloc_array(array, uint8_t, array->num); - if (array->val == NULL) { - talloc_free(array); - return ENOMEM; - } - memcpy(array->val, buf, buflen); - } else { - array->val = NULL; - } - - *out = array; - return 0; -} - -size_t ctdb_uint64_array_len(struct ctdb_uint64_array *array) -{ - return array->num * sizeof(uint64_t); -} - -void ctdb_uint64_array_push(struct ctdb_uint64_array *array, uint8_t *buf) -{ - if (array->num > 0) { - memcpy(buf, array->val, array->num * sizeof(uint64_t)); - } -} - -int ctdb_uint64_array_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx, - struct ctdb_uint64_array **out) -{ - struct ctdb_uint64_array *array; - - array = talloc(mem_ctx, struct ctdb_uint64_array); - if (array == NULL) { - return ENOMEM; - } - - array->num = buflen / sizeof(uint64_t); - - if (array->num > 0) { - array->val = talloc_array(array, uint64_t, array->num); - if (array->val == NULL) { - talloc_free(array); - return ENOMEM; - } - memcpy(array->val, buf, buflen); - } else { - array->val = NULL; - } - - *out = array; - return 0; -} - size_t ctdb_pid_len(pid_t pid) { return sizeof(pid_t); diff --git a/ctdb/server/ctdb_control.c b/ctdb/server/ctdb_control.c index 4048443..6e9bbeb 100644 --- a/ctdb/server/ctdb_control.c +++ b/ctdb/server/ctdb_control.c @@ -311,7 +311,7 @@ static int32_t ctdb_control_dispatch(struct ctdb_context *ctdb, return daemon_deregister_message_handler(ctdb, client_id, srvid); case CTDB_CONTROL_CHECK_SRVIDS: - return daemon_check_srvids(ctdb, indata, outdata); + return control_not_implemented("CHECK_SRVIDS", NULL); case CTDB_CONTROL_ENABLE_SEQNUM: CHECK_CONTROL_DATA_SIZE(sizeof(uint32_t)); diff --git a/ctdb/server/ctdb_daemon.c b/ctdb/server/ctdb_daemon.c index 1030406..28492ac 100644 --- a/ctdb/server/ctdb_daemon.c +++ b/ctdb/server/ctdb_daemon.c @@ -208,37 +208,6 @@ int daemon_deregister_message_handler(struct ctdb_context *ctdb, uint32_t client return srvid_deregister(ctdb->srv, srvid, client); } -int daemon_check_srvids(struct ctdb_context *ctdb, TDB_DATA indata, - TDB_DATA *outdata) -{ - uint64_t *ids; - int i, num_ids; - uint8_t *results; - - if ((indata.dsize % sizeof(uint64_t)) != 0) { - DEBUG(DEBUG_ERR, ("Bad indata in daemon_check_srvids, " - "size=%d\n", (int)indata.dsize)); - return -1; - } - -- Samba Shared Repository