2015-01-08 18 views
1

,但get(key)返回NULL我有以下拓扑: Infinispan集群处于Invalidation模式,puts在一个节点上执行并在其他节点上执行。 当群集只包含两个节点时,一切正常:当key/value插入到一个节点时,另一个当被问及第一次时,查询该节点并从那里获取值。如果密钥更新/删除,则发送失效消息。Invalidation模式下的Infinispan集群 - 尽管某些节点的值为

当群集中有两个以上的节点时,问题就开始了:将密钥插入到一个节点后,当另一个节点被要求输入密钥及其值时,它有时会返回该值,有时会返回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

失效缓存不检索远程值。这里描述[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

+0

谢谢你迅速和彻底的响应。 – Kikosha

+0

说,有没有一种方法可以设置某个节点的偏好以获取高于另一个节点的值? – Kikosha