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

Add INDEX FLIP and CP abrupt #407

Closed

Conversation

shosseinimotlagh
Copy link
Contributor

No description provided.

std::string edge = edge_info.m_bnodeid == empty_bnodeid
? ""
: "edge:" + std::to_string(edge_info.m_bnodeid) + "." + std::to_string(edge_info.m_link_version);
return fmt::format("{}.{} level:{} nEntries={} {} {} {} node_gen={} ", node_id, link_version, level, nentries,
Copy link
Contributor

Choose a reason for hiding this comment

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

missing version, checksum etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@@ -95,6 +95,31 @@ struct HS_SERVICE {
}
};

struct HOMESTORE_FLIPS {
Copy link
Contributor

Choose a reason for hiding this comment

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

please move it from homestore.cpp to btree code, these flips are btree specific, you can add a function which sets all this flips .

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@@ -169,7 +194,19 @@ class HomeStore {
ResourceMgr& resource_mgr() { return *m_resource_mgr.get(); }
CPManager& cp_mgr() { return *m_cp_mgr.get(); }
shared< sisl::Evictor > evictor() { return m_evictor; }

#ifdef _PRERELEASE
Copy link
Contributor

Choose a reason for hiding this comment

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

why one more indirection ? why not directly flip_clinet->inject("...",...)

src/include/homestore/index/index_table.hpp Outdated Show resolved Hide resolved
@@ -74,6 +74,10 @@ class IndexWBCacheBase {
/// @param cur_buf
/// @return
virtual IndexBufferPtr copy_buffer(const IndexBufferPtr& cur_buf, const CPContext* context) const = 0;

#ifdef _PRERELEASE
virtual void add_to_crashing_buffers(IndexBufferPtr, std::string reason) = 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

comment.


#ifdef _PRERELEASE

if (m_abrupt_flush.load() == true) {
Copy link
Contributor

Choose a reason for hiding this comment

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

couldnt we add a function cp_ctx->isabrupt() ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK. sure I ll add it to the cp_ctx instead of wbcache

freq.set_percent(100);
m_fc.inject_noreturn_flip(flip_name, {null_cond}, freq);
auto hsi = HomeStore::instance();
hsi->set_flip_point(flip_name);
Copy link
Contributor

Choose a reason for hiding this comment

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

as noted above, its better to directly set flip points like done in other UT's.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@yamingk yamingk added this to the MileStone4.2 milestone May 10, 2024

#ifdef _PRERELEASE
BTREE_FLIPS m_flips;
#endif
Copy link
Contributor

Choose a reason for hiding this comment

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

Why should btree maintain a separate vector of flips? Why can't the caller directly set the flip?

for (const auto& flip : flips) {
set_flip_point(flip);
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Please avoid pass-by-value on containers, as it could be very expensive without any hint.

@@ -147,6 +148,11 @@ class IndexTable : public IndexTableBase, public Btree< K, V > {
for (const auto& right_child_node : new_nodes) {
auto right_child = IndexBtreeNode::convert(right_child_node.get());
write_node_impl(right_child_node, context);
#ifdef _PRERELEASE
if (iomgr_flip::instance()->test_flip("index_right_sibling")) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Would suggest a more contextful name for the flip, say crash_on_right_sibling_flush,
crash_on_left_sibling_flush,
crash_on_non_root_parent_flush,
crash_on_root_parent_flush

const auto& reasons = it->second;
std::string formatted_reasons = fmt::format("[{}]", fmt::join(reasons, ", "));
LOGTRACEMOD(wbcache, "Buffer {} is in crashing_buffers with reason(s): {} - Buffer info: {}",
buf->to_string(), formatted_reasons, BtreeNode::to_string_buf(buf->raw_buffer()));
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't need another fmt::format over other format right? You could merge them.

@fishfc fishfc closed this Jun 6, 2024
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.

CPManager abrupt shutdown method to simulate crash test Introduce Flip to index service
5 participants