return ret;
}
-/**
- * check whether a transaction is active on a given db on a given node
- */
-static int32_t ctdb_ctrl_transaction_active(struct ctdb_context *ctdb,
- uint32_t destnode,
- uint32_t db_id)
-{
- int32_t status;
- int ret;
- TDB_DATA indata;
-
- indata.dptr = (uint8_t *)&db_id;
- indata.dsize = sizeof(db_id);
-
- ret = ctdb_control(ctdb, destnode, 0,
- CTDB_CONTROL_TRANS2_ACTIVE,
- 0, indata, NULL, NULL, &status,
- NULL, NULL);
-
- if (ret != 0) {
- DEBUG(DEBUG_ERR, (__location__ " ctdb control for transaction_active failed\n"));
- return -1;
- }
-
- return status;
-}
-
-
struct ctdb_transaction_handle {
struct ctdb_db_context *ctdb_db;
bool in_replay;
- /*
- * we store the reads and writes done under a transaction:
- * - one list stores both reads and writes (m_all),
- * - the other just writes (m_write)
- */
+ /* we store the reads and writes done under a transaction one
+ list stores both reads and writes, the other just writes
+ */
struct ctdb_marshall_buffer *m_all;
struct ctdb_marshall_buffer *m_write;
};
int ret;
struct ctdb_db_context *ctdb_db = h->ctdb_db;
pid_t pid;
- int32_t status;
key.dptr = discard_const(keyname);
key.dsize = strlen(keyname);
}
again:
- status = ctdb_ctrl_transaction_active(ctdb_db->ctdb,
- CTDB_CURRENT_NODE,
- ctdb_db->db_id);
- if (status == 1) {
- DEBUG(DEBUG_NOTICE, (__location__ " transaction is active "
- "on db_id[%u]. waiting for 1 second\n",
- ctdb_db->db_id));
- sleep(1);
- goto again;
- }
-
tmp_ctx = talloc_new(h);
rh = ctdb_fetch_lock(ctdb_db, tmp_ctx, key, NULL);
;;
monitor)
- # always create these direcotries since NFS might be enabled at runtime
+# always create these direcotries since NFS might be enabled at runtime
# and we dont want to restart ctdbd
mkdir -p $CTDB_BASE/state/nfstickle
mkdir -p $NFS_TICKLE_SHARED_DIRECTORY/`hostname`
CTDB_CONTROL_TRANSACTION_CANCEL = 113,
CTDB_CONTROL_REGISTER_NOTIFY = 114,
CTDB_CONTROL_DEREGISTER_NOTIFY = 115,
- CTDB_CONTROL_TRANS2_ACTIVE = 116,
};
/*
struct ctdb_req_control *c);
int32_t ctdb_control_trans2_error(struct ctdb_context *ctdb,
struct ctdb_req_control *c);
-int32_t ctdb_control_trans2_active(struct ctdb_context *ctdb,
- uint32_t db_id);
char *ctdb_addr_to_str(ctdb_sock_addr *addr);
unsigned ctdb_addr_to_port(ctdb_sock_addr *addr);
case CTDB_CONTROL_TRANS2_FINISHED:
return ctdb_control_trans2_finished(ctdb, c);
- case CTDB_CONTROL_TRANS2_ACTIVE:
- CHECK_CONTROL_DATA_SIZE(sizeof(uint32_t));
- return ctdb_control_trans2_active(ctdb, *(uint32_t *)indata.dptr);
-
case CTDB_CONTROL_RECD_PING:
CHECK_CONTROL_DATA_SIZE(0);
return ctdb_control_recd_ping(ctdb);
return 0;
}
-/**
- * Tell whether a transaction is active on this node on the give DB.
- */
-int32_t ctdb_control_trans2_active(struct ctdb_context *ctdb,
- uint32_t db_id)
-{
- struct ctdb_db_context *ctdb_db;
-
- ctdb_db = find_ctdb_db(ctdb, db_id);
- if (!ctdb_db) {
- DEBUG(DEBUG_ERR,(__location__ " Unknown db 0x%08x\n", db_id));
- return -1;
- }
-
- if (ctdb_db->transaction_active) {
- return 1;
- } else {
- return 0;
- }
-}
/*
backwards compatibility:
}
if (options.machinereadable){
- printf(":Current Node Time:Ctdb Start Time:Last Recovery Time:Last Recovery Duration:\n");
+ printf(":Current Node Time:Ctdb Start Time:Last Recovery/Failover Time:Last Recovery/IPFailover Duration:\n");
printf(":%u:%u:%u:%lf\n",
(unsigned int)uptime->current_time.tv_sec,
(unsigned int)uptime->ctdbd_start_time.tv_sec,
return 0;
}
- printf("Current time of node : %s", ctime(&uptime->current_time.tv_sec));
+ printf("Current time of node : %s", ctime(&uptime->current_time.tv_sec));
tmp = uptime->current_time.tv_sec - uptime->ctdbd_start_time.tv_sec;
seconds = tmp%60;
hours = tmp%24;
tmp /= 24;
days = tmp;
- printf("Ctdbd start time : (%03d %02d:%02d:%02d) %s", days, hours, minutes, seconds, ctime(&uptime->ctdbd_start_time.tv_sec));
+ printf("Ctdbd start time : (%03d %02d:%02d:%02d) %s", days, hours, minutes, seconds, ctime(&uptime->ctdbd_start_time.tv_sec));
tmp = uptime->current_time.tv_sec - uptime->last_recovery_finished.tv_sec;
seconds = tmp%60;
hours = tmp%24;
tmp /= 24;
days = tmp;
- printf("Time of last recovery : (%03d %02d:%02d:%02d) %s", days, hours, minutes, seconds, ctime(&uptime->last_recovery_finished.tv_sec));
+ printf("Time of last recovery/failover: (%03d %02d:%02d:%02d) %s", days, hours, minutes, seconds, ctime(&uptime->last_recovery_finished.tv_sec));
- printf("Duration of last recovery : %lf seconds\n",
+ printf("Duration of last recovery/failover: %lf seconds\n",
timeval_delta(&uptime->last_recovery_finished,
&uptime->last_recovery_started));