The logic bug was that if a record was found in the marshall buffer,
then always the ctdb header of tha last record in the marshall buffer
was returned, and not the ctdb header of the last occurrence of the
requested record.
This is fixed by introducing an additional temporary variable.
Michael
(cherry picked from commit
524072b56bf659002410a817749bf86fe6f51e83)
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;
}
}