static void QOTstatisticsInit(void){ oid o=0; int i,j; if (qotStat[QOTnames]) return; #ifdef NEED_MT_LOCK_INIT MT_lock_init(&qotlock,"QOT statistics"); #endif MT_lock_set(&qotlock, "QOT statistics"); qotStat[QOTnames]= QOT_create("opt","names",TYPE_str); BATseqbase(qotStat[QOTnames],o); qotStat[QOTcalls]= QOT_create("opt","calls",TYPE_int); BATseqbase(qotStat[QOTcalls],o); qotStat[QOTactions]= QOT_create("opt","actions",TYPE_int); BATseqbase(qotStat[QOTactions],o); qotStat[QOTtimings]= QOT_create("opt","timings",TYPE_lng); BATseqbase(qotStat[QOTtimings],o); /* recover from errors */ for ( i=0; i<4; i++) if ( qotStat[i] == NULL){ for (j= 0; j < i; j++) BBPclear(qotStat[j]->batCacheid); MT_lock_unset(&qotlock, "QOT statistics"); return; } MT_lock_unset(&qotlock, "QOT statistics"); /* save them at least once */ QOTstatisticsExit(); }
/* in the commit epilogue, the BBP-status of the bats is changed to * reflect their presence in the succeeded checkpoint. Also bats from * the previous checkpoint that were deleted now are physically * destroyed. */ static void epilogue(int cnt, bat *subcommit) { int i = 0; while (++i < cnt) { bat bid = subcommit ? subcommit[i] : i; if (BBP_status(bid) & BBPPERSISTENT) { BBP_status_on(bid, BBPEXISTING, subcommit ? "TMsubcommit" : "TMcommit"); } else if (BBP_status(bid) & BBPDELETED) { /* check mmap modes of bats that are now * transient. this has to be done after the * commit succeeded, because the mmap modes * allowed on transient bats would be * dangerous on persistent bats. If the commit * failed, the already processed bats that * would become transient after the commit, * but didn't due to the failure, would be a * consistency risk. */ BAT *b = BBP_cache(bid); if (b) { /* check mmap modes */ if (BATcheckmodes(b, true) != GDK_SUCCEED) fprintf(stderr, "#epilogue: BATcheckmodes failed\n"); } } if ((BBP_status(bid) & BBPDELETED) && BBP_refs(bid) <= 0 && BBP_lrefs(bid) <= 0) { BAT *b = BBPquickdesc(bid, TRUE); /* the unloaded ones are deleted without * loading deleted disk images */ if (b) { BATdelete(b); if (BBP_cache(bid)) { /* those that quickdesc * decides to load => free * memory */ BATfree(b); } } BBPclear(bid); /* clear with locking */ } BBP_status_off(bid, BBPDELETED | BBPSWAPPED | BBPNEW, subcommit ? "TMsubcommit" : "TMcommit"); } GDKclrerr(); }