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

Fix Index recovery path for split(put) #609

Merged
merged 3 commits into from
Dec 24, 2024

Conversation

shosseinimotlagh
Copy link
Contributor

1- fix old root change when new root buffer is being discarded and old root is dirtied
2- fix the wait down when the down_wait of a node for children is 0 and up buffer of the should not wait for this node to be repairedase enter the commit message for your changes. Lines starting

@shosseinimotlagh shosseinimotlagh changed the title Fix Index recovery path for split(put) : Fix Index recovery path for split(put) Dec 13, 2024
@codecov-commenter
Copy link

codecov-commenter commented Dec 13, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 51.06383% with 69 lines in your changes missing coverage. Please review.

Project coverage is 66.01%. Comparing base (1a0cef8) to head (93e436f).
Report is 112 commits behind head on master.

Files with missing lines Patch % Lines
src/lib/index/wb_cache.cpp 62.82% 23 Missing and 6 partials ⚠️
src/include/homestore/index/index_table.hpp 20.00% 19 Missing and 1 partial ⚠️
src/lib/index/index_cp.cpp 0.00% 9 Missing and 2 partials ⚠️
src/lib/index/index_service.cpp 66.66% 8 Missing and 1 partial ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #609      +/-   ##
==========================================
+ Coverage   56.51%   66.01%   +9.50%     
==========================================
  Files         108      109       +1     
  Lines       10300    10988     +688     
  Branches     1402     1511     +109     
==========================================
+ Hits         5821     7254    +1433     
+ Misses       3894     3013     -881     
- Partials      585      721     +136     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

src/lib/index/wb_cache.cpp Outdated Show resolved Hide resolved
src/lib/index/wb_cache.hpp Outdated Show resolved Hide resolved
If a consumer registered after a cp goes to flushing state,
the on_switchover_cp cb will not be called for this consumer.
In this CP, the ctx for this consumer is nullptr as the consumer
never participant in the cp.

Previous code calling cp_flush for every consumer, leaving the duty
of properly handle the nullptr returned by cp->context(svc_id) to
consumer. However, none of the existing consumer handled the case.

As a result, we hit an occurance that Index generate a CP sololy,
but before the cp fully flushed, other consumer registered and be
called into cp_flush(), the replication service, doesnt properly
handled the nullptr like below, `get_repl_dev_ctx` was called with this_ptr
is null, it is dangerous as invalid memory get accessed.

This change is a breaking change for consumer like HO so bump up the version.
HomeObject participant the CP as CLIENT, current implementation of HO always
returns nullptr for `on_switchover_cp` which will result the CLIENT be excluded
from cp_flush after this commit merged.

callstack:
```
homestore::ReplSvcCPContext::get_repl_dev_ctx (this=0x0, dev=0x56010ab52b00) at /home/ubuntu/HomeStore/src/lib/replication/service/raft_repl_service.cpp:521
0x0000560106d58f1e in homestore::RaftReplServiceCPHandler::cp_flush (this=<optimized out>, cp=0x56010a467940) at /home/ubuntu/HomeStore/src/lib/replication/service/raft_repl_service.cpp:549
```

code:

```
 auto cp_ctx = s_cast< ReplSvcCPContext* >(cp->context(cp_consumer_t::REPLICATION_SVC));
 ...
 auto dev_ctx = cp_ctx->get_repl_dev_ctx(repl_dev.get());
```

Signed-off-by: Xiaoxi Chen <[email protected]>
Copy link
Contributor

@koujl koujl left a comment

Choose a reason for hiding this comment

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

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants