}
/*
- return the vnn of this node
+ return the pnn of this node
*/
-uint32_t ctdb_get_vnn(struct ctdb_context *ctdb)
+uint32_t ctdb_get_pnn(struct ctdb_context *ctdb)
{
return ctdb->pnn;
}
*/
void ctdb_shutdown(struct ctdb_context *ctdb);
-/* return vnn of this node */
-uint32_t ctdb_get_vnn(struct ctdb_context *ctdb);
+/* return pnn of this node */
+uint32_t ctdb_get_pnn(struct ctdb_context *ctdb);
/*
return the number of nodes
int res;
/* maybe the message is for another client on this node */
- if (ctdb_get_vnn(client->ctdb)==c->hdr.destnode) {
+ if (ctdb_get_pnn(client->ctdb)==c->hdr.destnode) {
ctdb_request_message(client->ctdb, (struct ctdb_req_header *)c);
return;
}
send a new election message to all other nodes
*/
if (ctdb_election_win(rec, em)) {
- ret = send_election_request(rec, mem_ctx, ctdb_get_vnn(ctdb));
+ ret = send_election_request(rec, mem_ctx, ctdb_get_pnn(ctdb));
if (ret!=0) {
DEBUG(0, (__location__ " failed to initiate recmaster election"));
}
}
/* ok, let that guy become recmaster then */
- ret = ctdb_ctrl_setrecmaster(ctdb, CONTROL_TIMEOUT(), ctdb_get_vnn(ctdb), em->vnn);
+ ret = ctdb_ctrl_setrecmaster(ctdb, CONTROL_TIMEOUT(), ctdb_get_pnn(ctdb), em->vnn);
if (ret != 0) {
DEBUG(0, (__location__ " failed to send recmaster election request"));
talloc_free(mem_ctx);
int *count = (int *)private_data;
int dest;
(*count)++;
- dest = (ctdb_get_vnn(ctdb) + incr) % num_nodes;
+ dest = (ctdb_get_pnn(ctdb) + incr) % num_nodes;
ctdb_send_message(ctdb, dest, srvid, data);
if (incr == 1) {
msg_plus++;
*/
static void bench_ring(struct ctdb_context *ctdb, struct event_context *ev)
{
- int vnn=ctdb_get_vnn(ctdb);
+ int pnn=ctdb_get_pnn(ctdb);
- if (vnn == 0) {
+ if (pnn == 0) {
/* two messages are injected into the ring, moving
in opposite directions */
int dest, incr;
data.dsize = sizeof(incr);
incr = 1;
- dest = (ctdb_get_vnn(ctdb) + incr) % num_nodes;
+ dest = (ctdb_get_pnn(ctdb) + incr) % num_nodes;
ctdb_send_message(ctdb, dest, 0, data);
incr = -1;
- dest = (ctdb_get_vnn(ctdb) + incr) % num_nodes;
+ dest = (ctdb_get_pnn(ctdb) + incr) % num_nodes;
ctdb_send_message(ctdb, dest, 0, data);
}
start_timer();
while (end_timer() < timelimit) {
- if (vnn == 0 && msg_count % 10000 == 0) {
+ if (pnn == 0 && msg_count % 10000 == 0) {
printf("Ring: %.2f msgs/sec (+ve=%d -ve=%d)\r",
msg_count/end_timer(), msg_plus, msg_minus);
fflush(stdout);
h = ctdb_fetch_lock(ctdb_db, tmp_ctx, key, &data);
if (h == NULL) {
printf("Failed to fetch record '%s' on node %d\n",
- (const char *)key.dptr, ctdb_get_vnn(ctdb));
+ (const char *)key.dptr, ctdb_get_pnn(ctdb));
talloc_free(tmp_ctx);
return;
}
}
data.dptr = (uint8_t *)talloc_asprintf_append((char *)data.dptr,
"msg_count=%d on node %d\n",
- msg_count, ctdb_get_vnn(ctdb));
+ msg_count, ctdb_get_pnn(ctdb));
data.dsize = strlen((const char *)data.dptr)+1;
ret = ctdb_record_store(h, data);
nulldata.dptr = NULL;
nulldata.dsize = 0;
- dest = (ctdb_get_vnn(ctdb) + 1) % num_nodes;
+ dest = (ctdb_get_pnn(ctdb) + 1) % num_nodes;
ctdb_send_message(ctdb, dest, 0, nulldata);
}
*/
static void bench_fetch(struct ctdb_context *ctdb, struct event_context *ev)
{
- int vnn=ctdb_get_vnn(ctdb);
+ int pnn=ctdb_get_pnn(ctdb);
- if (vnn == num_nodes - 1) {
+ if (pnn == num_nodes - 1) {
bench_fetch_1node(ctdb);
}
start_timer();
while (end_timer() < timelimit) {
- if (vnn == 0 && msg_count % 100 == 0) {
+ if (pnn == 0 && msg_count % 100 == 0) {
printf("Fetch: %.2f msgs/sec\r", msg_count/end_timer());
fflush(stdout);
}
h = ctdb_fetch_lock(ctdb_db, tmp_ctx, key, &data);
if (h == NULL) {
printf("Failed to fetch record '%s' on node %d\n",
- (const char *)key.dptr, ctdb_get_vnn(ctdb));
+ (const char *)key.dptr, ctdb_get_pnn(ctdb));
talloc_free(tmp_ctx);
return;
}
h = ctdb_fetch_lock(ctdb_db, tmp_ctx, key, &data);
if (h == NULL) {
printf("Failed to fetch record '%s' on node %d\n",
- (const char *)key.dptr, ctdb_get_vnn(ctdb));
+ (const char *)key.dptr, ctdb_get_pnn(ctdb));
talloc_free(tmp_ctx);
return;
}