Skip to content

Refactor #size#1101

Open
MarcusDenker wants to merge 1 commit intomainfrom
refactor-size
Open

Refactor #size#1101
MarcusDenker wants to merge 1 commit intomainfrom
refactor-size

Conversation

@MarcusDenker
Copy link
Copy Markdown
Contributor

  • the forward of size to the iterator in SoilIndex is overridden in both subclasses to read from headerpage, do that here
  • The size in SoilIndexIterator should not be the slow one, as this is very confusing when we fall bacl to the slow case. It is overridden in all subclasses. Use index size here
  • add esxplizit #sizeViaIteration
  • Move size that accesses readVersion to SoilRestoringIndexIterator

This still has the problem that the #size is different if called via the index vs. the iterator. A next refactoring could change it to always forward to the iterator from the index, as we do with many other methods

- the forward of size to the iterator in SoilIndex is overridden in both subclasses to read from headerpage, do that here
- The size in SoilIndexIterator should not be the slow one, as this is very confusing when we fall bacl to the slow case. It is overridden in all subclasses. Use index size here
- add esxplizit #sizeViaIteration
- Move size that accesses readVersion to SoilRestoringIndexIterator

This still has the problem that the #size is different if called via the index vs. the iterator. A next refactoring could change it to *always* forward to the iterator from the index, as we do with many other methods
@MarcusDenker MarcusDenker requested a review from noha March 27, 2026 14:55
the header page is newer than the current transaction we need to scan
the index for the size"
headerPage := index headerPage.
^ (readVersion isNil or: [ headerPage lastTransaction > readVersion ])
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure we should fall back to the scanning one. Especially here no readVersion always scans. And in transactions we want the size for that readVersion and scanning always gives the actual size. Well at least if we are not restoring all pages which would be super slow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants