1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-10 01:18:15 +03:00

- fixed the sort function to include the exsting data

- use numbers below 1000 in test code to make debug easier

- use ctdb_connect_wait()

(This used to be ctdb commit 216850e63e335de7d7cbe6c351d948bb8f1565e7)
This commit is contained in:
Andrew Tridgell 2006-12-01 09:02:17 +11:00
parent 326f2c7f98
commit 559f169aa2

View File

@ -50,10 +50,14 @@ static int sort_func(struct ctdb_call *call)
return CTDB_ERR_NOMEM;
}
call->new_data->dsize = call->record_data.dsize + call->call_data->dsize;
memcpy(call->new_data->dptr,
call->record_data.dptr, call->record_data.dsize);
memcpy(call->new_data->dptr+call->record_data.dsize,
call->call_data->dptr, call->call_data->dsize);
qsort(call->new_data->dptr, call->new_data->dsize / sizeof(int),
sizeof(int), (comparison_fn_t)int_compare);
return 0;
}
@ -156,21 +160,17 @@ int main(int argc, const char *argv[])
/* start the protocol running */
ret = ctdb_start(ctdb);
/* wait until all nodes are connected (should not be needed
outide of test code) */
ctdb_connect_wait(ctdb);
key.dptr = "test";
key.dsize = strlen("test")+1;
#if 1
/* loop for testing */
while (1) {
event_loop_once(ev);
}
#endif
/* add some random data */
for (i=0;i<100;i++) {
int v = random();
int v = random() % 1000;
data.dptr = (uint8_t *)&v;
data.dsize = sizeof(v);
ret = ctdb_call(ctdb, key, FUNC_SORT, &data, NULL);