如何在失败后恢复写入队列

问题描述 投票:0回答:1

磁盘空间完成后,我收到InternalError。添加磁盘空间并不能解决问题。


是否有可能恢复并继续保留?可能出现错误,我可以尝试重新创建/关闭?

创建queue queue = SingleChronicleQueueBuilder.binary(basePath) .build();

在单线程上写“ TradeReactorEventPersister-1”

    ExcerptAppender appender = acquireAppender;
    if (appender == null) {
        appender = queue.acquireAppender();
        acquireAppender = appender;
    }
    appender.writeBytes(BytesStore.wrap(b));

[下一个例外之后:

2019-08-23 08:13:26.963 +0000 ERROR [TradeReactorEventPersister-1] LoggingUncaughtExceptionHandler - Uncaught exception a fault occurred in a recent unsafe memory access operation in compiled Java code in thread TradeReactorEventPersister-1 
java.lang.InternalError: a fault occurred in a recent unsafe memory access operation in compiled Java code
        at net.openhft.chronicle.wire.AbstractWire.updateHeaderAssertions(AbstractWire.java:546)
        at net.openhft.chronicle.wire.AbstractWire.updateHeader(AbstractWire.java:533)
        at net.openhft.chronicle.queue.impl.single.SingleChronicleQueueExcerpts$StoreAppender.writeBytes(SingleChronicleQueueExcerpts.java:470)

2019-08-23 08:13:26.965 +0000 ERROR [TradeReactorEventPersister-1] LoggingUncaughtExceptionHandler - Uncaught exception a fault occurred in a recent unsafe memory access operation in compiled Java code in thread TradeReactorEventPersister-1 
java.lang.InternalError: a fault occurred in a recent unsafe memory access operation in compiled Java code
        at net.openhft.chronicle.wire.AbstractWire.updateHeaderAssertions(AbstractWire.java:547)
        at net.openhft.chronicle.wire.AbstractWire.updateHeader(AbstractWire.java:533)
        at net.openhft.chronicle.queue.impl.single.SingleChronicleQueueExcerpts$StoreAppender.writeBytes(SingleChronicleQueueExcerpts.java:470)

2019-08-23 08:13:27.166 +0000 ERROR [TradeReactorEventPersister-1] LoggingUncaughtExceptionHandler - Uncaught exception a fault occurred in a recent unsafe memory access operation in compiled Java code in thread TradeReactorEventPersister-1 
java.lang.InternalError: a fault occurred in a recent unsafe memory access operation in compiled Java code
        at net.openhft.chronicle.wire.AbstractWire.updateHeader(AbstractWire.java:511)
        at net.openhft.chronicle.queue.impl.single.SingleChronicleQueueExcerpts$StoreAppender.writeBytes(SingleChronicleQueueExcerpts.java:470)

2019-08-23 08:13:27.167 +0000 ERROR [TradeReactorEventPersister-1] LoggingUncaughtExceptionHandler - Uncaught exception you cant put a header inside a header, check that you have not nested the documents. If you are using Chronicle-Queue please ensure that you have a unique instance of the Appender per thread, in other-words you can not share appenders across threads. in thread TradeReactorEventPersister-1 
java.lang.AssertionError: you cant put a header inside a header, check that you have not nested the documents. If you are using Chronicle-Queue please ensure that you have a unique instance of the Appender per thread, in other-words you can not share appenders across threads.
        at net.openhft.chronicle.wire.AbstractWire.enterHeader(AbstractWire.java:322)
        at net.openhft.chronicle.queue.impl.single.SingleChronicleQueueExcerpts$StoreAppender.writeHeader(SingleChronicleQueueExcerpts.java:405)
        at net.openhft.chronicle.queue.impl.single.SingleChronicleQueueExcerpts$StoreAppender.writeBytes(SingleChronicleQueueExcerpts.java:463)

添加磁盘空间后,我无法坚持。我在每次尝试保留事件时都遇到了最后一个异常:

2019-08-23 08:22:50.746 +0000 ERROR [TradeReactorEventPersister-1] LoggingUncaughtExceptionHandler - Uncaught exception you cant put a header inside a header, check that you have not nested the documents. If you are using Chronicle-Queue please ensure that you have a unique instance of the Appender per thread, in other-words you can not share appenders across threads. in thread TradeReactorEventPersister-1 
java.lang.AssertionError: you cant put a header inside a header, check that you have not nested the documents. If you are using Chronicle-Queue please ensure that you have a unique instance of the Appender per thread, in other-words you can not share appenders across threads.
        at net.openhft.chronicle.wire.AbstractWire.enterHeader(AbstractWire.java:322)
        at net.openhft.chronicle.queue.impl.single.SingleChronicleQueueExcerpts$StoreAppender.writeHeader(SingleChronicleQueueExcerpts.java:405)
        at net.openhft.chronicle.queue.impl.single.SingleChronicleQueueExcerpts$StoreAppender.writeBytes(SingleChronicleQueueExcerpts.java:463)
chronicle chronicle-queue
1个回答
0
投票

不幸的是,编年史队列工作在非常低的级别,并且在数据损坏后它无法自动修复自身(磁盘空间将不可避免地导致数据损坏)。顺便说一句,为避免这种情况,如果磁盘空间不足,Chronicle Queue会警告您,您应该已经看到类似以下的警告消息:"your disk " + this.fileStore + " is almost full, warning: chronicle-queue may crash if it runs out of space."

PS,您实际上不需要执行惰性获取逻辑。您总是可以简单地执行queue.acquireAppender()-这是一个便宜的调用,它从ThreadLocal池中获取预先存在的附加程序,并且每次都会[[not创建新的附加程序。

© www.soinside.com 2019 - 2024. All rights reserved.