Skip to content

Conversation

@rkuris
Copy link
Member

@rkuris rkuris commented Jul 23, 2025

No description provided.

@rkuris rkuris self-assigned this Jul 23, 2025
@rkuris rkuris added observability logging, tracing and metrics enhancement New feature or request labels Jul 23, 2025
@rkuris rkuris changed the title Rkuris/track unwritten nodes feat(deferred-persist): Part 1: unpersisted gauge Jul 23, 2025
@rkuris rkuris force-pushed the rkuris/track-unwritten-nodes branch from dff9f97 to aaf968f Compare July 23, 2025 05:39
@github-actions

This comment was marked as resolved.

@rkuris rkuris force-pushed the rkuris/track-unwritten-nodes branch 3 times, most recently from 56826d7 to e53e961 Compare July 23, 2025 22:42
@ava-labs ava-labs deleted a comment from github-actions bot Jul 24, 2025
@rkuris rkuris force-pushed the rkuris/track-unwritten-nodes branch from 308f06a to 7b4c667 Compare July 24, 2025 03:45
@ava-labs ava-labs deleted a comment from github-actions bot Jul 24, 2025
@ava-labs ava-labs deleted a comment from github-actions bot Jul 24, 2025
@ava-labs ava-labs deleted a comment from github-actions bot Jul 24, 2025
@ava-labs ava-labs deleted a comment from github-actions bot Jul 24, 2025
@ava-labs ava-labs deleted a comment from github-actions bot Jul 24, 2025
@rkuris rkuris force-pushed the rkuris/track-unwritten-nodes branch from 7b4c667 to bb4826f Compare July 24, 2025 03:49
@ava-labs ava-labs deleted a comment from github-actions bot Jul 24, 2025
@ava-labs ava-labs deleted a comment from github-actions bot Jul 24, 2025
@rkuris rkuris marked this pull request as ready for review July 24, 2025 03:54
@rkuris rkuris requested a review from demosdemon as a code owner July 24, 2025 03:54
Comment on lines +372 to +375
unwritten_nodes: AtomicUsize::new(
self.unwritten_nodes
.load(std::sync::atomic::Ordering::Relaxed),
),
Copy link
Contributor

Choose a reason for hiding this comment

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

Confirming that this is intentional the the cloned committed is using a new atomic integer and isn't re-using the integer from the previous cloned. The diverging committed nodes will have different unwritten_nodes counts.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch, it's not correct. I'll remove this code as it's dead anyway; we never clone Committed.


let immutable_proposal =
Arc::into_inner(nodestore.kind).expect("no other references to the proposal");
// Use ManuallyDrop to prevent Drop from running since we're replacing the proposal
Copy link
Contributor

@demosdemon demosdemon Jul 24, 2025

Choose a reason for hiding this comment

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

can you expand the comment to explain the implications of not using ManuallyDrop here?

// Decrement gauge for writes that have actually completed
if completed_writes > 0 {
#[expect(clippy::cast_possible_truncation)]
#[expect(clippy::cast_possible_truncation, clippy::cast_precision_loss)]
Copy link
Contributor

Choose a reason for hiding this comment

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

not understanding the lint problems here. some targets are triggering it and some aren't.

Copy link
Contributor

@demosdemon demosdemon Jul 24, 2025

Choose a reason for hiding this comment

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

let's switch to allow and I'll research this next week (#1135)

rkuris and others added 4 commits July 29, 2025 16:17
Added a gauge to track the number of unpersisted nodes at any time.
These can get used later by the revision manager to decide whether or
not to persist a proposal (among other possible strategies).

It's also helpful to know how many nodes are still in memory that could
be persisted.

When increasing this counter, we do it all at once, but we decrement one
by one (or by the number of entries from the kernel's completion queue).
This is because the writes are slower than the adds, and there is some
integer to floating point math that happens each time the counter is
adjusted.
@rkuris rkuris force-pushed the rkuris/track-unwritten-nodes branch from 8dcfe36 to 57cdd41 Compare July 29, 2025 23:17
@rkuris rkuris enabled auto-merge (squash) July 29, 2025 23:18
@rkuris rkuris force-pushed the rkuris/track-unwritten-nodes branch from 900779f to 1ea7a63 Compare July 30, 2025 16:42
@rkuris rkuris merged commit 11c9c95 into main Aug 1, 2025
40 checks passed
@rkuris rkuris deleted the rkuris/track-unwritten-nodes branch August 1, 2025 21:40
bernard-avalabs pushed a commit that referenced this pull request Aug 10, 2025
Co-authored-by: Brandon LeBlanc <brandon.leblanc@avalabs.org>
rkuris added a commit that referenced this pull request Sep 26, 2025
The use of ManuallyDrop seems to cause a leak. Let's fix this correctly
later.
rkuris added a commit that referenced this pull request Sep 26, 2025
The use of ManuallyDrop seems to cause a leak. Let's fix this correctly
later.
demosdemon pushed a commit that referenced this pull request Sep 26, 2025
The use of ManuallyDrop seems to cause a leak. Let's fix this correctly
later.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request observability logging, tracing and metrics

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants