28
28
import java .util .stream .Collectors ;
29
29
30
30
import static org .apache .kafka .common .config .ConfigDef .Importance .MEDIUM ;
31
+ import static org .apache .kafka .common .config .ConfigDef .Range .atLeast ;
31
32
import static org .apache .kafka .common .config .ConfigDef .Range .between ;
32
33
import static org .apache .kafka .common .config .ConfigDef .Type .BOOLEAN ;
33
34
import static org .apache .kafka .common .config .ConfigDef .Type .INT ;
@@ -70,6 +71,10 @@ public class ShareGroupConfig {
70
71
public static final int SHARE_FETCH_PURGATORY_PURGE_INTERVAL_REQUESTS_DEFAULT = 1000 ;
71
72
public static final String SHARE_FETCH_PURGATORY_PURGE_INTERVAL_REQUESTS_DOC = "The purge interval (in number of requests) of the share fetch request purgatory" ;
72
73
74
+ public static final String SHARE_GROUP_MAX_SHARE_SESSIONS_CONFIG = "group.share.max.share.sessions" ;
75
+ public static final int SHARE_GROUP_MAX_SHARE_SESSIONS_DEFAULT = 2000 ;
76
+ public static final String SHARE_GROUP_MAX_SHARE_SESSIONS_DOC = "The maximum number of share sessions per broker." ;
77
+
73
78
public static final String SHARE_GROUP_PERSISTER_CLASS_NAME_CONFIG = "group.share.persister.class.name" ;
74
79
public static final String SHARE_GROUP_PERSISTER_CLASS_NAME_DEFAULT = "org.apache.kafka.server.share.persister.DefaultStatePersister" ;
75
80
public static final String SHARE_GROUP_PERSISTER_CLASS_NAME_DOC = "The class name of share persister for share group. The class should implement " +
@@ -84,6 +89,7 @@ public class ShareGroupConfig {
84
89
.define (SHARE_GROUP_MAX_GROUPS_CONFIG , SHORT , SHARE_GROUP_MAX_GROUPS_DEFAULT , between (1 , 100 ), MEDIUM , SHARE_GROUP_MAX_GROUPS_DOC )
85
90
.define (SHARE_GROUP_PARTITION_MAX_RECORD_LOCKS_CONFIG , INT , SHARE_GROUP_PARTITION_MAX_RECORD_LOCKS_DEFAULT , between (100 , 10000 ), MEDIUM , SHARE_GROUP_PARTITION_MAX_RECORD_LOCKS_DOC )
86
91
.define (SHARE_FETCH_PURGATORY_PURGE_INTERVAL_REQUESTS_CONFIG , INT , SHARE_FETCH_PURGATORY_PURGE_INTERVAL_REQUESTS_DEFAULT , MEDIUM , SHARE_FETCH_PURGATORY_PURGE_INTERVAL_REQUESTS_DOC )
92
+ .define (SHARE_GROUP_MAX_SHARE_SESSIONS_CONFIG , INT , SHARE_GROUP_MAX_SHARE_SESSIONS_DEFAULT , atLeast (1 ), MEDIUM , SHARE_GROUP_MAX_SHARE_SESSIONS_DOC )
87
93
.defineInternal (SHARE_GROUP_PERSISTER_CLASS_NAME_CONFIG , STRING , SHARE_GROUP_PERSISTER_CLASS_NAME_DEFAULT , null , MEDIUM , SHARE_GROUP_PERSISTER_CLASS_NAME_DOC );
88
94
89
95
private final boolean isShareGroupEnabled ;
@@ -94,11 +100,13 @@ public class ShareGroupConfig {
94
100
private final int shareGroupMaxRecordLockDurationMs ;
95
101
private final int shareGroupMinRecordLockDurationMs ;
96
102
private final int shareFetchPurgatoryPurgeIntervalRequests ;
103
+ private final int shareGroupMaxShareSessions ;
97
104
private final String shareGroupPersisterClassName ;
98
105
99
106
public ShareGroupConfig (AbstractConfig config ) {
100
- // Share groups are enabled in two cases: 1) The internal configuration to enable it is
101
- // explicitly set; or 2) the share rebalance protocol is enabled.
107
+ // Share groups are enabled in two cases:
108
+ // 1. The internal configuration to enable it is explicitly set
109
+ // 2. the share rebalance protocol is enabled.
102
110
Set <String > protocols = config .getList (GroupCoordinatorConfig .GROUP_COORDINATOR_REBALANCE_PROTOCOLS_CONFIG )
103
111
.stream ().map (String ::toUpperCase ).collect (Collectors .toSet ());
104
112
isShareGroupEnabled = config .getBoolean (ShareGroupConfig .SHARE_GROUP_ENABLE_CONFIG ) ||
@@ -110,6 +118,7 @@ public ShareGroupConfig(AbstractConfig config) {
110
118
shareGroupMaxRecordLockDurationMs = config .getInt (ShareGroupConfig .SHARE_GROUP_MAX_RECORD_LOCK_DURATION_MS_CONFIG );
111
119
shareGroupMinRecordLockDurationMs = config .getInt (ShareGroupConfig .SHARE_GROUP_MIN_RECORD_LOCK_DURATION_MS_CONFIG );
112
120
shareFetchPurgatoryPurgeIntervalRequests = config .getInt (ShareGroupConfig .SHARE_FETCH_PURGATORY_PURGE_INTERVAL_REQUESTS_CONFIG );
121
+ shareGroupMaxShareSessions = config .getInt (ShareGroupConfig .SHARE_GROUP_MAX_SHARE_SESSIONS_CONFIG );
113
122
shareGroupPersisterClassName = config .getString (ShareGroupConfig .SHARE_GROUP_PERSISTER_CLASS_NAME_CONFIG );
114
123
validate ();
115
124
}
@@ -147,6 +156,10 @@ public int shareFetchPurgatoryPurgeIntervalRequests() {
147
156
return shareFetchPurgatoryPurgeIntervalRequests ;
148
157
}
149
158
159
+ public int shareGroupMaxShareSessions () {
160
+ return shareGroupMaxShareSessions ;
161
+ }
162
+
150
163
public String shareGroupPersisterClassName () {
151
164
return shareGroupPersisterClassName ;
152
165
}
0 commit comments