-
Notifications
You must be signed in to change notification settings - Fork 11
Issue 100: Vol destroy with outstanding IO #99
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
Changes from 11 commits
a29cec2
4938e53
d697f9b
10a7c00
a03b694
556c1af
53a6493
98d4caa
57e33a0
d79cc94
29af04e
ebad59c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -159,6 +159,12 @@ class Volume : public std::enable_shared_from_this< Volume > { | |
|
|
||
| VolumeManager::NullAsyncResult read(const vol_interface_req_ptr& req); | ||
|
|
||
| bool can_remove() { return !destroy_started_ && outstanding_reqs_.test_eq(0); } | ||
|
|
||
| void inc_ref(uint64_t n = 1) { outstanding_reqs_.increment(n); } | ||
| void dec_ref(uint64_t n = 1) { outstanding_reqs_.decrement(n); } | ||
| uint64_t num_outstanding_reqs() const { return outstanding_reqs_.get(); } | ||
|
|
||
| private: | ||
| // | ||
| // this API will be called to initialize volume in both volume creation and volume recovery; | ||
|
|
@@ -178,10 +184,14 @@ class Volume : public std::enable_shared_from_this< Volume > { | |
| VolumeManager::Result< folly::Unit > read_from_index(const vol_interface_req_ptr& req, index_kv_list_t& index_kvs); | ||
|
|
||
| private: | ||
| VolumeInfoPtr vol_info_; | ||
| ReplDevPtr rd_; | ||
| VolIdxTablePtr indx_tbl_; | ||
| superblk< vol_sb_t > sb_; | ||
| VolumeInfoPtr vol_info_; // volume info | ||
| ReplDevPtr rd_; // replication device for this volume, which provides read/write APIs to the volume; | ||
| VolIdxTablePtr indx_tbl_; // index table for this volume | ||
| superblk< vol_sb_t > sb_; // meta data of the volume | ||
|
|
||
| sisl::atomic_counter< uint64_t > outstanding_reqs_{0}; // number of outstanding requests | ||
| bool destroy_started_{ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we use enum instead vol_state::destroying ?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it is actually different states, so when we are rebooting, the state will be vol_state::destroying, but destroy has never been kicked off yet after reboot, that is why I introduced this field. |
||
| false}; // indicates if volume destroy has started, avoid destroy to be executed more than once. | ||
| }; | ||
|
|
||
| struct vol_repl_ctx : public homestore::repl_req_ctx { | ||
|
|
||
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.
nit: nsecs/secs
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.
ack