mirror of
https://github.com/samba-team/samba.git
synced 2025-08-30 17:49:30 +03:00
client: add req timeout argument to ctdb_cmdline_client
Following connection to the local ctdbd, ctdb_cmdline_client() currently issues a CTDB_CONTROL_GET_PNN request with a fixed 3 second timeout. The ctdb cmd line client accepts a --timelimit argument for specifying a per request timeout, pass this value through to ctdb_cmdline_client() for use as a CTDB_CONTROL_GET_PNN request timeout. (This used to be ctdb commit 0634d0305f42f17048b6830733767e8dc300e11c)
This commit is contained in:
@ -111,7 +111,8 @@ struct ctdb_context *ctdb_cmdline_init(struct event_context *ev)
|
|||||||
/*
|
/*
|
||||||
startup a client only ctdb context
|
startup a client only ctdb context
|
||||||
*/
|
*/
|
||||||
struct ctdb_context *ctdb_cmdline_client(struct event_context *ev)
|
struct ctdb_context *ctdb_cmdline_client(struct tevent_context *ev,
|
||||||
|
struct timeval req_timeout)
|
||||||
{
|
{
|
||||||
struct ctdb_context *ctdb;
|
struct ctdb_context *ctdb;
|
||||||
char *socket_name;
|
char *socket_name;
|
||||||
@ -152,7 +153,7 @@ struct ctdb_context *ctdb_cmdline_client(struct event_context *ev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* get our pnn */
|
/* get our pnn */
|
||||||
ctdb->pnn = ctdb_ctrl_getpnn(ctdb, timeval_current_ofs(3, 0), CTDB_CURRENT_NODE);
|
ctdb->pnn = ctdb_ctrl_getpnn(ctdb, req_timeout, CTDB_CURRENT_NODE);
|
||||||
if (ctdb->pnn == (uint32_t)-1) {
|
if (ctdb->pnn == (uint32_t)-1) {
|
||||||
DEBUG(DEBUG_CRIT,(__location__ " Failed to get ctdb pnn\n"));
|
DEBUG(DEBUG_CRIT,(__location__ " Failed to get ctdb pnn\n"));
|
||||||
talloc_free(ctdb);
|
talloc_free(ctdb);
|
||||||
|
@ -188,7 +188,8 @@ int ctdb_register_message_handler(struct ctdb_context *ctdb,
|
|||||||
struct ctdb_db_context *find_ctdb_db(struct ctdb_context *ctdb, uint32_t id);
|
struct ctdb_db_context *find_ctdb_db(struct ctdb_context *ctdb, uint32_t id);
|
||||||
|
|
||||||
|
|
||||||
struct ctdb_context *ctdb_cmdline_client(struct tevent_context *ev);
|
struct ctdb_context *ctdb_cmdline_client(struct tevent_context *ev,
|
||||||
|
struct timeval req_timeout);
|
||||||
|
|
||||||
struct ctdb_statistics;
|
struct ctdb_statistics;
|
||||||
int ctdb_ctrl_statistics(struct ctdb_context *ctdb, uint32_t destnode, struct ctdb_statistics *status);
|
int ctdb_ctrl_statistics(struct ctdb_context *ctdb, uint32_t destnode, struct ctdb_statistics *status);
|
||||||
|
@ -222,7 +222,7 @@ int main(int argc, const char *argv[])
|
|||||||
ev = event_context_init(NULL);
|
ev = event_context_init(NULL);
|
||||||
|
|
||||||
/* initialise ctdb */
|
/* initialise ctdb */
|
||||||
ctdb = ctdb_cmdline_client(ev);
|
ctdb = ctdb_cmdline_client(ev, timeval_current_ofs(3, 0));
|
||||||
|
|
||||||
/* attach to a specific database */
|
/* attach to a specific database */
|
||||||
ctdb_db = ctdb_attach(ctdb, "test.tdb", false, 0);
|
ctdb_db = ctdb_attach(ctdb, "test.tdb", false, 0);
|
||||||
|
@ -207,7 +207,7 @@ int main(int argc, const char *argv[])
|
|||||||
|
|
||||||
ev = event_context_init(NULL);
|
ev = event_context_init(NULL);
|
||||||
|
|
||||||
ctdb = ctdb_cmdline_client(ev);
|
ctdb = ctdb_cmdline_client(ev, timeval_current_ofs(3, 0));
|
||||||
|
|
||||||
if (ctdb == NULL) {
|
if (ctdb == NULL) {
|
||||||
printf("failed to connect to ctdb daemon.\n");
|
printf("failed to connect to ctdb daemon.\n");
|
||||||
|
@ -114,7 +114,7 @@ int main(int argc, const char *argv[])
|
|||||||
|
|
||||||
ev = event_context_init(NULL);
|
ev = event_context_init(NULL);
|
||||||
|
|
||||||
ctdb = ctdb_cmdline_client(ev);
|
ctdb = ctdb_cmdline_client(ev, timeval_current_ofs(3, 0));
|
||||||
|
|
||||||
if (ctdb == NULL) {
|
if (ctdb == NULL) {
|
||||||
printf("failed to connect to ctdb deamon.\n");
|
printf("failed to connect to ctdb deamon.\n");
|
||||||
|
@ -220,7 +220,7 @@ int main(int argc, const char *argv[])
|
|||||||
|
|
||||||
ev = event_context_init(NULL);
|
ev = event_context_init(NULL);
|
||||||
|
|
||||||
ctdb = ctdb_cmdline_client(ev);
|
ctdb = ctdb_cmdline_client(ev, timeval_current_ofs(3, 0));
|
||||||
if (ctdb == NULL) {
|
if (ctdb == NULL) {
|
||||||
printf("Could not attach to daemon\n");
|
printf("Could not attach to daemon\n");
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -181,7 +181,7 @@ int main(int argc, const char *argv[])
|
|||||||
|
|
||||||
ev = event_context_init(NULL);
|
ev = event_context_init(NULL);
|
||||||
|
|
||||||
ctdb = ctdb_cmdline_client(ev);
|
ctdb = ctdb_cmdline_client(ev, timeval_current_ofs(3, 0));
|
||||||
|
|
||||||
if (ctdb == NULL) {
|
if (ctdb == NULL) {
|
||||||
printf("failed to connect to daemon\n");
|
printf("failed to connect to daemon\n");
|
||||||
|
@ -136,7 +136,7 @@ int main(int argc, const char *argv[])
|
|||||||
|
|
||||||
ev = event_context_init(NULL);
|
ev = event_context_init(NULL);
|
||||||
|
|
||||||
ctdb = ctdb_cmdline_client(ev);
|
ctdb = ctdb_cmdline_client(ev, timeval_current_ofs(3, 0));
|
||||||
|
|
||||||
if (ctdb == NULL) {
|
if (ctdb == NULL) {
|
||||||
printf("failed to connect to ctdb daemon.\n");
|
printf("failed to connect to ctdb daemon.\n");
|
||||||
|
@ -252,7 +252,7 @@ int main(int argc, const char *argv[])
|
|||||||
|
|
||||||
ev = event_context_init(NULL);
|
ev = event_context_init(NULL);
|
||||||
|
|
||||||
ctdb = ctdb_cmdline_client(ev);
|
ctdb = ctdb_cmdline_client(ev, timeval_current_ofs(3, 0));
|
||||||
if (ctdb == NULL) {
|
if (ctdb == NULL) {
|
||||||
DEBUG(DEBUG_ERR, ("Could not attach to daemon\n"));
|
DEBUG(DEBUG_ERR, ("Could not attach to daemon\n"));
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -89,7 +89,7 @@ int main(int argc, const char *argv[])
|
|||||||
|
|
||||||
ev = event_context_init(NULL);
|
ev = event_context_init(NULL);
|
||||||
|
|
||||||
ctdb = ctdb_cmdline_client(ev);
|
ctdb = ctdb_cmdline_client(ev, timeval_current_ofs(3, 0));
|
||||||
|
|
||||||
/* attach to a specific database */
|
/* attach to a specific database */
|
||||||
ctdb_db = ctdb_attach(ctdb, dbname, false, 0);
|
ctdb_db = ctdb_attach(ctdb, dbname, false, 0);
|
||||||
|
@ -5134,7 +5134,7 @@ int main(int argc, const char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* initialise ctdb */
|
/* initialise ctdb */
|
||||||
ctdb = ctdb_cmdline_client(ev);
|
ctdb = ctdb_cmdline_client(ev, TIMELIMIT());
|
||||||
|
|
||||||
if (ctdb_commands[i].without_daemon == false) {
|
if (ctdb_commands[i].without_daemon == false) {
|
||||||
const char *socket_name;
|
const char *socket_name;
|
||||||
|
Reference in New Issue
Block a user