/*
* Check to make sure the DB was not deleted after putting
* it in the dirty map, and prevent the DB from being
* deleted while we're working with it.
*/
DatabaseImpl db = dbTree.getDb
(targetRef.dbId, -1 /*lockTimeout*/, dbCache);
if (db != null && !db.isDeleted()) {
/* Flush if we're below maxFlushLevel. */
int maxFlushLevel = dirtyMap.getHighestFlushLevel(db);
if (currentLevelVal <= maxFlushLevel) {