mirror of
https://github.com/samba-team/samba.git
synced 2025-01-26 10:04:02 +03:00
ctdb-daemon: Simplify code using local variable
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
parent
eb1b211c9e
commit
12fd2ddc01
@ -58,6 +58,7 @@ static int ctdb_ltdb_store_server(struct ctdb_db_context *ctdb_db,
|
||||
{
|
||||
struct ctdb_context *ctdb = ctdb_db->ctdb;
|
||||
TDB_DATA rec;
|
||||
uint32_t hsize = sizeof(struct ctdb_ltdb_header);
|
||||
int ret;
|
||||
bool seqnum_suppressed = false;
|
||||
bool keep = false;
|
||||
@ -66,14 +67,21 @@ static int ctdb_ltdb_store_server(struct ctdb_db_context *ctdb_db,
|
||||
uint32_t lmaster;
|
||||
|
||||
if (ctdb->flags & CTDB_FLAG_TORTURE) {
|
||||
TDB_DATA old;
|
||||
struct ctdb_ltdb_header *h2;
|
||||
rec = tdb_fetch(ctdb_db->ltdb->tdb, key);
|
||||
h2 = (struct ctdb_ltdb_header *)rec.dptr;
|
||||
if (rec.dptr && rec.dsize >= sizeof(h2) && h2->rsn > header->rsn) {
|
||||
DEBUG(DEBUG_CRIT,("RSN regression! %llu %llu\n",
|
||||
(unsigned long long)h2->rsn, (unsigned long long)header->rsn));
|
||||
|
||||
old = tdb_fetch(ctdb_db->ltdb->tdb, key);
|
||||
h2 = (struct ctdb_ltdb_header *)old.dptr;
|
||||
if (old.dptr != NULL &&
|
||||
old.dsize >= hsize &&
|
||||
h2->rsn > header->rsn) {
|
||||
DEBUG(DEBUG_ERR,
|
||||
("RSN regression! %"PRIu64" %"PRIu64"\n",
|
||||
h2->rsn, header->rsn));
|
||||
}
|
||||
if (old.dptr) {
|
||||
free(old.dptr);
|
||||
}
|
||||
if (rec.dptr) free(rec.dptr);
|
||||
}
|
||||
|
||||
if (ctdb->vnn_map == NULL) {
|
||||
@ -191,14 +199,14 @@ store:
|
||||
TDB_DATA old;
|
||||
old = tdb_fetch(ctdb_db->ltdb->tdb, key);
|
||||
|
||||
if ( (old.dsize == rec.dsize)
|
||||
&& !memcmp(old.dptr+sizeof(struct ctdb_ltdb_header),
|
||||
rec.dptr+sizeof(struct ctdb_ltdb_header),
|
||||
rec.dsize-sizeof(struct ctdb_ltdb_header)) ) {
|
||||
if ((old.dsize == hsize + data.dsize) &&
|
||||
memcmp(old.dptr + hsize, data.dptr, data.dsize) == 0) {
|
||||
tdb_remove_flags(ctdb_db->ltdb->tdb, TDB_SEQNUM);
|
||||
seqnum_suppressed = true;
|
||||
}
|
||||
if (old.dptr) free(old.dptr);
|
||||
if (old.dptr != NULL) {
|
||||
free(old.dptr);
|
||||
}
|
||||
}
|
||||
|
||||
DEBUG(DEBUG_DEBUG, (__location__ " db[%s]: %s record: hash[0x%08x]\n",
|
||||
|
Loading…
x
Reference in New Issue
Block a user