首页 > 解决方案 > Apache Ignite:到达文件段的逻辑结尾

问题描述

我启用了 Ignite 本机持久性并禁用了 WAL 日志:

<property name="dataStorageConfiguration">
    <bean class="org.apache.ignite.configuration.DataStorageConfiguration">
        <property name="defaultDataRegionConfiguration">
            <bean class="org.apache.ignite.configuration.DataRegionConfiguration">
                <property name="persistenceEnabled" value="true"/>
            </bean>
        </property>
        <!-- disabled wal log because query result doesn't need recovery -->
        <property name="walMode" value="NONE"/>
    </bean>
</property>
<property name="cacheConfiguration">
    <bean class="org.apache.ignite.configuration.CacheConfiguration">
        <!-- Set the cache name. -->
        <property name="name" value="query_cache"/>
        <!-- Set the cache mode. -->
        <property name="cacheMode" value="PARTITIONED"/>
    </bean>
</property>

我通过应用程序启动服务器并在另一个类中操作缓存:

public class IgniteServer {
    public static void main(String[] args) {
        Ignite ignite = Ignition.start("examples/config/ignite-server-config.xml");
        ignite.cluster().state(ClusterState.ACTIVE);
    }
}


try (Ignite ignite = Ignition.start("examples/config/ignite-server-config.xml")) {
    IgniteCache cache = ignite.getOrCreateCache("query_cache");
    cache.put("1", "value-1");
    System.out.println(cache.get("1"));
}

这工作正常,但在停止 IgniteServer 后,我无法再次重新启动它,并出现以下错误:

[15:28:20] Initialized write-ahead log manager in NONE mode, persisted data may be lost in a case of unexpected node failure. Make sure to deactivate the cluster before shutdown.
[2021-03-18 15:28:20,876][ERROR][main][root] Critical system error detected. Will be handled accordingly to configured handler [hnd=StopNodeOrHaltFailureHandler [tryStop=false, timeout=0, super=AbstractFailureHandler [ignoredFailureTypes=UnmodifiableSet [SYSTEM_WORKER_BLOCKED, SYSTEM_CRITICAL_OPERATION_TIMEOUT]]], failureCtx=FailureContext [type=CRITICAL_ERROR, err=class o.a.i.i.processors.cache.persistence.StorageException: Failed to read checkpoint record from WAL, persistence consistency cannot be guaranteed. Make sure configuration points to correct WAL folders and WAL folder is properly mounted [ptr=FileWALPointer [idx=0, fileOff=0, len=0], walPath=db/wal, walArchive=db/wal/archive]]]
class org.apache.ignite.internal.processors.cache.persistence.StorageException: Failed to read checkpoint record from WAL, persistence consistency cannot be guaranteed. Make sure configuration points to correct WAL folders and WAL folder is properly mounted [ptr=FileWALPointer [idx=0, fileOff=0, len=0], walPath=db/wal, walArchive=db/wal/archive]
    at org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager.performBinaryMemoryRestore(GridCacheDatabaseSharedManager.java:2269)
    at org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager.readMetastore(GridCacheDatabaseSharedManager.java:873)
    at org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager.notifyMetaStorageSubscribersOnReadyForRead(GridCacheDatabaseSharedManager.java:5022)
    at org.apache.ignite.internal.IgniteKernal.start(IgniteKernal.java:1251)
    at org.apache.ignite.internal.IgnitionEx$IgniteNamedInstance.start0(IgnitionEx.java:2052)
    at org.apache.ignite.internal.IgnitionEx$IgniteNamedInstance.start(IgnitionEx.java:1698)
    at org.apache.ignite.internal.IgnitionEx.start0(IgnitionEx.java:1114)
    at org.apache.ignite.internal.IgnitionEx.startConfigurations(IgnitionEx.java:1032)
    at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:918)
    at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:817)
    at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:687)
    at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:656)
    at org.apache.ignite.Ignition.start(Ignition.java:353)
    at org.apache.ignite.examples.atest.IgniteServer.main(IgniteServer.java:9)
[2021-03-18 15:28:20,881][ERROR][main][root] JVM will be halted immediately due to the failure: [failureCtx=FailureContext [type=CRITICAL_ERROR, err=class o.a.i.i.processors.cache.persistence.StorageException: Failed to read checkpoint record from WAL, persistence consistency cannot be guaranteed. Make sure configuration points to correct WAL folders and WAL folder is properly mounted [ptr=FileWALPointer [idx=0, fileOff=0, len=0], walPath=db/wal, walArchive=db/wal/archive]]]

有时服务器会自动关闭并显示以下消息:

FileWriteAheadLogManager: Reached logical end of the segment for file: /ignite/work/db/wal/node-xxxx/xxx.wal

我禁用了 WAL 日志,我不知道为什么它仍然读取检查点并失败。我检查了 $IGNITE_HOME/work/db/wal/node-xxx/,我发现了 10 个 wal 文件,它们的大小都是 67.1MB,似乎有一个无限循环并将​​它们全部填满。删除工作文件夹后,我可以再次启动服务。

问题:

  1. 如何通过本机持久性和 WAL 注销来解决此问题
  2. 好像我以错误的方式关闭服务器,如何在不检查检查点的情况下通过代码安全地停止服务器?

谢谢。

标签: ignite

解决方案


  1. 我反对walMode=NONE。如果必须使用它,请确保在重新启动节点之前删除整个持久性目录,或者
  2. ignite.cluster().state(INACTIVE)在关闭任何节点之前尝试调用。

推荐阅读