/** * Reads the node page, sets the id and cached state. Node must be latched exclusively. */ void readNode(Node node, long id) throws IOException { /*P*/ // [ mPageDb.readPage(id, node.mPage); /*P*/ // | /*P*/ // if (mFullyMapped) { /*P*/ // node.mPage = mPageDb.directPagePointer(id); /*P*/ // } else { /*P*/ // mPageDb.readPage(id, node.mPage); /*P*/ // } /*P*/ // ] node.mId = id; // NOTE: If initial state is clean, an optimization is possible, but it's a bit // tricky. Too many pages are allocated when evictions are high, write rate is high, // and commits are bogged down. Keep some sort of cache of ids known to be dirty. If // reloaded before commit, then they're still dirty. // // A Bloom filter is not appropriate, because of false positives. A random evicting // cache works well -- it has no collision chains. Evict whatever else was there in // the slot. An array of longs should suffice. // // When a child node is loaded with a dirty state, the parent nodes must be updated // as well. This might force them to be evicted, and then the optimization is // lost. A better approach would avoid the optimization if the parent node is clean // or doesn't match the current commit state. node.mCachedState = mInitialReadState; }
/** * Reads the node page, sets the id and cached state. Node must be latched exclusively. */ void readNode(Node node, long id) throws IOException { /*P*/ // [ mPageDb.readPage(id, node.mPage); /*P*/ // | /*P*/ // if (mFullyMapped) { /*P*/ // node.mPage = mPageDb.directPagePointer(id); /*P*/ // } else { /*P*/ // mPageDb.readPage(id, node.mPage); /*P*/ // } /*P*/ // ] node.mId = id; // NOTE: If initial state is clean, an optimization is possible, but it's a bit // tricky. Too many pages are allocated when evictions are high, write rate is high, // and commits are bogged down. Keep some sort of cache of ids known to be dirty. If // reloaded before commit, then they're still dirty. // // A Bloom filter is not appropriate, because of false positives. A random evicting // cache works well -- it has no collision chains. Evict whatever else was there in // the slot. An array of longs should suffice. // // When a child node is loaded with a dirty state, the parent nodes must be updated // as well. This might force them to be evicted, and then the optimization is // lost. A better approach would avoid the optimization if the parent node is clean // or doesn't match the current commit state. node.mCachedState = mInitialReadState; }
/** * Reads the node page, sets the id and cached state. Node must be latched exclusively. */ void readNode(Node node, long id) throws IOException { /*P*/ // [ mPageDb.readPage(id, node.mPage); /*P*/ // | /*P*/ // if (mFullyMapped) { /*P*/ // node.mPage = mPageDb.directPagePointer(id); /*P*/ // } else { /*P*/ // mPageDb.readPage(id, node.mPage); /*P*/ // } /*P*/ // ] node.mId = id; // NOTE: If initial state is clean, an optimization is possible, but it's a bit // tricky. Too many pages are allocated when evictions are high, write rate is high, // and commits are bogged down. Keep some sort of cache of ids known to be dirty. If // reloaded before commit, then they're still dirty. // // A Bloom filter is not appropriate, because of false positives. A random evicting // cache works well -- it has no collision chains. Evict whatever else was there in // the slot. An array of longs should suffice. // // When a child node is loaded with a dirty state, the parent nodes must be updated // as well. This might force them to be evicted, and then the optimization is // lost. A better approach would avoid the optimization if the parent node is clean // or doesn't match the current commit state. node.mCachedState = mInitialReadState; }