public void unpin(Block blk) {//释放指定的block Buffer buff = buffers[blk]; bufferMgr.unpin(buff); pins.Remove(blk); if (!pins.Contains(blk)) //当前pins里的这个block没有被其他缓冲区绑定的时候 { buffers.Remove(blk); //就从字典里删除这个blk的所有信息 } }
public override void undo(int txnum) { BufferMgr buffMgr = SimpleDB.bufferMgr(); Buffer buff = buffMgr.pin(blk); buff.setString(offset, val, txnum, -1); buffMgr.unpin(buff); }
public override void undo(int txnum) { BufferMgr buffMgr = SimpleDB.bufferMgr(); //将块绑定到(读入)缓冲区 Buffer buff = buffMgr.pin(blk); //LSN为负数,生成一条临时日志记录,不保存到磁盘 buff.setInt(offset, val, txnum, -1); buffMgr.unpin(buff); }