reddycharan commented on a change in pull request #1391: Issue #570:
EntryLogManagerForEntryLogPerLedger implementation
URL: https://github.com/apache/bookkeeper/pull/1391#discussion_r189416753
##########
File path:
bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/CreateNewLogTest.java
##########
@@ -268,4 +508,64 @@ public void testCreateNewLogAndCompactionLog() throws
Exception {
"previousAllocatedEntryLogId after 2 times createNewLog is
called", 2,
el.getPreviousAllocatedEntryLogId());
}
+
+ /*
+ * In this testcase entrylogs for ledgers are tried to create concurrently.
+ */
+ @Test
+ public void testConcurrentEntryLogCreations() throws Exception {
+ ServerConfiguration conf =
TestBKConfiguration.newServerConfiguration();
+
+ // Creating a new configuration with a number of ledger directories.
+ conf.setLedgerDirNames(ledgerDirs);
+ // pre-allocation is enabled
+ conf.setEntryLogFilePreAllocationEnabled(true);
+ conf.setEntryLogPerLedgerEnabled(true);
+ LedgerDirsManager ledgerDirsManager = new LedgerDirsManager(conf,
conf.getLedgerDirs(),
+ new DiskChecker(conf.getDiskUsageThreshold(),
conf.getDiskUsageWarnThreshold()));
+ EntryLogger entryLogger = new EntryLogger(conf, ledgerDirsManager);
+ EntryLogManagerForEntryLogPerLedger entrylogManager =
(EntryLogManagerForEntryLogPerLedger)
+ entryLogger.getEntryLogManager();
+
+ int numOfLedgers = 10;
+ int numOfThreadsForSameLedger = 10;
+ AtomicInteger createdEntryLogs = new AtomicInteger(0);
+ CountDownLatch startLatch = new CountDownLatch(1);
+ CountDownLatch createdLatch = new CountDownLatch(numOfLedgers *
numOfThreadsForSameLedger);
+
+ for (long i = 0; i < numOfLedgers; i++) {
+ for (int j = 0; j < numOfThreadsForSameLedger; j++) {
+ long ledgerId = i;
+ new Thread() {
+ @Override
+ public void run() {
Review comment:
changed it to lambda
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services