You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// Skip previously removed entries — for now, we don't want to list them.
661
+
case.removed:
662
+
/// Skip previously removed entries, unless this index is based on a transient index, and the removed entry was from before the transaction began.
663
+
if !isPersisted {
664
+
newOrderedPages.append(pageInfo)
665
+
}
664
666
continue
665
667
case.existing(let pageID),.added(let pageID):
666
-
/// If we are processing an earlier page, just include it as an existing page. If we are finished inserting, actually create the pages first, then import the existing page.
668
+
/// If we are processing an earlier page or are finished inserting, just include it as an existing page.
667
669
guard index >= insertionPage, !finishedInserting else{
668
-
/// Add the specified page as an existing page.
669
-
newOrderedPages.append(.existing(pageID))
670
+
if isPersisted {
671
+
/// Add the specified page as an existing page, since this is an index based on persisted data.
672
+
newOrderedPages.append(.existing(pageID))
673
+
}else{
674
+
/// Add the specified page as is since we are working off a transient index, and would lose the fact that it may have been recently added otherwise.
/// Mark the existing page as one that no longer exists
706
-
newOrderedPages.append(.removed(pageID))
714
+
/// If the index had data on disk, or it existed prior to the transaction, mark it as removed.
715
+
/// Otherwise, simply skip the page, since we added it in a transient index.
716
+
removedPages.insert(existingPage)
717
+
if isPersisted || pageInfo.isExisting {
718
+
newOrderedPages.append(.removed(pageID))
719
+
}
707
720
708
721
/// Calculate how much room is left on the last page we are making, so we can finish importing the remaining blocks form the original page, creating new pages if necessary.
0 commit comments