IgniteException:找不到原子序数很长

时间:2017-10-11 22:00:44

标签: ignite

我正在运行带有1个服务器和2个客户端的Ignite v2.1。客户端在Tomcat服务器上运行并使用IgniteSpringBean。

两个客户端都使用相同的IgniteAtomicLong。当一个客户端从网格中删除时,当另一个客户端尝试使用AtomicLong时,它会抛出以下异常:

class org.apache.ignite.IgniteException: Failed to find atomic long: MY_ATOMIC_LONG
at org.apache.ignite.internal.processors.datastructures.GridCacheAtomicLongImpl.getAndIncrement(GridCacheAtomicLongImpl.java:153)

(我没有看到IgniteAtomicSequence的这种行为)

以下是上面列出的例外情况:

java.lang.IllegalStateException: Atomic long was removed from cache: MY_ATOMIC_LONG
at org.apache.ignite.internal.processors.datastructures.GridCacheAtomicLongImpl.removedError(GridCacheAtomicLongImpl.java:328)
at org.apache.ignite.internal.processors.datastructures.GridCacheAtomicLongImpl.checkRemoved(GridCacheAtomicLongImpl.java:304)
at org.apache.ignite.internal.processors.datastructures.GridCacheAtomicLongImpl.getAndIncrement(GridCacheAtomicLongImpl.java:143)

这是服务器配置:

<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="
   http://www.springframework.org/schema/beans
   http://www.springframework.org/schema/beans/spring-beans.xsd">
    <!--
        Alter configuration below as needed.
    -->
    <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
        <property name="peerClassLoadingEnabled" value="true"/>

        <property name="atomicConfiguration">
          <bean class="org.apache.ignite.configuration.AtomicConfiguration">
            <property name="backups" value="1"/>
          </bean>
        </property>

    </bean>     

这是客户端配置(缩写):

visor> config
Select node from:
+===================================================================================+
| # |     Node ID8(@), IP      | Node Type | Up Time  | CPUs | CPU Load | Free Heap |
+===================================================================================+
| 0 | D67C1CCE(@n0), 10.0.2.15 | Server    | 01:52:48 | 1    | 1.00 %   | 94.00 %   |
| 1 | E9CCF354(@n1), 10.0.2.15 | Client    | 00:27:59 | 1    | 0.67 %   | 71.00 %   |
+-----------------------------------------------------------------------------------+

Choose node number ('c' to cancel) [0]: 1
Common Parameters:
+---------------------------------------------------------------------------+
| Grid name                        | <default>                              |
| Ignite home                      | <n/a>                                  |
| Localhost                        | <n/a>                                  |
| Consistent ID                    | <n/a>                                  |
| Marshaller                       | o.a.i.i.binary.BinaryMarshaller        |
| Deployment mode                  | SHARED                                 |
| ClientMode                       | on                                     |
| Daemon                           | off                                    |
| Remote JMX enabled               | on                                     |
| Node restart enabled             | off                                    |
| Network timeout                  | 5000ms                                 |
| Grid logger                      | o.a.i.i.GridLoggerProxy                |
| Discovery startup delay          | 60000ms                                |
| MBean server                     | com.sun.jmx.mbeanserver.JmxMBeanServer |
| ASCII logo disabled              | off                                    |
| Discovery order not required     | off                                    |
| Shutdown hook disabled           | off                                    |
| Program name                     | <n/a>                                  |
| Quiet mode                       | on                                     |
| Success filename                 | <n/a>                                  |
| Update notification enabled      | on                                     |
| Include properties               | <n/a>                                  |
| Atomic Cache Mode                | PARTITIONED                            |
| Atomic Sequence Reservation Size | 1000                                   |
| Atomic Number Of Backup Nodes    | 0                                      |
| Transaction Concurrency          | OPTIMISTIC                             |
| Transaction Isolation            | SERIALIZABLE                           |
| Transaction Timeout              | 0ms                                    |
| Transaction Log Cleanup Delay    | 10000ms                                |
| Transaction Log Size             | 0                                      |
| Transaction Manager Factory      |                                        |
| Transaction Use JTA              | off                                    |
+---------------------------------------------------------------------------+

Peer-to-Peer:
+------------------------------------+
| Peer class loading enabled   | on  |
| Missed resources cache size  | 100 |
| Peer-to-Peer loaded packages | []  |
+------------------------------------+

+---------------+

Executor services:
+------------------------------------+
| Public thread pool size        | 8 |
| System thread pool size        | 8 |
| Management thread pool size    | 4 |
| IGFS thread pool size          | 1 |
| Peer-to-Peer thread pool size  | 2 |
| Rebalance Thread Pool size     | 1 |
| REST thread pool size          | 8 |
| SQL processor thread pool size | 8 |
+------------------------------------+

Segmentation:
+----------------------------------------+
| Segmentation policy            | STOP  |
| Segmentation resolvers         | <n/a> |
| Segmentation check frequency   | 10000 |
| Wait for segmentation on start | on    |
| All resolvers pass required    | on    |
+----------------------------------------+

Cache 'ignite-sys-cache':
+========================================================================================================+
|                   Name                    |                           Value                            |
+========================================================================================================+
| Group                                     |                                                            |
| Dynamic Deployment ID                     | e8b0e511f51-d33f45a3-5f16-4ff9-98e7-66b9d5086cbc           |
| Mode                                      | REPLICATED                                                 |
| Atomicity Mode                            | TRANSACTIONAL                                              |
| Statistic Enabled                         | off                                                        |
| Management Enabled                        | off                                                        |
| Time To Live Eager Flag                   | true                                                       |
| Write Synchronization Mode                | FULL_SYNC                                                  |
| Invalidate                                | off                                                        |
| Affinity Function                         | o.a.i.cache.affinity.rendezvous.RendezvousAffinityFunction |
| Affinity Backups                          | 2147483647                                                 |
| Affinity Partitions                       | 100                                                        |
| Affinity Exclude Neighbors                | false                                                      |
| Affinity Mapper                           | o.a.i.i.processors.cache.GridCacheDefaultAffinityKeyMapper |
| Rebalance Mode                            | SYNC                                                       |
| Rebalance Batch Size                      | 524288                                                     |
| Rebalance Timeout                         | 10000                                                      |
| Rebalance Delay                           | 0                                                          |
| Time Between Rebalance Messages           | 0                                                          |
| Eviction Policy Enabled                   | off                                                        |
| Eviction Policy                           | <n/a>                                                      |
| Eviction Policy Max Size                  | <n/a>                                                      |
| Eviction Filter                           | <n/a>                                                      |
| Near Cache Enabled                        | off                                                        |
| Near Start Size                           | 0                                                          |
| Near Eviction Policy                      | <n/a>                                                      |
| Near Eviction Policy Max Size             | <n/a>                                                      |
| Default Lock Timeout                      | 0                                                          |
| Metadata type count                       | 0                                                          |
| Cache Interceptor                         | <n/a>                                                      |
| Store Enabled                             | off                                                        |
| Store Class                               | <n/a>                                                      |
| Store Factory Class                       |                                                            |
| Store Keep Binary                         | false                                                      |
| Store Read Through                        | off                                                        |
| Store Write Through                       | off                                                        |
| Write-Behind Enabled                      | off                                                        |
| Write-Behind Flush Size                   | 10240                                                      |
| Write-Behind Frequency                    | 5000                                                       |
| Write-Behind Flush Threads Count          | 1                                                          |
| Write-Behind Batch Size                   | 512                                                        |
| Concurrent Asynchronous Operations Number | 500                                                        |
| Loader Factory Class Name                 | <n/a>                                                      |
| Writer Factory Class Name                 | <n/a>                                                      |
| Expiry Policy Factory Class Name          | javax.cache.configuration.FactoryBuilder$SingletonFactory  |
| Query Execution Time Threshold            | 3000                                                       |
| Query Schema Name                         |                                                            |
| Query Escaped Names                       | off                                                        |
| Query SQL functions                       | <n/a>                                                      |
| Query Indexed Types                       | <n/a>                                                      |
+--------------------------------------------------------------------------------------------------------+


Cache 'ignite-sys-atomic-cache@default-ds-group':
+==========================================================================================================+
|                   Name                    |                            Value                             |
+==========================================================================================================+
| Group                                     | default-ds-group                                             |
| Dynamic Deployment ID                     | a2e3f511f51-3dcaee4b-3f06-437d-99ae-2bd541f06ec8             |
| Mode                                      | PARTITIONED                                                  |
| Atomicity Mode                            | TRANSACTIONAL                                                |
| Statistic Enabled                         | off                                                          |
| Management Enabled                        | off                                                          |
| Time To Live Eager Flag                   | true                                                         |
| Write Synchronization Mode                | FULL_SYNC                                                    |
| Invalidate                                | off                                                          |
| Affinity Function                         | o.a.i.cache.affinity.rendezvous.RendezvousAffinityFunction   |
| Affinity Backups                          | 0                                                            |
| Affinity Partitions                       | 1024                                                         |
| Affinity Exclude Neighbors                | false                                                        |
| Affinity Mapper                           | o.a.i.i.processors.cache.CacheDefaultBinaryAffinityKeyMapper |
| Rebalance Mode                            | SYNC                                                         |
| Rebalance Batch Size                      | 524288                                                       |
| Rebalance Timeout                         | 10000                                                        |
| Rebalance Delay                           | 0                                                            |
| Time Between Rebalance Messages           | 0                                                            |
| Eviction Policy Enabled                   | off                                                          |
| Eviction Policy                           | <n/a>                                                        |
| Eviction Policy Max Size                  | <n/a>                                                        |
| Eviction Filter                           | <n/a>                                                        |
| Near Cache Enabled                        | off                                                          |
| Near Start Size                           | 0                                                            |
| Near Eviction Policy                      | <n/a>                                                        |
| Near Eviction Policy Max Size             | <n/a>                                                        |
| Default Lock Timeout                      | 0                                                            |
| Metadata type count                       | 0                                                            |
| Cache Interceptor                         | <n/a>                                                        |
| Store Enabled                             | off                                                          |
| Store Class                               | <n/a>                                                        |
| Store Factory Class                       |                                                              |
| Store Keep Binary                         | false                                                        |
| Store Read Through                        | off                                                          |
| Store Write Through                       | off                                                          |
| Write-Behind Enabled                      | off                                                          |
| Write-Behind Flush Size                   | 10240                                                        |
| Write-Behind Frequency                    | 5000                                                         |
| Write-Behind Flush Threads Count          | 1                                                            |
| Write-Behind Batch Size                   | 512                                                          |
| Concurrent Asynchronous Operations Number | 500                                                          |
| Loader Factory Class Name                 | <n/a>                                                        |
| Writer Factory Class Name                 | <n/a>                                                        |
| Expiry Policy Factory Class Name          | javax.cache.configuration.FactoryBuilder$SingletonFactory    |
| Query Execution Time Threshold            | 3000                                                         |
| Query Schema Name                         |                                                              |
| Query Escaped Names                       | off                                                          |
| Query SQL functions                       | <n/a>                                                        |
| Query Indexed Types                       | <n/a>                                                        |
+----------------------------------------------------------------------------------------------------------+

visor> 

2 个答案:

答案 0 :(得分:0)

似乎,您在客户端节点上调用IgniteAtomicLong #close方法。在这种情况下,实例将关闭,并且在群集中的其他节点上不可用。

答案 1 :(得分:0)

最有可能被调用IgniteAtomicLong #close方法。它不是必须由您直接调用,可以调用它,因为它实现了Closeable接口,例如:

  1. 您在此IgniteAtomicLong上使用了try-with-resource
  2.   

    尝试(IgniteAtomicLong atomicLong = ignite.atomicLong(name,1,true)){}

    1. 将IgniteAtomicLong添加为bean类的字段,并将其添加到Spring上下文中。在关闭spring context后,这个atomicLong也被关闭了。
    2. 因此,建议不要将IgniteAtomicLong添加到Spring上下文