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 void pin(Block blk) {//让缓冲区绑定一个块,并且在内部字典一直维护这个缓冲区和block的联系 Buffer buff = bufferMgr.pin(blk); if (!buffers.ContainsKey(blk)) { buffers.Add(blk, buff); } pins.Add(blk); }
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); }