KAFKA-18263; Group lock must be acquired when reverting static membership rejoin (#18207)

When a static member rejoins the group, the group state is rewritten to the partition in order to persist the change. If the write fails, the change is reverted. However, this is done without acquiring the group lock.

This is only try in the old group coordinator. The new one does not suffer from this issue.

Reviewers: Jeff Kim <jeff.kim@confluent.io>
This commit is contained in:
David Jacot 2024-12-16 18:20:35 +01:00 committed by GitHub
parent 4aee33d6ab
commit a12152f028
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 63 additions and 61 deletions

View File

@ -1384,6 +1384,7 @@ private[group] class GroupCoordinator(
info(s"Static member which joins during Stable stage and doesn't affect selectProtocol will not trigger rebalance.")
val groupAssignment: Map[String, Array[Byte]] = group.allMemberMetadata.map(member => member.memberId -> member.assignment).toMap
groupManager.storeGroup(group, groupAssignment, error => {
group.inLock {
if (error != Errors.NONE) {
warn(s"Failed to persist metadata for group ${group.groupId}: ${error.message}")
@ -1447,6 +1448,7 @@ private[group] class GroupCoordinator(
error = Errors.NONE
))
}
}
}, requestLocal)
} else {
maybePrepareRebalance(group, s"Group's selectedProtocol will change because static member ${member.memberId} with instance id $groupInstanceId joined with change of protocol; client reason: $reason")