Problem:
When a primary demotion is in progress, the demote snapshot is in an incomplete
state. However, the group replayer incorrectly attempts to validate this
snapshot using validate_local_group_snapshots(), treating the cluster as if it
were secondary. This results in the group status being incorrectly set to
up+replaying instead of up+unknown.
Solution:
Avoid validating snapshots that are in the process of being demoted on the
primary. This ensures the group replayer does not mistakenly assign an
incorrect role or state during transition.
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
// skip validation for primary snapshots
auto ns = std::get_if<cls::rbd::GroupSnapshotNamespaceMirror>(
&local_snap.snapshot_namespace);
- if (ns != nullptr && ns->state == cls::rbd::MIRROR_SNAPSHOT_STATE_PRIMARY) {
+ if (ns != nullptr && ns->is_primary()) {
continue;
}
<< snap->id << dendl;
create_group_snapshot(*snap, locker);
continue;
- } else if (next_remote_snap_ns->state == cls::rbd::MIRROR_SNAPSHOT_STATE_PRIMARY ||
- next_remote_snap_ns->state == cls::rbd::MIRROR_SNAPSHOT_STATE_PRIMARY_DEMOTED) {
+ } else if (next_remote_snap_ns->is_primary()) {
dout(10) << "found primary remote mirror group snapshot: "
<< snap->id << dendl;
create_group_snapshot(*snap, locker);