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

refactor tskv : Error passed up in async function #560

Closed
wants to merge 2 commits into from

Conversation

Babanmei
Copy link

Errors inside the [run_wal_job,run_flush_job,run_compact_job,run_summary_job] functions are passed up

避免以上四个函数中的错误在内部消耗而外部不可知而向上传递,并将方法改为异步函数形式,另外项目Error设计不是很优雅

@CLAassistant
Copy link

CLAassistant commented Aug 21, 2022

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


bernie seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@yuandongs
Copy link
Contributor

Thank You

@yuandongs
Copy link
Contributor

@roseboy-liu please make a review

Copy link
Contributor

@roseboy-liu roseboy-liu left a comment

Choose a reason for hiding this comment

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

I agree with your idea,but with some comments, please check.


let summary = tokio::spawn(run_summary_job(summary, summary_task_receiver, summary_task_sender));
if let Err(e) = tokio::try_join!(wal, flush, compact, summary) {
return Err(Error::Compact { reason: e.to_string()})
Copy link
Contributor

Choose a reason for hiding this comment

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

add a new error code

@@ -58,7 +59,7 @@ pub struct TsKv {
}

impl TsKv {
pub async fn open(opt: Options, ts_family_num: u32) -> Result<Self> {
pub async fn open(opt: Options, ts_family_num: u32) -> Result<Self, Error> {
Copy link
Contributor

Choose a reason for hiding this comment

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

it has defined in error.rs mod 'pub type Result<T, E = Error> = std::result::Result<T, E>'

@@ -475,3 +379,86 @@ impl TsKv {
Ok(None)
}
}


async fn run_wal_job(wal_opt: Arc<WalConfig>, mut receiver: UnboundedReceiver<WalTask>) -> Result<()> {
Copy link
Contributor

Choose a reason for hiding this comment

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

If there is no refactoring, in place to modify

Copy link
Author

Choose a reason for hiding this comment

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

change to function, remove &self

@Babanmei Babanmei closed this Aug 22, 2022
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.

4 participants