private void DeleteOnCompressedPage(TreePage page, Slice keyToDelete, ref TreeCursorConstructor cursorConstructor) { var tombstoneNodeSize = page.GetRequiredSpace(keyToDelete, 0); page = ModifyPage(page); if (page.HasSpaceFor(_llt, tombstoneNodeSize)) { if (page.LastMatch == 0) { RemoveLeafNode(page); } page.AddCompressionTombstoneNode(page.LastSearchPosition, keyToDelete); return; } var decompressed = DecompressPage(page, usage: DecompressionUsage.Write); try { decompressed.Search(_llt, keyToDelete); if (decompressed.LastMatch != 0) { return; } State.NumberOfEntries--; RemoveLeafNode(decompressed); using (var cursor = cursorConstructor.Build(keyToDelete)) { var treeRebalancer = new TreeRebalancer(_llt, this, cursor); var changedPage = (TreePage)decompressed; while (changedPage != null) { changedPage = treeRebalancer.Execute(changedPage); } } page.DebugValidate(this, State.RootPageNumber); } finally { decompressed.CopyToOriginal(_llt, defragRequired: true, wasModified: true, this); } }