@@ -88,14 +88,17 @@ public void testTopBundlesLoadData() {
88
88
var topKBundles = new TopKBundles (pulsar );
89
89
NamespaceBundleStats stats1 = new NamespaceBundleStats ();
90
90
stats1 .msgRateIn = 100000 ;
91
+ stats1 .msgThroughputOut = 10 ;
91
92
bundleStats .put (bundle1 , stats1 );
92
93
93
94
NamespaceBundleStats stats2 = new NamespaceBundleStats ();
94
95
stats2 .msgRateIn = 500 ;
96
+ stats2 .msgThroughputOut = 10 ;
95
97
bundleStats .put (bundle2 , stats2 );
96
98
97
99
NamespaceBundleStats stats3 = new NamespaceBundleStats ();
98
100
stats3 .msgRateIn = 10000 ;
101
+ stats3 .msgThroughputOut = 10 ;
99
102
bundleStats .put (bundle3 , stats3 );
100
103
101
104
NamespaceBundleStats stats4 = new NamespaceBundleStats ();
@@ -118,10 +121,12 @@ public void testSystemNamespace() {
118
121
var topKBundles = new TopKBundles (pulsar );
119
122
NamespaceBundleStats stats1 = new NamespaceBundleStats ();
120
123
stats1 .msgRateIn = 500 ;
124
+ stats1 .msgThroughputOut = 10 ;
121
125
bundleStats .put ("pulsar/system/0x00000000_0x0FFFFFFF" , stats1 );
122
126
123
127
NamespaceBundleStats stats2 = new NamespaceBundleStats ();
124
128
stats2 .msgRateIn = 10000 ;
129
+ stats2 .msgThroughputOut = 10 ;
125
130
bundleStats .put (bundle1 , stats2 );
126
131
127
132
topKBundles .update (bundleStats , 2 );
@@ -131,6 +136,21 @@ public void testSystemNamespace() {
131
136
assertEquals (top0 .bundleName (), bundle1 );
132
137
}
133
138
139
+ @ Test
140
+ public void testZeroMsgThroughputBundleStats () {
141
+ Map <String , NamespaceBundleStats > bundleStats = new HashMap <>();
142
+ var topKBundles = new TopKBundles (pulsar );
143
+ NamespaceBundleStats stats1 = new NamespaceBundleStats ();
144
+ bundleStats .put (bundle1 , stats1 );
145
+
146
+ NamespaceBundleStats stats2 = new NamespaceBundleStats ();
147
+ bundleStats .put (bundle1 , stats2 );
148
+
149
+ topKBundles .update (bundleStats , 2 );
150
+
151
+ assertEquals (topKBundles .getLoadData ().getTopBundlesLoadData ().size (), 0 );
152
+ }
153
+
134
154
135
155
private void setAntiAffinityGroup () throws MetadataStoreException {
136
156
LocalPolicies localPolicies = new LocalPolicies (null , null , "namespaceAntiAffinityGroup" );
@@ -166,10 +186,12 @@ public void testIsolationPolicy() throws MetadataStoreException {
166
186
var topKBundles = new TopKBundles (pulsar );
167
187
NamespaceBundleStats stats1 = new NamespaceBundleStats ();
168
188
stats1 .msgRateIn = 500 ;
189
+ stats1 .msgThroughputOut = 10 ;
169
190
bundleStats .put (bundle1 , stats1 );
170
191
171
192
NamespaceBundleStats stats2 = new NamespaceBundleStats ();
172
193
stats2 .msgRateIn = 10000 ;
194
+ stats2 .msgThroughputOut = 10 ;
173
195
bundleStats .put (bundle2 , stats2 );
174
196
175
197
topKBundles .update (bundleStats , 2 );
@@ -188,10 +210,12 @@ public void testAntiAffinityGroupPolicy() throws MetadataStoreException {
188
210
var topKBundles = new TopKBundles (pulsar );
189
211
NamespaceBundleStats stats1 = new NamespaceBundleStats ();
190
212
stats1 .msgRateIn = 500 ;
213
+ stats1 .msgThroughputOut = 10 ;
191
214
bundleStats .put (bundle1 , stats1 );
192
215
193
216
NamespaceBundleStats stats2 = new NamespaceBundleStats ();
194
217
stats2 .msgRateIn = 10000 ;
218
+ stats2 .msgThroughputOut = 10 ;
195
219
bundleStats .put (bundle2 , stats2 );
196
220
197
221
topKBundles .update (bundleStats , 2 );
@@ -213,10 +237,12 @@ public void testLoadBalancerSheddingBundlesWithPoliciesEnabledConfig() throws Me
213
237
var topKBundles = new TopKBundles (pulsar );
214
238
NamespaceBundleStats stats1 = new NamespaceBundleStats ();
215
239
stats1 .msgRateIn = 500 ;
240
+ stats1 .msgThroughputOut = 10 ;
216
241
bundleStats .put (bundle1 , stats1 );
217
242
218
243
NamespaceBundleStats stats2 = new NamespaceBundleStats ();
219
244
stats2 .msgRateIn = 10000 ;
245
+ stats2 .msgThroughputOut = 10 ;
220
246
bundleStats .put (bundle2 , stats2 );
221
247
222
248
topKBundles .update (bundleStats , 2 );
0 commit comments