update the "uptime" command to indicate the "time since last" is the time since the...
authorRonnie Sahlberg <ronniesahlberg@gmail.com>
Wed, 28 Oct 2009 23:37:10 +0000 (10:37 +1100)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Wed, 28 Oct 2009 23:37:10 +0000 (10:37 +1100)
(This used to be ctdb commit 3b0d44497800a16400d05a30bdaf6e6c285d4b36)

ctdb/client/ctdb_client.c
ctdb/config/events.d/61.nfstickle
ctdb/include/ctdb_private.h
ctdb/server/ctdb_control.c
ctdb/server/ctdb_persistent.c
ctdb/tools/ctdb.c

index d47f771d3da817f827fdbe18d2fe2f6991397186..d4130cdf58f2b5ce5cf088e6777002e476cd4c13 100644 (file)
@@ -3141,42 +3141,12 @@ int ctdb_ctrl_getcapabilities(struct ctdb_context *ctdb, struct timeval timeout,
        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;
 };
@@ -3200,7 +3170,6 @@ static int ctdb_transaction_fetch_start(struct ctdb_transaction_handle *h)
        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);
@@ -3211,17 +3180,6 @@ static int ctdb_transaction_fetch_start(struct ctdb_transaction_handle *h)
        }
 
 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);
index 332d0062db1c2dab49a10323e53c11bcb03291c3..3e557e48bfaaf1c4fdbb3ee7bccd7652655e3b95 100755 (executable)
@@ -56,7 +56,7 @@ case $cmd in
        ;;
 
      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`
index 2fabfeaed1e537f4a709e883773d54cb758f0f17..5791df0e4ba77d95dc38f86868b0d408c47409e2 100644 (file)
@@ -620,7 +620,6 @@ enum ctdb_controls {CTDB_CONTROL_PROCESS_EXISTS          = 0,
                    CTDB_CONTROL_TRANSACTION_CANCEL      = 113,
                    CTDB_CONTROL_REGISTER_NOTIFY         = 114,
                    CTDB_CONTROL_DEREGISTER_NOTIFY       = 115,
-                   CTDB_CONTROL_TRANS2_ACTIVE           = 116,
 };     
 
 /*
@@ -1470,8 +1469,6 @@ int32_t ctdb_control_trans2_finished(struct ctdb_context *ctdb,
                                     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);
index b6bad1c99fa274c8c0a49d19d8e8235180736757..7e84078cfa48ce65f289d88cba9763ef12d90a6b 100644 (file)
@@ -424,10 +424,6 @@ static int32_t ctdb_control_dispatch(struct ctdb_context *ctdb,
        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);
index 3c51742b1c2b14e9cb2c13b6f6c34c463c1244d4..cb77bf092d107c9763686f49176487c7a844cf74 100644 (file)
@@ -604,26 +604,6 @@ int32_t ctdb_control_trans2_error(struct ctdb_context *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:
index bad4450103721021e9c9c26956d64852ec19ae5e..c1fe88c535e9d13131b0cad598c2c51feb8dfeb1 100644 (file)
@@ -318,7 +318,7 @@ static int control_uptime(struct ctdb_context *ctdb, int argc, const char **argv
        }
 
        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,
@@ -329,7 +329,7 @@ static int control_uptime(struct ctdb_context *ctdb, int argc, const char **argv
                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;
@@ -339,7 +339,7 @@ static int control_uptime(struct ctdb_context *ctdb, int argc, const char **argv
        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;
@@ -349,9 +349,9 @@ static int control_uptime(struct ctdb_context *ctdb, int argc, const char **argv
        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));