Skip to content
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

Archives node #3

Merged
merged 28 commits into from
Feb 10, 2025
Merged

Archives node #3

merged 28 commits into from
Feb 10, 2025

Conversation

pashinov
Copy link
Member

No description provided.

@pashinov pashinov force-pushed the feat/archives-node branch 4 times, most recently from b98ba74 to 2fce026 Compare January 18, 2025 16:11
@pashinov pashinov changed the title Feat/archives node Archives node Jan 18, 2025
@pashinov pashinov force-pushed the feat/archives-node branch 4 times, most recently from 5682a40 to eef145c Compare January 20, 2025 11:11
};

let mut writer = WriteMultipart::new(upload);
for (_, chunk) in storage.block_storage().archive_chunks_iterator(archive_id) {
Copy link
Member

Choose a reason for hiding this comment

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

you've added this method to context

Copy link
Member Author

Choose a reason for hiding this comment

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

we can't clone context ref to spawn task. just clone Arc

@pashinov pashinov force-pushed the feat/archives-node branch 3 times, most recently from 461065f to f34c034 Compare January 20, 2025 14:03
@pashinov pashinov requested a review from 0xdeafbeef January 20, 2025 14:07
@pashinov pashinov force-pushed the feat/archives-node branch 2 times, most recently from 387440b to 773db95 Compare January 22, 2025 03:13
@0xdeafbeef
Copy link
Member

Please check if archive was already uploaded

@pashinov pashinov force-pushed the feat/archives-node branch 5 times, most recently from 1460d83 to 22ddcf2 Compare January 27, 2025 12:32
@pashinov pashinov force-pushed the feat/archives-node branch 2 times, most recently from dda7dd4 to 87fc8ad Compare January 27, 2025 18:16
if config.metrics.is_some() {
spawn_allocator_metrics_loop();
}
spawn_allocator_metrics_loop();
Copy link
Member

Choose a reason for hiding this comment

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

looks like a duplicate

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

Comment on lines 88 to 141
pub fn spawn_allocator_metrics_loop() {
tokio::spawn(async move {
loop {
let s = match fetch_stats() {
Ok(s) => s,
Err(e) => {
tracing::error!("failed to fetch jemalloc stats: {e}");
return;
}
};

set_metrics!(
"jemalloc_allocated_bytes" => s.allocated,
"jemalloc_active_bytes" => s.active,
"jemalloc_metadata_bytes" => s.metadata,
"jemalloc_resident_bytes" => s.resident,
"jemalloc_mapped_bytes" => s.mapped,
"jemalloc_retained_bytes" => s.retained,
"jemalloc_dirty_bytes" => s.dirty,
"jemalloc_fragmentation_bytes" => s.fragmentation,
);
tokio::time::sleep(std::time::Duration::from_secs(5)).await;
}
});
}

pub struct JemallocStats {
pub allocated: u64,
pub active: u64,
pub metadata: u64,
pub resident: u64,
pub mapped: u64,
pub retained: u64,
pub dirty: u64,
pub fragmentation: u64,
}

fn fetch_stats() -> anyhow::Result<JemallocStats, tikv_jemalloc_ctl::Error> {
// Stats are cached. Need to advance epoch to refresh.
epoch::advance()?;

Ok(JemallocStats {
allocated: stats::allocated::read()? as u64,
active: stats::active::read()? as u64,
metadata: stats::metadata::read()? as u64,
resident: stats::resident::read()? as u64,
mapped: stats::mapped::read()? as u64,
retained: stats::retained::read()? as u64,
dirty: (stats::resident::read()?
.saturating_sub(stats::active::read()?)
.saturating_sub(stats::metadata::read()?)) as u64,
fragmentation: (stats::active::read()?.saturating_sub(stats::allocated::read()?)) as u64,
})
}
Copy link
Member

Choose a reason for hiding this comment

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

can you move it into some utill? maybe in tycho

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

@pashinov pashinov requested a review from 0xdeafbeef February 9, 2025 17:33
@0xdeafbeef 0xdeafbeef merged commit 1ee420f into master Feb 10, 2025
2 checks passed
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