Skip to content

fix found issues - #806

Merged
JacksonYao287 merged 3 commits into
eBay:masterfrom
JacksonYao287:issue-fix
Sep 24, 2025
Merged

JacksonYao287 merged 3 commits into
eBay:masterfrom
JacksonYao287:issue-fix

Conversation

@JacksonYao287

Copy link
Copy Markdown
Member

1 in nuraft, a leader might become a new leader directly, we need adapt to this case.
2 for the error happens in on_fetch_data_received( in originator), do not assert, just ignore this request and let follower retry.
3 when stopping raft_repl_service, we should stop the reaper thread first so that fetch data will not happen after the repl_dev is destroyed.

@codecov-commenter

codecov-commenter commented Sep 23, 2025 •

Copy link
Copy Markdown

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

Codecov Report

❌ Patch coverage is 0% with 24 lines in your changes missing coverage. Please review.
✅ Project coverage is 55.27%. Comparing base (1a0cef8) to head (5a4af41).
⚠️ Report is 325 commits behind head on master.

Files with missing lines Patch % Lines
src/lib/replication/repl_dev/raft_repl_dev.cpp 0.00% 20 Missing ⚠️
src/lib/replication/repl_dev/raft_repl_dev.h 0.00% 2 Missing ⚠️
src/lib/replication/service/raft_repl_service.cpp 0.00% 2 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #806      +/-   ##
==========================================
- Coverage   56.51%   55.27%   -1.24%     
==========================================
  Files         108      110       +2     
  Lines       10300    13257    +2957     
  Branches     1402     1931     +529     
==========================================
+ Hits         5821     7328    +1507     
- Misses       3894     5084    +1190     
- Partials      585      845     +260     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

void RaftReplDev::become_leader_cb() {
auto current_gate = m_traffic_ready_lsn.load();
auto new_gate = raft_server()->get_last_log_idx();
repl_lsn_t existing_gate = 0;

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.

Could we add a assert here to confirm the new gate is larger or equal to the current one?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

sure

m_traffic_ready_lsn.store(0);
RD_LOGD(NO_TRACE_ID, "become_follower_cb setting traffic_ready_lsn to 0");
}
void become_follower_cb() { RD_LOGD(NO_TRACE_ID, "become_follower_cb called!"); }

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.

Can we add m_traffic_ready_lsn.store(0) to make sure the follower can process the coming traffic

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I don`t get this. follower can not process any traffic since we have a check like this

    if (!repl_dev->is_leader()) {
        LOGW("failed to create shard for pg={}, not leader", pg_owner);
        decr_pending_request_num();
        return folly::makeUnexpected(ShardError(ShardErrorCode::NOT_LEADER, repl_dev->get_leader_id()));
    }

    if (!repl_dev->is_ready_for_traffic()) {
        LOGW("failed to create shard for pg={}, not ready for traffic", pg_owner);
        decr_pending_request_num();
        return folly::makeUnexpected(ShardError(ShardErrorCode::RETRY_REQUEST));
    }

m_traffic_ready_lsn is only used by leader , no?

@Besroy Besroy Sep 23, 2025 •

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.

is_ready_for_traffic is not limited to the put path; resetting it ensures all operations, such as the get path, proceed as expected. For example, the get blob path: https://github.com/eBay/HomeObject/blob/main/src/lib/homestore_backend/hs_blob_manager.cpp#L297-L302

@JacksonYao287 JacksonYao287 Sep 23, 2025 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think the right solution is adding is_leader() check in get_blob path. we should always read_blob from leader, since follower is probably slow than leader , and return a wrong result. changing m_traffic_ready_lsn at follower side give no help? for example, if a put_blob has a lsn 100, and it is committed at leader, then when we get_blob at leader , we can find this blob. however, if we get_blob at follower , even if we have already set m_traffic_ready_lsn.store(0) at follower, which makes sure we pass this check (if (!repl_dev->is_ready_for_traffic())), lsn 100 might not be committed at follower and thus return a not_found for this get_blob at follower. so , I think follower should return not_leader here and let the client retry leader.

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.

IIRC, the gateway can read blobs from all members, with a policy to choose the member in the same DC to reduce latency. Reading blobs only from the leader increases the leader's load, so I believe allowing followers to support reads is the right strategy. If a follower cannot find the blob (e.g., due to uncommitted), the gateway will retry with other members

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I got your point, locality for reading is necessary.
I am thinking if the blob we are trying to read has been deleted and gc(we can not find the blob in pg_index_table), then every member will return UNKNOWN_BLOB error to gateway. what should gateway do?

retry for ever ? or there is any specific retry policy

there should be a guy to tell gateway that the blob does not exist in all members.

@Besroy Besroy mentioned this pull request Sep 23, 2025

@Besroy Besroy left a comment

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.

LGTM

@JacksonYao287
JacksonYao287 merged commit 15396b2 into eBay:master Sep 24, 2025
21 checks passed
@JacksonYao287
JacksonYao287 deleted the issue-fix branch September 24, 2025 09:56
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.

3 participants