-
Notifications
You must be signed in to change notification settings - Fork 1
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
Conversation
b98ba74
to
2fce026
Compare
5682a40
to
eef145c
Compare
archives-node/src/subscriber.rs
Outdated
}; | ||
|
||
let mut writer = WriteMultipart::new(upload); | ||
for (_, chunk) in storage.block_storage().archive_chunks_iterator(archive_id) { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
461065f
to
f34c034
Compare
387440b
to
773db95
Compare
Please check if archive was already uploaded |
1460d83
to
22ddcf2
Compare
22ddcf2
to
8f32646
Compare
dda7dd4
to
87fc8ad
Compare
87fc8ad
to
664e2e2
Compare
d53eb7f
to
ff6f5aa
Compare
archives-downloader/src/main.rs
Outdated
if config.metrics.is_some() { | ||
spawn_allocator_metrics_loop(); | ||
} | ||
spawn_allocator_metrics_loop(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like a duplicate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
archives-downloader/src/main.rs
Outdated
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, | ||
}) | ||
} |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
No description provided.