Exemple #1
0
        private BufferEntry GetBufferForKey(LowLevelTransaction lltx, long key, byte depth)
        {
            var buffer = lltx.Buffers.GetEntry(Root.FileId, Root.PageNumber);

            using (var tx = lltx.StartNew())
            {
                while (true)
                {
                    if (IsLeaf(buffer))
                    {
                        break;
                    }

                    var page = lltx.CheckLatch(buffer, LatchFlags.Read) ? buffer.Page.AsFixed() : tx.EnterRead(buffer).AsFixed();
                    if (page.Depth == depth)
                    {
                        break;
                    }

                    buffer = tx.Buffers.GetEntry(page.FindPage(key));
                }
            }

            return(buffer);
        }