Repository navigation
osd/scrub: reserve replicas in OSD order, one by one - #53843
Conversation
athanatos
left a comment
There was a problem hiding this comment.
Seems mostly correct but we can make it a lot simpler.
|
|
||
| /// a new interval has dawned. | ||
| /// For a Primary: Discards replica reservations, so that the FullReset that would | ||
| /// follow it would not attempt to release them. |
There was a problem hiding this comment.
Let's be a bit more explanatory here:
/**
* IntervalChanged
*
* This event notifies the ScrubMachine that it is no longer responsible for
* releasing replica state. It will generally be submitted upon a PG interval
* change and followed immediately by a FullReset.
*
* This event is distinct from FullReset because replicas are always responsible
* for releasing any interval specific state (including but certainly not limited to
* scrub reservations) upon interval change without coordination from the
* Primary. This event notifies the ScrubMachine that it can forget about
* such remote state.
*/
There was a problem hiding this comment.
Lost this change in the process. Will fix in the next round of changes.
|
|
||
| /// managing the scrub session's reservations (optiona, as | ||
| /// it's an RAII wrapper around the state of 'holding reservations') | ||
| std::optional<ReplicaReservations> m_reservations{std::nullopt}; |
There was a problem hiding this comment.
First, an initially constructed ReplicaReservations should be represent "no replicas reserved thus far", which I think is what std::nullopt should represent as well. No need for this to be an optional.
More significantly, I don't see any purpose for the ReplicaReservations class. It requires a bunch of boilerplate code for capturing interfaces already held by the scrubber. With the comments I made above, it should have only three real members:
- m_sorted_secondaries (rename to replicas_to_reserve)
- m_next_to_request (rename to next_replica_to_reserve)
- m_request_sent_at (rename to last_reservation_request_sent_at or something)
I think if you simply move the members and methods directly to Session, the code will be vastly easier to scan and no more complex as Session really doesn't do much else.
Only the PG that had set the 'I am in the process of reserving my replicas' is allowed to clear that status. That will simplify the follow-up commit, setting this flag from a specific scrub-FSM state. Signed-off-by: Ronen Friedman <[email protected]>
The Session state now includes the ReservingReplicas & Active sub-states. This new state will hold (in future commits) most of the scrub state information that relates to a specific scrub session (and should be cleaned up when that session terminates). Signed-off-by: Ronen Friedman <[email protected]>
Issuing the reservation requests one by one - waiting for approval from the secondary before the next request is sent. The requests are sent in ascending target pg-shard-id order, reducing the chance of having two PGs repeatedly competing for the same set of OSDs - and doing so in an interleaved sequence. Modifying the Session state in the scrubber FSM to react to interval changes by discarding replica reservations. Signed-off-by: Ronen Friedman <[email protected]>
The scrubber FSM will now be responsible for handling the grant/deny ops received from the replica OSDs. For this temporary step - the scrubber FSM will simply forward a call to the ReplicaReservations object in the Scrubber. Signed-off-by: Ronen Friedman <[email protected]>
As a preliminary step before ReplicaReservations ownership is moved to the scrubber's FSM. No code changes in this commit (apart from required 'include's). Signed-off-by: Ronen Friedman <[email protected]>
Handle grant/deny messages within the FSM. One exception at this point: the handling of "granted by everyone" (due to the technical inconvenience of having to handle the "0 replicas" case in the FSM state constructor). Note: after this commit, ScrubMachineListener - an API which is a subset of the Scrubber API to be used by the Scrubber FSM - does no longer make sense. The FSM should now have full access to the scrubber, and that interface will be removed in a subsequent PR. Signed-off-by: Ronen Friedman <[email protected]>
with special handling for the 0-replica case. Signed-off-by: Ronen Friedman <[email protected]>
Merging the 'do once' functionality into the timeout duration. Signed-off-by: Ronen Friedman <[email protected]>
There was a problem hiding this comment.
Minor naming nit aside, seems reasonable.
I'm still somewhat skeptical about the strategy. This implementation fails the entire reservation process as soon as one fails, right? I'm not sure that's actually any better than the behavior as it exists now. It might actually be worse since the reservation process could take longer before failing increasing the amount of time we unproductively (if it ultimately fails) hold reservations.
If the goal is to move forward with subsequent PRs retrying the single failure and then with modifying the replica side to an AsyncReserver to queue reservation requests as with Backfill, I think this is a reasonable stepping stone.
| scrbr->clear_pgscrub_state(); | ||
| // manipulate the 'next to reserve' iterator to exclude | ||
| // the rejecting replica from the set of replicas requiring release | ||
| context<Session>().m_reservations->verify_rejections_source( |
There was a problem hiding this comment.
Seems like a very misleading name. How about notify_reservation_rejected()?
There was a problem hiding this comment.
The name matches the functionality as after the rest of the commits (where the notification part was
moved to the FSM). But I will remove the extra 's' there.
As replicas are now reserved sequentially, the scrub reservation timeout should be extended. Taking into account the low priority of scrub-related messages, modify both 'osd_scrub_reservation_timeout' and 'osd_scrub_slow_reservation_response'. Signed-off-by: Ronen Friedman <[email protected]>
|
jenkins test make check |
|
@ronen-fr I see a possible related failure. Can you take a look? /a/yuriw-2023-10-24_00:11:54-rados-wip-yuri4-testing-2023-10-23-0903-distro-default-smithi/7435623 I reran the job 10x too, in case it helps: |
|
Removing from the test batch till we figure out whether this failure is related. |
As we now call clear_pgscrub_state() at the end of each 'Session' state, we must not clear PG_STATE_REPAIR unconditionally. Previously - scrubs that reached normal completion, i.e. reached PgScrubber::scrub_finish(), would have only cleared that PG flag under specific conditions. That was changed in previous commits of this PR, and is now fixed. Signed-off-by: Ronen Friedman <[email protected]>
|
The failure was related (a PG flag being reset to early). |
|
jenkins retest this please |
|
jenkins test api |
The handling of replicas reservation in the beginning of each scrub session is modified:
Now - issuing the reservation requests one by one - waiting for
approval from the secondary before the next request is sent.
The requests are sent in ascending pg_shard_t order, reducing the chance
of having two PGs repeatedly competing for the same set of
OSDs - and doing so in an interleaved sequence.
Based on an observation made by Sam Just.