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

feat(storage): seperate timeout between process and heartbeat #14366

Merged
merged 36 commits into from
Jan 15, 2024

Conversation

Li0k
Copy link
Contributor

@Li0k Li0k commented Jan 4, 2024

I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.

What's changed and what's your intention?

#14327

Checklist

  • I have written necessary rustdoc comments
  • I have added necessary unit tests and integration tests
  • I have added test labels as necessary. See details.
  • I have added fuzzing tests or opened an issue to track them. (Optional, recommended for new SQL features Sqlsmith: Sql feature generation #7934).
  • My PR contains breaking changes. (If it deprecates some features, please create a tracking issue to remove them in the future).
  • All checks passed in ./risedev check (or alias, ./risedev c)
  • My PR changes performance-critical code. (Please run macro/micro-benchmarks and show the results.)
  • My PR contains critical fixes that are necessary to be merged into the latest release. (Please check out the details)

Documentation

  • My PR needs documentation updates. (Please use the Release note section below to summarize the impact on users)

Release note

If this PR includes changes that directly affect users or other significant modifications relevant to the community, kindly draft a release note to provide a concise summary of these changes. Please prioritize highlighting the impact these changes will have on users.

}

fn get_heartbeat_expired_tasks(
task_heartbeats: &HashMap<HummockCompactionTaskId, TaskHeartbeat>,
now: u64,
heartbeat_expiry_ts: u64,
Copy link
Contributor

Choose a reason for hiding this comment

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

is it a typo ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's not a typo. After we distinguish process and heartbeat timeout, the background thread only needs to check expired_task based on heartbeat_expiry_ts

@@ -321,15 +332,19 @@ impl CompactorManagerInner {
let mut cancel_tasks = vec![];
for progress in progress_list {
if let Some(task_ref) = self.task_heartbeats.get_mut(&progress.task_id) {
task_ref.update_at = now;
Copy link
Contributor

Choose a reason for hiding this comment

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

In original implement, we update "expire_at" to "expire_at + 60 secs". And we check it with "now - 30secs". It means that the task will be cancled after "90s" not changed.
But now, we will cancel task if it did not receive heartbeat during "30s". Is it too short ?

Copy link
Contributor

@zwang28 zwang28 left a comment

Choose a reason for hiding this comment

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

LGTM

src/meta/src/hummock/compactor_manager.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@Little-Wallace Little-Wallace left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@wenym1 wenym1 left a comment

Choose a reason for hiding this comment

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

Rest LGTM!

self.num_progress_key
.fetch_add(inc_key_num, Ordering::Relaxed);
pub fn inc_num_pending_read_io(&self) {
self.num_pending_read_io
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason to use SeqCst? If this atomic operation is frequent, there may be some performance issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This operation is infrequent, but it does not require precise values. I will change it to Relaxed.

.duration_since(SystemTime::UNIX_EPOCH)
.expect("Clock may have gone backwards")
.as_secs()
- interval;
Self::get_heartbeat_expired_tasks(&self.task_heartbeats, now)
- self.heartbeat_expiry_seconds;
Copy link
Contributor

Choose a reason for hiding this comment

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

expiry -> expire?

Copy link
Collaborator

Choose a reason for hiding this comment

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

+1

@hzxa21 hzxa21 mentioned this pull request Jan 9, 2024
9 tasks
BugenZhao and others added 17 commits January 10, 2024 18:54
Signed-off-by: Bugen Zhao <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Signed-off-by: tabVersion <[email protected]>
Co-authored-by: cheskel <[email protected]>
Co-authored-by: xxchan <[email protected]>
@Li0k Li0k force-pushed the li0k/storage_task_expire branch from 1faf483 to 58b3bb3 Compare January 10, 2024 11:08
@Li0k
Copy link
Contributor Author

Li0k commented Jan 10, 2024

@hzxa21 @wenym1 PTAL

.duration_since(SystemTime::UNIX_EPOCH)
.expect("Clock may have gone backwards")
.as_secs()
- interval;
Self::get_heartbeat_expired_tasks(&self.task_heartbeats, now)
- self.heartbeat_expiry_seconds;
Copy link
Collaborator

Choose a reason for hiding this comment

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

+1

@@ -104,6 +108,11 @@ pub struct MergeIteratorInner<I: HummockIterator, NE: NodeExtraOrderInfo> {
heap: BinaryHeap<Node<I, NE>>,

last_table_key: Vec<u8>,

// compactor task progress report
task_progress: Option<Arc<TaskProgress>>,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it is a bad idea to embed a compactor related concept into a generic merge iterator. cc @wenym1

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also, compact_and_build_sst takes a HummockIterator, not MergeIterator so it is still possible we miss to update task progress. How about having a wrapper iterator that impl HummockIterator to wrap the underlying HummockIterator to do key progress tracking.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, introduced a new wrapper iterator to check the processed key

Copy link
Contributor

@wenym1 wenym1 left a comment

Choose a reason for hiding this comment

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

LGTM!

@Li0k Li0k enabled auto-merge January 15, 2024 08:31
@Li0k Li0k added this pull request to the merge queue Jan 15, 2024
Merged via the queue into main with commit c9e3e92 Jan 15, 2024
26 of 27 checks passed
@Li0k Li0k deleted the li0k/storage_task_expire branch January 15, 2024 09:21
Little-Wallace pushed a commit that referenced this pull request Jan 20, 2024
Signed-off-by: Bugen Zhao <[email protected]>
Signed-off-by: TennyZhuang <[email protected]>
Signed-off-by: tabVersion <[email protected]>
Co-authored-by: Bugen Zhao <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Eric Fu <[email protected]>
Co-authored-by: August <[email protected]>
Co-authored-by: TennyZhuang <[email protected]>
Co-authored-by: xxchan <[email protected]>
Co-authored-by: Bohan Zhang <[email protected]>
Co-authored-by: cheskel <[email protected]>
Co-authored-by: Xinhao Xu <[email protected]>
Co-authored-by: Yuhao Su <[email protected]>
Co-authored-by: stonepage <[email protected]>
Co-authored-by: zwang28 <[email protected]>
Co-authored-by: Kexiang Wang <[email protected]>
Co-authored-by: KeXiangWang <[email protected]>
fuyufjh added a commit that referenced this pull request Jan 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.