From c76f22fd4f5270f113d5795b7746c383cffea477 Mon Sep 17 00:00:00 2001 From: Sears Russell Date: Thu, 23 Oct 2008 20:27:08 +0000 Subject: [PATCH] reduce the risk that broken calls to Tset() will create unrecoverable logs --- src/stasis/operations/set.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/stasis/operations/set.c b/src/stasis/operations/set.c index 59377f8..dfc49f9 100644 --- a/src/stasis/operations/set.c +++ b/src/stasis/operations/set.c @@ -94,11 +94,16 @@ int Tset(int xid, recordid rid, const void * dat) { readlock(p->rwlatch,0); rid = stasis_record_dereference(xid,p,rid); rid.size = stasis_record_type_to_size(rid.size); + if(rid.size > BLOB_THRESHOLD_SIZE) { writeBlob(xid,p,rid,dat); unlock(p->rwlatch); releasePage(p); } else { + if(rid.page == p->id) { + // failing early avoids unrecoverable logs... + assert(rid.size == stasis_record_length_read(xid, p, rid)); + } unlock(p->rwlatch); releasePage(p);