예제 #1
0
int runCheckStarted(NDBT_Context* ctx, NDBT_Step* step) {

    // Check cluster is started
    NdbRestarter restarter;
    if(restarter.waitClusterStarted() != 0) {
        g_err << "All nodes was not started " << endl;
        return NDBT_FAILED;
    }

    // Check atrtclient is started
    AtrtClient atrt;
    if(!atrt.waitConnected()) {
        g_err << "atrt server was not started " << endl;
        return NDBT_FAILED;
    }

    // Make sure atrt assigns nodeid != -1
    SqlResultSet procs;
    if (!atrt.doQuery("SELECT * FROM process where type <> \'mysql\'", procs))
        return NDBT_FAILED;

    while (procs.next())
    {
        if (procs.columnAsInt("node_id") == (unsigned)-1) {
            ndbout << "Found one process with node_id -1, "
                   << "use --fix-nodeid=1 to atrt to fix this" << endl;
            return NDBT_FAILED;
        }
    }

    return NDBT_OK;
}
예제 #2
0
static bool
ack_command(AtrtClient& atrtdb, int command_id, const char* state)
{
  BaseString sql;
  sql.assfmt("UPDATE command SET state = '%s' WHERE id = %d",
             state, command_id);
  return atrtdb.doQuery(sql);
}