Skip to content

Commit a346381

Browse files
vivekratnavelbharatviswa504
authored andcommitted
HDDS-2168. TestOzoneManagerDoubleBufferWithOMResponse sometimes fails with out of memory error (#1509)
1 parent 6917754 commit a346381

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/ratis/TestOzoneManagerDoubleBufferWithOMResponse.java

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,9 @@ public class TestOzoneManagerDoubleBufferWithOMResponse {
8484
public TemporaryFolder folder = new TemporaryFolder();
8585

8686
@Before
87-
public void setup() throws IOException {
88-
ozoneManager = Mockito.mock(OzoneManager.class);
87+
public void setup() throws IOException {
88+
ozoneManager = Mockito.mock(OzoneManager.class,
89+
Mockito.withSettings().stubOnly());
8990
omMetrics = OMMetrics.create();
9091
OzoneConfiguration ozoneConfiguration = new OzoneConfiguration();
9192
ozoneConfiguration.set(OMConfigKeys.OZONE_OM_DB_DIRS,
@@ -125,7 +126,7 @@ public void testDoubleBuffer() throws Exception {
125126
testDoubleBuffer(1, 10);
126127
testDoubleBuffer(10, 100);
127128
testDoubleBuffer(100, 100);
128-
testDoubleBuffer(1000, 100);
129+
testDoubleBuffer(1000, 500);
129130
}
130131

131132
/**
@@ -373,14 +374,15 @@ public void testDoubleBuffer(int iterations, int bucketCount)
373374
setup();
374375
for (int i = 0; i < iterations; i++) {
375376
Daemon d1 = new Daemon(() ->
376-
doTransactions(RandomStringUtils.randomAlphabetic(5), bucketCount));
377+
doTransactions(RandomStringUtils.randomAlphabetic(5),
378+
bucketCount));
377379
d1.start();
378380
}
379381

380382
// We are doing +1 for volume transaction.
381383
long expectedTransactions = (bucketCount + 1) * iterations;
382384
GenericTestUtils.waitFor(() -> lastAppliedIndex == expectedTransactions,
383-
100, 120000);
385+
100, 500000);
384386

385387
Assert.assertEquals(expectedTransactions,
386388
doubleBuffer.getFlushedTransactionCount()
@@ -428,15 +430,6 @@ public void doTransactions(String volumeName, int bucketCount) {
428430
for (int i=0; i< bucketCount; i++) {
429431
createBucket(volumeName, UUID.randomUUID().toString(),
430432
trxId.incrementAndGet());
431-
// For every 100 buckets creation adding 100ms delay
432-
433-
if (i % 100 == 0) {
434-
try {
435-
Thread.sleep(100);
436-
} catch (Exception ex) {
437-
438-
}
439-
}
440433
}
441434
}
442435

0 commit comments

Comments
 (0)