[
https://issues.apache.org/jira/browse/ZOOKEEPER-4847?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17869585#comment-17869585
]
Xin Chen commented on ZOOKEEPER-4847:
-------------------------------------
The code written into the contents of this file is as follows:
{code:java}
/**
* Write a long value to disk atomically. Either succeeds or an exception
* is thrown.
* @param name file name to write the long to
* @param value the long value to write to the named file
* @throws IOException if the file cannot be written atomically
*/
// visibleForTest
void writeLongToFile(String name, final long value) throws IOException {
File file = new File(logFactory.getSnapDir(), name);
new AtomicFileWritingIdiom(file, new WriterStatement() {
@Override
public void write(Writer bw) throws IOException {
bw.write(Long.toString(value));
}
});
} {code}
At the moment when the file was written with letters, there may have been a
node power outage, disk failure, etc., but I feel that these should not have
caused the writing of long numbers to become writing letters ‘od’. Who has
experience and insights in this area, please.
> Found od in /cloud/data/zookeeper/data/version-2/currentEpoch
> -------------------------------------------------------------
>
> Key: ZOOKEEPER-4847
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-4847
> Project: ZooKeeper
> Issue Type: Bug
> Affects Versions: 3.4.14, 3.6.4, 3.9.2
> Reporter: Xin Chen
> Priority: Major
>
> {code:java}
> 2024-07-30 16:32:48,950 [myid:1] - ERROR [main:QuorumPeer@1148] - Unable to
> load database on disk
> java.io.IOException: Found od in
> /cloud/data/zookeeper/data/version-2/currentEpoch
> at
> org.apache.zookeeper.server.quorum.QuorumPeer.readLongFromFile(QuorumPeer.java:2126)
> at
> org.apache.zookeeper.server.quorum.QuorumPeer.loadDataBase(QuorumPeer.java:1100)
> at
> org.apache.zookeeper.server.quorum.QuorumPeer.start(QuorumPeer.java:1079)
> at
> org.apache.zookeeper.server.quorum.QuorumPeerMain.runFromConfig(QuorumPeerMain.java:227)
> at
> org.apache.zookeeper.server.quorum.QuorumPeerMain.initializeAndRun(QuorumPeerMain.java:136)
> at
> org.apache.zookeeper.server.quorum.QuorumPeerMain.main(QuorumPeerMain.java:90)
> 2024-07-30 16:32:48,953 [myid:1] - ERROR [main:QuorumPeerMain@113] -
> Unexpected exception, exiting abnormally
> java.lang.RuntimeException: Unable to run quorum server
> at
> org.apache.zookeeper.server.quorum.QuorumPeer.loadDataBase(QuorumPeer.java:1149)
> at
> org.apache.zookeeper.server.quorum.QuorumPeer.start(QuorumPeer.java:1079)
> at
> org.apache.zookeeper.server.quorum.QuorumPeerMain.runFromConfig(QuorumPeerMain.java:227)
> at
> org.apache.zookeeper.server.quorum.QuorumPeerMain.initializeAndRun(QuorumPeerMain.java:136)
> at
> org.apache.zookeeper.server.quorum.QuorumPeerMain.main(QuorumPeerMain.java:90)
> Caused by: java.io.IOException: Found od in
> /cloud/data/zookeeper/data/version-2/currentEpoch
> at
> org.apache.zookeeper.server.quorum.QuorumPeer.readLongFromFile(QuorumPeer.java:2126)
> at
> org.apache.zookeeper.server.quorum.QuorumPeer.loadDataBase(QuorumPeer.java:1100)
> ... 4 more
> 2024-07-30 16:32:48,954 [myid:1] - INFO [main:ZKAuditProvider@42] -
> ZooKeeper audit is disabled.
> 2024-07-30 16:32:48,955 [myid:1] - ERROR [main:ServiceUtils@48] - Exiting JVM
> with code 1
> {code}
> I accidentally encountered this error and found that the current Epoch file
> had been written with letters. Then, the zk process detected the contents of
> this file during restart and threw an exception before exiting the process.
> However, zk was unable to recover it.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)