This is an automated email from the ASF dual-hosted git repository. yong pushed a commit to branch branch-4.15 in repository https://gitbox.apache.org/repos/asf/bookkeeper.git
commit ea146161a917bdfa85ea64b8629d22adf8c0f97f Author: wenbingshen <[email protected]> AuthorDate: Tue Jul 26 11:34:27 2022 +0800 Stable testBookieContinueWritingIfMultipleLedgersPresent test (#3421) ### Motivation Fixes issue #2665 When the disk is full, `InterleavedLedgerStorage` creates a new entryLog and index file, copies and moves the old index (newFile) `FileInfo` to the new directory, and finally deletes the old index file. The old file of `FileInfo` was `deleted`, but it was copied and moved a newFile to the new directory. Therefore, the delete status flag should be restored. If it is not set to false,`checkOpen` will throw `FileInfoDeletedException` when judging the fence status of `ledgerHandle` when adding an entry, causing the writing to fail. When the client changes the `ensemble`, it throws an exception because the test has only two bookie nodes and cannot satisfy the two writeSet: `Not enough non [...] ```java public synchronized boolean isFenced() throws IOException { checkOpen(false); return (stateBits & STATE_FENCED_BIT) == STATE_FENCED_BIT; } private synchronized void checkOpen(boolean create, boolean openBeforeClose) throws IOException { if (deleted) { throw new FileInfoDeletedException(); } ..... } ``` ### Changes When `FileInfo` moves to a new directory by `moveToNewLocation`,delete the old index file and restore the `delete` flag, because the new index file is ready. Set the disk check interval to the `Integer.MAX_VALUE`, which is stable `assertEquals("writable dirs should have one dir", 1, ledgerDirsManager .getWritableLedgerDirs().size());` Because once the test thrashes, the disk check thread will restore the full disk to a writable state. ```java newConf.setDiskCheckInterval(Integer.MAX_VALUE); ``` (cherry picked from commit 1908b7ecdbe4aea0dabdb91009d9635a4d14c533) --- .../src/main/java/org/apache/bookkeeper/bookie/FileInfo.java | 1 + .../src/test/java/org/apache/bookkeeper/test/ReadOnlyBookieTest.java | 1 + 2 files changed, 2 insertions(+) diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/FileInfo.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/FileInfo.java index 89f820b56d..553d52f606 100644 --- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/FileInfo.java +++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/FileInfo.java @@ -549,6 +549,7 @@ class FileInfo extends Watchable<LastAddConfirmedUpdateNotification> { } fc = new RandomAccessFile(newFile, mode).getChannel(); lf = newFile; + deleted = false; } public synchronized byte[] getMasterKey() throws IOException { diff --git a/bookkeeper-server/src/test/java/org/apache/bookkeeper/test/ReadOnlyBookieTest.java b/bookkeeper-server/src/test/java/org/apache/bookkeeper/test/ReadOnlyBookieTest.java index e1270d25b4..cf03cf6629 100644 --- a/bookkeeper-server/src/test/java/org/apache/bookkeeper/test/ReadOnlyBookieTest.java +++ b/bookkeeper-server/src/test/java/org/apache/bookkeeper/test/ReadOnlyBookieTest.java @@ -248,6 +248,7 @@ public class ReadOnlyBookieTest extends BookKeeperClusterTestCase { ServerConfiguration newConf = newServerConfiguration( PortManager.nextFreePort(), ledgerDirs[0], ledgerDirs); + newConf.setDiskCheckInterval(Integer.MAX_VALUE); startAndAddBookie(newConf); }
