Skip to content

Add experimental API WaitForFlushAndCompact()#10524

Closed
jay-zhuang wants to merge 5 commits into
facebook:mainfrom
jay-zhuang:wait_comp
Closed

Add experimental API WaitForFlushAndCompact()#10524
jay-zhuang wants to merge 5 commits into
facebook:mainfrom
jay-zhuang:wait_comp

Conversation

@jay-zhuang

@jay-zhuang jay-zhuang commented Aug 12, 2022

Copy link
Copy Markdown
Contributor

Add experimental API WaitForFlushAndCompact() for waiting for background
flush and compaction jobs. The API could be useful for the user to wait the db
to be in a stable status.

Fix #10428

Test Plan: CI. the API is already wildly used in unittests

@jay-zhuang jay-zhuang changed the title Expose API WaitForCompact() Aug 12, 2022
@jay-zhuang jay-zhuang marked this pull request as ready for review August 12, 2022 16:45
@facebook-github-bot

Copy link
Copy Markdown
Contributor

@jay-zhuang has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

Comment thread include/rocksdb/db.h

#endif // ROCKSDB_LITE
// Experimental and subject to change
// Wait for the background flush and Compaction to finish.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't understand. Does it wait until the currently running background jobs finish or until there are no running background jobs? And that might be an instant until the next background job is started, right?

If there is no running flush or compaction, does it "wait for flush and/or compaction" as its name implies?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

(I constantly find myself reverse-engineering the TEST functions also because they have completely unclear meaning.)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

And that might be an instant until the next background job is started, right?

And it might never happen, right?

Comment thread include/rocksdb/db.h
#endif // ROCKSDB_LITE
// Experimental and subject to change
// Wait for the background flush and Compaction to finish.
// `wait_unscheduled` will wait for unscheduled job to be finished. It might

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

"unscheduled" is not a term used elsewhere in the public API. Please define it.

@ajkr

ajkr commented May 12, 2023

Copy link
Copy Markdown
Contributor

(Superseded by #11436)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

4 participants