无效模式下的 Infinispan 集群 - get(key) returns NULL 尽管某些节点具有值

Infinispan cluster in Invalidation mode - get(key) returns NULL though some nodes have the value

我有以下拓扑: Infinispan集群在Invalidation模式下,在一个节点上执行puts,在其他节点上执行gets。 当集群仅包含两个节点时,一切正常:当 key/value 插入一个节点时,另一个节点在第一次被请求时查询该节点并从那里获取值。如果密钥是 updated/removed,则发送一条无效消息。

当集群中有两个以上的节点时,问题就开始了:将密钥插入一个节点后,当另一个节点被要求提供该密钥及其值时,它有时会 return 值有时 return 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 个以上的缓存,并且正如您所经历的那样,远程查找中出现了错误。如果没有值 returns 的节点在具有值的节点之前(它采用第一个响应),则缓存加载器 returns 似乎为 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