{
struct ctdb_rec_data *rec = NULL;
struct ctdb_ltdb_header h;
- bool found;
+ bool found = false;
TDB_DATA data;
int i;
return false;
}
+ ZERO_STRUCT(h);
+ ZERO_STRUCT(data);
+
/*
* Walk the list of records written during this
* transaction. If we want to read one we have already
for (i=0; i<buf->count; i++) {
TDB_DATA tkey, tdata;
uint32_t reqid;
+ struct ctdb_ltdb_header hdr;
- rec = db_ctdb_marshall_loop_next(buf, rec, &reqid, &h, &tkey,
+ ZERO_STRUCT(hdr);
+
+ rec = db_ctdb_marshall_loop_next(buf, rec, &reqid, &hdr, &tkey,
&tdata);
if (rec == NULL) {
return false;
if (tdb_data_equal(key, tkey)) {
found = true;
data = tdata;
+ h = hdr;
}
}
key.dsize = strlen(keyname) + 1;
status = db_ctdb_ltdb_fetch(db, key, &header, mem_ctx, &data);
- if (!NT_STATUS_IS_OK(status)) {
+ if (!NT_STATUS_IS_OK(status) &&
+ !NT_STATUS_EQUAL(status, NT_STATUS_NOT_FOUND))
+ {
goto done;
}
+ status = NT_STATUS_OK;
+
if (data.dsize != sizeof(uint64_t)) {
*seqnum = 0;
goto done;
return 0;
}
+ if (h->m_write == NULL) {
+ /*
+ * No changes were made, so don't change the seqnum,
+ * don't push to other node, just exit with success.
+ */
+ ret = 0;
+ goto done;
+ }
+
DEBUG(5,(__location__ " Commit transaction on db 0x%08x\n", ctx->db_id));
/*
}
again:
- if (h->m_write == NULL) {
- /* no changes were made, potentially after a retry */
- goto done;
- }
-
/* tell ctdbd to commit to the other nodes */
rets = ctdbd_control_local(messaging_ctdbd_connection(),
CTDB_CONTROL_TRANS3_COMMIT,
done:
h->ctx->transaction = NULL;
talloc_free(h);
- return 0;
+ return ret;
}