Infinispan 集群处于失效模式 - get(key) 返回 NULL,尽管某些节点具有该值



我有以下拓扑:Infinispan集群处于失效模式,放置在一个节点上执行,get在其他节点上执行。当集群仅由两个节点组成时,一切正常:当键/值插入一个节点时,另一个节点在第一次被询问时,查询该节点并从那里获取值。如果更新/删除密钥,则会发送失效消息。

当群集中有两个以上的节点时,

问题就开始了:将密钥插入一个节点后,当要求另一个节点提供该密钥及其值时,它有时返回值,有时返回 NULL。

从某些角度来看,这是有道理的,因为节点查询其邻居,其中一些具有值,而其他则没有。无论哪个回复先出现哪个,都将定义响应是 NULL 还是实际值。

虽然有道理,但这种行为使这种操作模式变得毫无用处,这让我觉得也许我错过了什么。这是我的配置:

<infinispan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:infinispan:config:7.0 http://www.infinispan.org/schemas/infinispan-config-7.0.xsd"  xmlns="urn:infinispan:config:7.0">
    <jgroups>
        <stack-file name="tcp" path="jgroups-tcp.xml" />
    </jgroups>
   <cache-container name="SampleCacheManager" statistics="true" default-cache="invalidatedWithClusterCacheLoaderCache" shutdown-hook="DEFAULT">
     <transport stack="tcp" cluster="clustered" node-name="NodeA"/>
     <serialization marshaller="org.infinispan.marshall.core.VersionAwareMarshaller"            version="1.0">
     </serialization>
     <jmx domain="org.infinispan" />    
     <invalidation-cache name="invalidatedWithClusterCacheLoaderCache" mode="SYNC" remote-timeout="20000" >
        <persistence>
                <cluster-loader remote-timeout="20000" preload="false" ></cluster-loader>
        </persistence> 
     </invalidation-cache>
   </cache-container>
</infinispan>

jgroups-tcp.xml:

<config xmlns="urn:org:jgroups"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="urn:org:jgroups http://www.jgroups.org/schema/JGroups-3.4.xsd">
    <TCP bind_port="7800" port_range="10"
         recv_buf_size="20000000"
         send_buf_size="640000"
         loopback="false"
         max_bundle_size="64k"
         bundler_type="sender-sends-with-timer"
         enable_diagnostics="true"
         thread_naming_pattern="cl"
         timer_type="new"
         timer.min_threads="4"
         timer.max_threads="10"
         timer.keep_alive_time="3000"
         timer.queue_max_size="1000"
         timer.wheel_size="200"
         timer.tick_time="50"
         thread_pool.enabled="true"
         thread_pool.min_threads="2"
         thread_pool.max_threads="8"
         thread_pool.keep_alive_time="5000"
         thread_pool.queue_enabled="true"
         thread_pool.queue_max_size="100000"
         thread_pool.rejection_policy="discard"
         oob_thread_pool.enabled="true"
         oob_thread_pool.min_threads="1"
         oob_thread_pool.max_threads="8"
         oob_thread_pool.keep_alive_time="5000"
         oob_thread_pool.queue_enabled="false"
         oob_thread_pool.queue_max_size="100"
         oob_thread_pool.rejection_policy="discard"/>
   <MPING bind_addr="${jgroups.bind_addr:127.0.0.1}" break_on_coord_rsp="true"
          mcast_addr="${jgroups.mping.mcast_addr:228.2.4.6}"
          mcast_port="${jgroups.mping.mcast_port:43366}"
          ip_ttl="${jgroups.udp.ip_ttl:2}"
          num_initial_members="2" timeout="2000"/>
    <MERGE3/>
    <FD_SOCK/>
    <FD_ALL interval="2000" timeout="5000" />
    <VERIFY_SUSPECT timeout="500"  />
    <BARRIER />
    <pbcast.NAKACK use_mcast_xmit="false"
                   retransmit_timeout="100,300,600,1200"
                   discard_delivered_msgs="true" />
    <UNICAST3 conn_expiry_timeout="0"/>
    <pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000"
                   max_bytes="10m"/>
    <pbcast.GMS print_local_addr="true" join_timeout="5000"
                max_bundling_time="30"
                view_bundling="true"/>
    <MFC max_credits="2M"
         min_threshold="0.4"/>
    <FRAG2 frag_size="60000"  />
    <pbcast.STATE_TRANSFER  />
</config>

总结一下我的问题:它应该以这种方式工作还是在我的情况下配置错误?

失效缓存不检索远程值。 这里描述了它[1]。 它只会在内存中本地检索值。

远程查找由您在持久性配置中配置的集群加载程序完成。 这将要求群集中的所有其他节点输入该值。 我调整了现有的 Infinispan 测试之一,使其具有 2 个以上的缓存,正如您所经历的那样,远程查找中存在遗漏。 如果没有值的节点在具有该值的节点之前返回(它采用第一个响应),则缓存加载程序似乎返回 null。

我登录 [2] 来研究这个问题。

[1] http://infinispan.org/docs/7.0.x/user_guide/user_guide.html#_invalidation_mode[2] https://issues.jboss.org/browse/ISPN-5134

最新更新