X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Ftdb%2Ftools%2Freplay_trace.c;h=baa56077d65e251caf70d397c972c743e5689c3d;hp=0968deddc23832c5a0203238a275708916190ba4;hb=86c41caf70e0189d5604569eab052e814d294f39;hpb=fadb7502774b18a0621446eb177b0e5cf2af2276 diff --git a/ccan/tdb/tools/replay_trace.c b/ccan/tdb/tools/replay_trace.c index 0968dedd..baa56077 100644 --- a/ccan/tdb/tools/replay_trace.c +++ b/ccan/tdb/tools/replay_trace.c @@ -213,8 +213,7 @@ static void op_add_key(const char *filename, fail(filename, op_num+1, "Expected just a key"); op[op_num].key = make_tdb_data(op, filename, op_num+1, words[2]); - if (op[op_num].op != OP_TDB_TRAVERSE) - total_keys++; + total_keys++; } static void op_add_key_ret(const char *filename, @@ -243,6 +242,16 @@ static void op_add_key_data(const char *filename, total_keys++; } +/* We don't record the keys or data for a traverse, as we don't use them. */ +static void op_add_traverse(const char *filename, + struct op op[], unsigned int op_num, char *words[]) +{ + if (!words[2] || !words[3] || !words[4] || words[5] + || !streq(words[3], "=")) + fail(filename, op_num+1, "Expected = "); + op[op_num].key = tdb_null; +} + /* tdb_store = */ static void op_add_store(const char *filename, struct op op[], unsigned int op_num, char *words[]) @@ -290,8 +299,9 @@ static void op_add_seqnum(const char *filename, op[op_num].ret = atoi(words[3]); } -static void op_add_traverse(const char *filename, - struct op op[], unsigned int op_num, char *words[]) +static void op_add_traverse_start(const char *filename, + struct op op[], + unsigned int op_num, char *words[]) { if (words[2]) fail(filename, op_num+1, "Expect no arguments"); @@ -913,8 +923,7 @@ static const TDB_DATA *gives(const TDB_DATA *key, const TDB_DATA *pre, for (i = 1; i < op->group_len; i++) { /* This skips nested transactions, too */ - if (op[i].op != OP_TDB_TRAVERSE - && key_eq(op[i].key, *key)) + if (key_eq(op[i].key, *key)) pre = gives(key, pre, &op[i]); } return pre; @@ -968,11 +977,6 @@ static struct keyinfo *hash_ops(struct op *op[], unsigned int num_ops[], if (!op[i][j].key.dptr) continue; - /* We don't wait for traverse keys */ - /* FIXME: We should, for trivial traversals. */ - if (op[i][j].op == OP_TDB_TRAVERSE) - continue; - h = hash_key(&op[i][j].key) % (total_keys * 2); while (!key_eq(hash[h].key, op[i][j].key)) { if (!hash[h].key.dptr) { @@ -1025,8 +1029,7 @@ static bool satisfies(const TDB_DATA *key, const TDB_DATA *data, /* Look through for an op in this transaction which * needs this key. */ for (i = 1; i < op->group_len; i++) { - if (op[i].op != OP_TDB_TRAVERSE - && key_eq(op[i].key, *key)) { + if (key_eq(op[i].key, *key)) { need = needs(&op[i]); /* tdb_exists() is special: there might be * something in the transaction with more