Skip to content

repair: fix forest and fec chainer publish edge cases #5519

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 1 commit into from
Jul 10, 2025

Conversation

emwang-jump
Copy link
Contributor

@emwang-jump emwang-jump commented Jul 1, 2025

fixest publish edge cases specifically for second incremental loading

@emwang-jump emwang-jump force-pushed the emwang/fix-repair-publish branch from 1dcb5d6 to 893a2b5 Compare July 1, 2025 20:16
@emwang-jump emwang-jump marked this pull request as ready for review July 1, 2025 20:16
@emwang-jump emwang-jump force-pushed the emwang/fix-repair-publish branch from 893a2b5 to ee70fdb Compare July 2, 2025 14:56
}
child = fd_forest_pool_ele( pool, child->sibling );
}
ulong remove = fd_forest_orphaned_idx_remove( orphaned, &head->slot, null, pool ); /* remove myself */
Copy link
Member

Choose a reason for hiding this comment

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

clear remove->next too in case there was a map collision (can lead to subtle bugs)

Suggested change
ulong remove = fd_forest_orphaned_idx_remove( orphaned, &head->slot, null, pool ); /* remove myself */
fd_forest_ele_t * remove = fd_forest_orphaned_ele_remove( orphaned, &head->slot, null, pool );
remove->next = idx_null;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed to deque for bfs

fd_forest_ele_t * remove = fd_forest_ancestry_ele_remove( ancestry, &new_root_ele->slot, NULL, pool );
if( FD_UNLIKELY( !remove ) ) {
/* Very rare case where during second incremental load we could publish to an orphaned slot */
remove = fd_forest_orphaned_ele_remove( orphaned, &new_root_ele->slot, NULL, pool );
Copy link
Member

Choose a reason for hiding this comment

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

clear remove->next

@emwang-jump emwang-jump force-pushed the emwang/fix-repair-publish branch 3 times, most recently from 4cf636a to cc1cc9e Compare July 10, 2025 18:50
@@ -42,6 +42,7 @@ fd_forest_new( void * shmem, ulong ele_max, ulong seed ) {
void * ancestry = FD_SCRATCH_ALLOC_APPEND( l, fd_forest_ancestry_align(), fd_forest_ancestry_footprint( ele_max ) );
void * frontier = FD_SCRATCH_ALLOC_APPEND( l, fd_forest_frontier_align(), fd_forest_frontier_footprint( ele_max ) );
void * orphaned = FD_SCRATCH_ALLOC_APPEND( l, fd_forest_orphaned_align(), fd_forest_orphaned_footprint( ele_max ) );
void * deque = FD_SCRATCH_ALLOC_APPEND( l, fd_forest_deque_align(), fd_forest_deque_footprint( ele_max ) );
Copy link
Member

Choose a reason for hiding this comment

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

align footprint starting parens too

@@ -51,6 +52,7 @@ fd_forest_new( void * shmem, ulong ele_max, ulong seed ) {
forest->ancestry_gaddr = fd_wksp_gaddr_fast( wksp, fd_forest_ancestry_join( fd_forest_ancestry_new( ancestry, ele_max, seed ) ) );
forest->frontier_gaddr = fd_wksp_gaddr_fast( wksp, fd_forest_frontier_join( fd_forest_frontier_new( frontier, ele_max, seed ) ) );
forest->orphaned_gaddr = fd_wksp_gaddr_fast( wksp, fd_forest_orphaned_join( fd_forest_orphaned_new( orphaned, ele_max, seed ) ) );
forest->deque_gaddr = fd_wksp_gaddr_fast( wksp, fd_forest_deque_join ( fd_forest_deque_new ( deque, ele_max ) ) );
Copy link
Member

Choose a reason for hiding this comment

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

align

@emwang-jump emwang-jump force-pushed the emwang/fix-repair-publish branch 2 times, most recently from 55600ed to f79f332 Compare July 10, 2025 18:58
@emwang-jump emwang-jump force-pushed the emwang/fix-repair-publish branch from f79f332 to 5240701 Compare July 10, 2025 19:13
ele = fd_ptr_if( !ele, fd_forest_frontier_ele_query( fd_forest_frontier( forest ), &slot, NULL, pool ), ele );
return ele;
FD_FN_PURE static inline ulong *
fd_forest_deque( fd_forest_t * forest ) {
Copy link
Member

Choose a reason for hiding this comment

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

should this be in the .h?

FD_LAYOUT_INIT,
alignof(fd_forest_t), sizeof(fd_forest_t) ),
fd_fseq_align(), fd_fseq_footprint() ),
fd_forest_pool_align(), fd_forest_pool_footprint( ele_max ) ),
fd_forest_ancestry_align(), fd_forest_ancestry_footprint( ele_max ) ),
fd_forest_frontier_align(), fd_forest_frontier_footprint( ele_max ) ),
fd_forest_orphaned_align(), fd_forest_orphaned_footprint( ele_max ) ),
fd_forest_deque_align(), fd_forest_deque_footprint( ele_max ) ),
Copy link
Member

Choose a reason for hiding this comment

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

align

@emwang-jump emwang-jump added this pull request to the merge queue Jul 10, 2025
Merged via the queue into main with commit 0c24570 Jul 10, 2025
11 checks passed
@emwang-jump emwang-jump deleted the emwang/fix-repair-publish branch July 10, 2025 23:06
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