Skip to content

Heap bitmap scan prefetch fix2 v14 #275

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 7, 2023

Conversation

knizhnik
Copy link

@knizhnik knizhnik commented Apr 3, 2023

Sorry, one more bug fix for bitmap heap scan prefetch.
There were actually two errors:

  1. Initialization of prefetch state for parallel scan was done only in leader (originally it was stored in shared state but not it is local per worker)
  2. When perfetch_target is 0 (initially), next iteration result is taken not from prefetch ring buffer, but from iterator and is later overwritten by prefetch. It should be copied.

This is why with very small probability, if first element is proceeded not by leader, but by some other parallek worker select_prefetch.sql test may fail (neondatabase/neon#3928)

This PR contain fix of this problem why copying iterators result.
Also optimization of copy is implemented; only actually needed number of item offsets is copied instead of MaxHeapTuplesPerPage

@knizhnik knizhnik merged commit 05108c9 into REL_14_STABLE_neon Apr 7, 2023
@knizhnik knizhnik deleted the heap_bitmap_scan_prefetch_fix2_v14 branch April 7, 2023 05:45
MMeent pushed a commit that referenced this pull request May 11, 2023
* Copy iterator result in BitmapHeapNext

* Restore initial -1 value for prefetch_target

* Add tbmres_copy to BitmapHeapScanState
tristan957 pushed a commit that referenced this pull request Aug 10, 2023
* Copy iterator result in BitmapHeapNext

* Restore initial -1 value for prefetch_target

* Add tbmres_copy to BitmapHeapScanState
tristan957 pushed a commit that referenced this pull request Nov 8, 2023
* Copy iterator result in BitmapHeapNext

* Restore initial -1 value for prefetch_target

* Add tbmres_copy to BitmapHeapScanState
tristan957 pushed a commit that referenced this pull request Nov 8, 2023
* Copy iterator result in BitmapHeapNext

* Restore initial -1 value for prefetch_target

* Add tbmres_copy to BitmapHeapScanState
tristan957 pushed a commit that referenced this pull request Feb 5, 2024
* Copy iterator result in BitmapHeapNext

* Restore initial -1 value for prefetch_target

* Add tbmres_copy to BitmapHeapScanState
tristan957 pushed a commit that referenced this pull request Feb 5, 2024
* Copy iterator result in BitmapHeapNext

* Restore initial -1 value for prefetch_target

* Add tbmres_copy to BitmapHeapScanState
tristan957 pushed a commit that referenced this pull request Feb 6, 2024
* Copy iterator result in BitmapHeapNext

* Restore initial -1 value for prefetch_target

* Add tbmres_copy to BitmapHeapScanState
tristan957 pushed a commit that referenced this pull request May 10, 2024
* Copy iterator result in BitmapHeapNext

* Restore initial -1 value for prefetch_target

* Add tbmres_copy to BitmapHeapScanState
tristan957 pushed a commit that referenced this pull request May 20, 2024
* Copy iterator result in BitmapHeapNext

* Restore initial -1 value for prefetch_target

* Add tbmres_copy to BitmapHeapScanState
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