mirror of https://github.com/apache/kafka.git
				
				
				
			MINOR: simplify consumer logic (#15519)
For static member, the `group.instance.id` cannot change. Reviewers: Chia-Ping Tsai <chia7712@gmail.com>, Lianet Magrans <lianetmr@gmail.com>, David Jacot <david.jacot@gmail.com>
This commit is contained in:
		
							parent
							
								
									722967a2b7
								
							
						
					
					
						commit
						d88a97adef
					
				|  | @ -529,14 +529,8 @@ public class HeartbeatRequestManager implements RequestManager { | ||||||
|             // MemberEpoch - always sent |             // MemberEpoch - always sent | ||||||
|             data.setMemberEpoch(membershipManager.memberEpoch()); |             data.setMemberEpoch(membershipManager.memberEpoch()); | ||||||
| 
 | 
 | ||||||
|             // InstanceId - only sent if has changed since the last heartbeat |             // InstanceId - set if present | ||||||
|             // Always send when leaving the group as a static member |             membershipManager.groupInstanceId().ifPresent(data::setInstanceId); | ||||||
|             membershipManager.groupInstanceId().ifPresent(groupInstanceId -> { |  | ||||||
|                 if (!groupInstanceId.equals(sentFields.instanceId) || membershipManager.memberEpoch() == ConsumerGroupHeartbeatRequest.LEAVE_GROUP_STATIC_MEMBER_EPOCH) { |  | ||||||
|                     data.setInstanceId(groupInstanceId); |  | ||||||
|                     sentFields.instanceId = groupInstanceId; |  | ||||||
|                 } |  | ||||||
|             }); |  | ||||||
| 
 | 
 | ||||||
|             // RebalanceTimeoutMs - only sent if has changed since the last heartbeat |             // RebalanceTimeoutMs - only sent if has changed since the last heartbeat | ||||||
|             if (sentFields.rebalanceTimeoutMs != rebalanceTimeoutMs) { |             if (sentFields.rebalanceTimeoutMs != rebalanceTimeoutMs) { | ||||||
|  | @ -593,7 +587,6 @@ public class HeartbeatRequestManager implements RequestManager { | ||||||
| 
 | 
 | ||||||
|         // Fields of ConsumerHeartbeatRequest sent in the most recent request |         // Fields of ConsumerHeartbeatRequest sent in the most recent request | ||||||
|         static class SentFields { |         static class SentFields { | ||||||
|             private String instanceId = null; |  | ||||||
|             private int rebalanceTimeoutMs = -1; |             private int rebalanceTimeoutMs = -1; | ||||||
|             private TreeSet<String> subscribedTopicNames = null; |             private TreeSet<String> subscribedTopicNames = null; | ||||||
|             private String serverAssignor = null; |             private String serverAssignor = null; | ||||||
|  | @ -602,7 +595,6 @@ public class HeartbeatRequestManager implements RequestManager { | ||||||
|             SentFields() {} |             SentFields() {} | ||||||
| 
 | 
 | ||||||
|             void reset() { |             void reset() { | ||||||
|                 instanceId = null; |  | ||||||
|                 rebalanceTimeoutMs = -1; |                 rebalanceTimeoutMs = -1; | ||||||
|                 subscribedTopicNames = null; |                 subscribedTopicNames = null; | ||||||
|                 serverAssignor = null; |                 serverAssignor = null; | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue