28
28
import java .util .stream .Stream ;
29
29
30
30
import org .apache .accumulo .core .client .Scanner ;
31
+ import org .apache .accumulo .core .conf .AccumuloConfiguration ;
32
+ import org .apache .accumulo .core .conf .Property ;
31
33
import org .apache .accumulo .core .data .Key ;
32
34
import org .apache .accumulo .core .data .Value ;
33
35
import org .apache .accumulo .core .dataImpl .KeyExtent ;
@@ -92,13 +94,16 @@ public class GarbageCollectWriteAheadLogsTest {
92
94
93
95
@ Test
94
96
public void testRemoveUnusedLog () throws Exception {
97
+ AccumuloConfiguration conf = EasyMock .createMock (AccumuloConfiguration .class );
95
98
ServerContext context = EasyMock .createMock (ServerContext .class );
96
99
VolumeManager fs = EasyMock .createMock (VolumeManager .class );
97
100
WalStateManager marker = EasyMock .createMock (WalStateManager .class );
98
101
LiveTServerSet tserverSet = EasyMock .createMock (LiveTServerSet .class );
99
102
100
103
GCStatus status = new GCStatus (null , null , null , new GcCycleStats ());
101
104
105
+ EasyMock .expect (context .getConfiguration ()).andReturn (conf ).times (2 );
106
+ EasyMock .expect (conf .getCount (Property .GC_DELETE_THREADS )).andReturn (8 ).anyTimes ();
102
107
tserverSet .scanServers ();
103
108
EasyMock .expectLastCall ();
104
109
EasyMock .expect (tserverSet .getCurrentServers ()).andReturn (Collections .singleton (server1 ));
@@ -108,7 +113,7 @@ public void testRemoveUnusedLog() throws Exception {
108
113
EasyMock .expect (fs .deleteRecursively (path )).andReturn (true ).once ();
109
114
marker .removeWalMarker (server1 , id );
110
115
EasyMock .expectLastCall ().once ();
111
- EasyMock .replay (context , fs , marker , tserverSet );
116
+ EasyMock .replay (conf , context , fs , marker , tserverSet );
112
117
var gc = new GarbageCollectWriteAheadLogs (context , fs , tserverSet , false , marker ,
113
118
tabletOnServer1List ) {
114
119
@ Override
@@ -123,25 +128,28 @@ protected Map<UUID,Path> getSortedWALogs() {
123
128
}
124
129
};
125
130
gc .collect (status );
126
- EasyMock .verify (context , fs , marker , tserverSet );
131
+ EasyMock .verify (conf , context , fs , marker , tserverSet );
127
132
}
128
133
129
134
@ Test
130
135
public void testKeepClosedLog () throws Exception {
136
+ AccumuloConfiguration conf = EasyMock .createMock (AccumuloConfiguration .class );
131
137
ServerContext context = EasyMock .createMock (ServerContext .class );
132
138
VolumeManager fs = EasyMock .createMock (VolumeManager .class );
133
139
WalStateManager marker = EasyMock .createMock (WalStateManager .class );
134
140
LiveTServerSet tserverSet = EasyMock .createMock (LiveTServerSet .class );
135
141
136
142
GCStatus status = new GCStatus (null , null , null , new GcCycleStats ());
137
143
144
+ EasyMock .expect (context .getConfiguration ()).andReturn (conf ).times (2 );
145
+ EasyMock .expect (conf .getCount (Property .GC_DELETE_THREADS )).andReturn (8 ).anyTimes ();
138
146
tserverSet .scanServers ();
139
147
EasyMock .expectLastCall ();
140
148
EasyMock .expect (tserverSet .getCurrentServers ()).andReturn (Collections .singleton (server1 ));
141
149
142
150
EasyMock .expect (marker .getAllMarkers ()).andReturn (markers ).once ();
143
151
EasyMock .expect (marker .state (server1 , id )).andReturn (new Pair <>(WalState .CLOSED , path ));
144
- EasyMock .replay (context , marker , tserverSet , fs );
152
+ EasyMock .replay (conf , context , marker , tserverSet , fs );
145
153
var gc = new GarbageCollectWriteAheadLogs (context , fs , tserverSet , false , marker ,
146
154
tabletOnServer1List ) {
147
155
@ Override
@@ -156,11 +164,12 @@ protected Map<UUID,Path> getSortedWALogs() {
156
164
}
157
165
};
158
166
gc .collect (status );
159
- EasyMock .verify (context , marker , tserverSet , fs );
167
+ EasyMock .verify (conf , context , marker , tserverSet , fs );
160
168
}
161
169
162
170
@ Test
163
171
public void deleteUnreferencedLogOnDeadServer () throws Exception {
172
+ AccumuloConfiguration conf = EasyMock .createMock (AccumuloConfiguration .class );
164
173
ServerContext context = EasyMock .createMock (ServerContext .class );
165
174
VolumeManager fs = EasyMock .createMock (VolumeManager .class );
166
175
WalStateManager marker = EasyMock .createMock (WalStateManager .class );
@@ -170,6 +179,8 @@ public void deleteUnreferencedLogOnDeadServer() throws Exception {
170
179
171
180
GCStatus status = new GCStatus (null , null , null , new GcCycleStats ());
172
181
182
+ EasyMock .expect (context .getConfiguration ()).andReturn (conf ).times (2 );
183
+ EasyMock .expect (conf .getCount (Property .GC_DELETE_THREADS )).andReturn (8 ).anyTimes ();
173
184
tserverSet .scanServers ();
174
185
EasyMock .expectLastCall ();
175
186
EasyMock .expect (tserverSet .getCurrentServers ()).andReturn (Collections .singleton (server1 ));
@@ -195,7 +206,7 @@ public void deleteUnreferencedLogOnDeadServer() throws Exception {
195
206
EasyMock .expectLastCall ().once ();
196
207
marker .forget (server2 );
197
208
EasyMock .expectLastCall ().once ();
198
- EasyMock .replay (context , fs , marker , tserverSet , rscanner , mscanner );
209
+ EasyMock .replay (conf , context , fs , marker , tserverSet , rscanner , mscanner );
199
210
var gc = new GarbageCollectWriteAheadLogs (context , fs , tserverSet , false , marker ,
200
211
tabletOnServer1List ) {
201
212
@ Override
@@ -204,11 +215,12 @@ protected Map<UUID,Path> getSortedWALogs() {
204
215
}
205
216
};
206
217
gc .collect (status );
207
- EasyMock .verify (context , fs , marker , tserverSet , rscanner , mscanner );
218
+ EasyMock .verify (conf , context , fs , marker , tserverSet , rscanner , mscanner );
208
219
}
209
220
210
221
@ Test
211
222
public void ignoreReferenceLogOnDeadServer () throws Exception {
223
+ AccumuloConfiguration conf = EasyMock .createMock (AccumuloConfiguration .class );
212
224
ServerContext context = EasyMock .createMock (ServerContext .class );
213
225
VolumeManager fs = EasyMock .createMock (VolumeManager .class );
214
226
WalStateManager marker = EasyMock .createMock (WalStateManager .class );
@@ -218,6 +230,8 @@ public void ignoreReferenceLogOnDeadServer() throws Exception {
218
230
219
231
GCStatus status = new GCStatus (null , null , null , new GcCycleStats ());
220
232
233
+ EasyMock .expect (context .getConfiguration ()).andReturn (conf ).times (2 );
234
+ EasyMock .expect (conf .getCount (Property .GC_DELETE_THREADS )).andReturn (8 ).anyTimes ();
221
235
tserverSet .scanServers ();
222
236
EasyMock .expectLastCall ();
223
237
EasyMock .expect (tserverSet .getCurrentServers ()).andReturn (Collections .singleton (server1 ));
@@ -238,7 +252,7 @@ public void ignoreReferenceLogOnDeadServer() throws Exception {
238
252
mscanner .setRange (ReplicationSection .getRange ());
239
253
EasyMock .expectLastCall ().once ();
240
254
EasyMock .expect (mscanner .iterator ()).andReturn (emptyKV );
241
- EasyMock .replay (context , fs , marker , tserverSet , rscanner , mscanner );
255
+ EasyMock .replay (conf , context , fs , marker , tserverSet , rscanner , mscanner );
242
256
var gc = new GarbageCollectWriteAheadLogs (context , fs , tserverSet , false , marker ,
243
257
tabletOnServer2List ) {
244
258
@ Override
@@ -247,11 +261,12 @@ protected Map<UUID,Path> getSortedWALogs() {
247
261
}
248
262
};
249
263
gc .collect (status );
250
- EasyMock .verify (context , fs , marker , tserverSet , rscanner , mscanner );
264
+ EasyMock .verify (conf , context , fs , marker , tserverSet , rscanner , mscanner );
251
265
}
252
266
253
267
@ Test
254
268
public void replicationDelaysFileCollection () throws Exception {
269
+ AccumuloConfiguration conf = EasyMock .createMock (AccumuloConfiguration .class );
255
270
ServerContext context = EasyMock .createMock (ServerContext .class );
256
271
VolumeManager fs = EasyMock .createMock (VolumeManager .class );
257
272
WalStateManager marker = EasyMock .createMock (WalStateManager .class );
@@ -266,6 +281,8 @@ public void replicationDelaysFileCollection() throws Exception {
266
281
267
282
GCStatus status = new GCStatus (null , null , null , new GcCycleStats ());
268
283
284
+ EasyMock .expect (context .getConfiguration ()).andReturn (conf ).times (2 );
285
+ EasyMock .expect (conf .getCount (Property .GC_DELETE_THREADS )).andReturn (8 ).anyTimes ();
269
286
tserverSet .scanServers ();
270
287
EasyMock .expectLastCall ();
271
288
EasyMock .expect (tserverSet .getCurrentServers ()).andReturn (Collections .singleton (server1 ));
@@ -286,7 +303,7 @@ public void replicationDelaysFileCollection() throws Exception {
286
303
mscanner .setRange (ReplicationSection .getRange ());
287
304
EasyMock .expectLastCall ().once ();
288
305
EasyMock .expect (mscanner .iterator ()).andReturn (replicationWork .entrySet ().iterator ());
289
- EasyMock .replay (context , fs , marker , tserverSet , rscanner , mscanner );
306
+ EasyMock .replay (conf , context , fs , marker , tserverSet , rscanner , mscanner );
290
307
var gc = new GarbageCollectWriteAheadLogs (context , fs , tserverSet , false , marker ,
291
308
tabletOnServer1List ) {
292
309
@ Override
@@ -295,6 +312,6 @@ protected Map<UUID,Path> getSortedWALogs() {
295
312
}
296
313
};
297
314
gc .collect (status );
298
- EasyMock .verify (context , fs , marker , tserverSet , rscanner , mscanner );
315
+ EasyMock .verify (conf , context , fs , marker , tserverSet , rscanner , mscanner );
299
316
}
300
317
}
0 commit comments