You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2015/04/03 11:12:58 UTC

[01/37] incubator-ignite git commit: # GG-10002: Debug.

Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-cacheplug-rmtvalid 9dda6bfc2 -> be31dc22a


# GG-10002: Debug.


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/d7dad487
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/d7dad487
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/d7dad487

Branch: refs/heads/ignite-cacheplug-rmtvalid
Commit: d7dad487da127b66554f48e96800509be7830d78
Parents: c2f5211
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Tue Mar 31 13:16:19 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Tue Mar 31 13:16:19 2015 +0300

----------------------------------------------------------------------
 .../internal/processors/query/GridQueryProcessor.java     | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d7dad487/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
index 0ae5325..2e5a7a0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
@@ -397,22 +397,16 @@ public class GridQueryProcessor extends GridProcessorAdapter {
         try {
             final Class<?> valCls = val.getClass();
 
-            TypeId id;
+            int typeId = ctx.cacheObjects().typeId(val);
 
             if (ctx.cacheObjects().isPortableObject(val)) {
-                int typeId = ctx.cacheObjects().typeId(val);
-
                 String typeName = portableName(typeId);
 
                 if (typeName == null)
                     return;
-
-                id = new TypeId(space, typeId);
             }
-            else
-                id = new TypeId(space, valCls);
 
-            TypeDescriptor desc = types.get(id);
+            TypeDescriptor desc = types.get(new TypeId(space, typeId));
 
             if (desc == null || !desc.registered())
                 return;


[10/37] incubator-ignite git commit: # GG-9942 Fixed near cache configuration.

Posted by sb...@apache.org.
# GG-9942 Fixed near cache configuration.


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/e2cbd217
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/e2cbd217
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/e2cbd217

Branch: refs/heads/ignite-cacheplug-rmtvalid
Commit: e2cbd2178a9a4b7a4db171386fda0143b0a025ef
Parents: d47b66a
Author: AKuznetsov <ak...@gridgain.com>
Authored: Thu Apr 2 11:38:54 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Thu Apr 2 11:38:54 2015 +0700

----------------------------------------------------------------------
 .../cache/VisorCacheNearConfiguration.java      | 11 ++-
 .../resources/META-INF/classnames.properties    | 79 ++++++--------------
 2 files changed, 29 insertions(+), 61 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e2cbd217/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheNearConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheNearConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheNearConfiguration.java
index 2a5e781..a968f4f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheNearConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheNearConfiguration.java
@@ -53,9 +53,14 @@ public class VisorCacheNearConfiguration implements Serializable {
         VisorCacheNearConfiguration cfg = new VisorCacheNearConfiguration();
 
         cfg.nearEnabled = GridCacheUtils.isNearEnabled(ccfg);
-//        cfg.nearStartSize = ccfg.getNearStartSize(); TODO IGNTIE-45
-//        cfg.nearEvictPlc = compactClass(ccfg.getNearEvictionPolicy());
-//        cfg.nearEvictMaxSize = evictionPolicyMaxSize(ccfg.getNearEvictionPolicy());
+
+        if (cfg.nearEnabled) {
+            NearCacheConfiguration nccfg = ccfg.getNearConfiguration();
+
+            cfg.nearStartSize = nccfg.getNearStartSize();
+            cfg.nearEvictPlc = compactClass(nccfg.getNearEvictionPolicy());
+            cfg.nearEvictMaxSize = evictionPolicyMaxSize(nccfg.getNearEvictionPolicy());
+        }
 
         return cfg;
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e2cbd217/modules/core/src/main/resources/META-INF/classnames.properties
----------------------------------------------------------------------
diff --git a/modules/core/src/main/resources/META-INF/classnames.properties b/modules/core/src/main/resources/META-INF/classnames.properties
index ccc6aae..55c1f9d 100644
--- a/modules/core/src/main/resources/META-INF/classnames.properties
+++ b/modules/core/src/main/resources/META-INF/classnames.properties
@@ -25,8 +25,9 @@ org.apache.ignite.IgniteState
 org.apache.ignite.cache.CacheAtomicUpdateTimeoutException
 org.apache.ignite.cache.CacheAtomicWriteOrderMode
 org.apache.ignite.cache.CacheAtomicityMode
-org.apache.ignite.internal.processors.cache.CacheDistributionMode
+org.apache.ignite.cache.CacheEntryEventSerializableFilter
 org.apache.ignite.cache.CacheEntryProcessor
+org.apache.ignite.cache.CacheExistsException
 org.apache.ignite.cache.CacheInterceptor
 org.apache.ignite.cache.CacheInterceptorAdapter
 org.apache.ignite.cache.CacheMemoryMode
@@ -34,6 +35,9 @@ org.apache.ignite.cache.CacheMode
 org.apache.ignite.cache.CachePartialUpdateException
 org.apache.ignite.cache.CachePeekMode
 org.apache.ignite.cache.CacheRebalanceMode
+org.apache.ignite.cache.CacheServerNotFoundException
+org.apache.ignite.cache.CacheTypeFieldMetadata
+org.apache.ignite.cache.CacheTypeMetadata
 org.apache.ignite.cache.CacheWriteSynchronizationMode
 org.apache.ignite.cache.affinity.AffinityFunction
 org.apache.ignite.cache.affinity.AffinityKey
@@ -213,10 +217,10 @@ org.apache.ignite.internal.cluster.ClusterGroupAdapter$AttributeFilter
 org.apache.ignite.internal.cluster.ClusterGroupAdapter$CachesFilter
 org.apache.ignite.internal.cluster.ClusterGroupAdapter$DaemonFilter
 org.apache.ignite.internal.cluster.ClusterGroupAdapter$OthersFilter
-org.apache.ignite.internal.cluster.ClusterGroupAdapter$StreamersFilter
 org.apache.ignite.internal.cluster.ClusterGroupEmptyCheckedException
 org.apache.ignite.internal.cluster.ClusterNodeLocalMapImpl
 org.apache.ignite.internal.cluster.ClusterTopologyCheckedException
+org.apache.ignite.internal.cluster.ClusterTopologyServerNotFoundException
 org.apache.ignite.internal.cluster.IgniteClusterAsyncImpl
 org.apache.ignite.internal.cluster.IgniteClusterImpl
 org.apache.ignite.internal.cluster.IgniteClusterImpl$1
@@ -252,9 +256,9 @@ org.apache.ignite.internal.managers.loadbalancer.GridLoadBalancerManager$1
 org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion
 org.apache.ignite.internal.processors.affinity.GridAffinityAssignment
 org.apache.ignite.internal.processors.affinity.GridAffinityMessage
-org.apache.ignite.internal.processors.affinity.GridAffinityProcessor$2
 org.apache.ignite.internal.processors.affinity.GridAffinityUtils$AffinityJob
 org.apache.ignite.internal.processors.cache.CacheAtomicUpdateTimeoutCheckedException
+org.apache.ignite.internal.processors.cache.CacheDistributionMode
 org.apache.ignite.internal.processors.cache.CacheEntryInfoCollection
 org.apache.ignite.internal.processors.cache.CacheEntryPredicate
 org.apache.ignite.internal.processors.cache.CacheEntryPredicateAdapter
@@ -263,8 +267,6 @@ org.apache.ignite.internal.processors.cache.CacheEntryPredicateHasValue
 org.apache.ignite.internal.processors.cache.CacheEntryPredicateNoValue
 org.apache.ignite.internal.processors.cache.CacheEntrySerializablePredicate
 org.apache.ignite.internal.processors.cache.CacheEvictionEntry
-org.apache.ignite.internal.processors.cache.CacheFlag
-org.apache.ignite.internal.processors.cache.CacheFlagException
 org.apache.ignite.internal.processors.cache.CacheInvokeDirectResult
 org.apache.ignite.internal.processors.cache.CacheInvokeEntry$Operation
 org.apache.ignite.internal.processors.cache.CacheInvokeResult
@@ -319,7 +321,6 @@ org.apache.ignite.internal.processors.cache.GridCacheAdapter$UpdatePutAndGetTime
 org.apache.ignite.internal.processors.cache.GridCacheAdapter$UpdatePutTimeStatClosure
 org.apache.ignite.internal.processors.cache.GridCacheAdapter$UpdateRemoveTimeStatClosure
 org.apache.ignite.internal.processors.cache.GridCacheAdapter$UpdateTimeStatClosure
-org.apache.ignite.internal.processors.cache.GridCacheAtomicVersionComparator
 org.apache.ignite.internal.processors.cache.GridCacheAttributes
 org.apache.ignite.internal.processors.cache.GridCacheConcurrentMap$1
 org.apache.ignite.internal.processors.cache.GridCacheConcurrentMap$2
@@ -334,8 +335,7 @@ org.apache.ignite.internal.processors.cache.GridCacheConcurrentMap$Set0
 org.apache.ignite.internal.processors.cache.GridCacheConcurrentMap$ValueIterator
 org.apache.ignite.internal.processors.cache.GridCacheConcurrentMap$Values
 org.apache.ignite.internal.processors.cache.GridCacheContext
-org.apache.ignite.internal.processors.cache.GridCacheContext$2
-org.apache.ignite.internal.processors.cache.GridCacheContext$5
+org.apache.ignite.internal.processors.cache.GridCacheContext$4
 org.apache.ignite.internal.processors.cache.GridCacheDefaultAffinityKeyMapper
 org.apache.ignite.internal.processors.cache.GridCacheDefaultAffinityKeyMapper$1
 org.apache.ignite.internal.processors.cache.GridCacheDefaultAffinityKeyMapper$2
@@ -404,6 +404,7 @@ org.apache.ignite.internal.processors.cache.GridCacheSwapManager$5
 org.apache.ignite.internal.processors.cache.GridCacheSwapManager$6
 org.apache.ignite.internal.processors.cache.GridCacheSwapManager$7
 org.apache.ignite.internal.processors.cache.GridCacheSwapManager$IteratorWrapper
+org.apache.ignite.internal.processors.cache.GridCacheTryPutFailedException
 org.apache.ignite.internal.processors.cache.GridCacheUtilityKey
 org.apache.ignite.internal.processors.cache.GridCacheUtils$10
 org.apache.ignite.internal.processors.cache.GridCacheUtils$11
@@ -435,8 +436,6 @@ org.apache.ignite.internal.processors.cache.GridCacheValueCollection$1
 org.apache.ignite.internal.processors.cache.GridCacheWriteBehindStore$StatefulValue
 org.apache.ignite.internal.processors.cache.GridCacheWriteBehindStore$StoreOperation
 org.apache.ignite.internal.processors.cache.GridCacheWriteBehindStore$ValueStatus
-org.apache.ignite.internal.processors.cache.GridPartitionLockKey
-org.apache.ignite.cache.CacheExistsException
 org.apache.ignite.internal.processors.cache.IgniteCacheProxy
 org.apache.ignite.internal.processors.cache.IgniteCacheProxy$1
 org.apache.ignite.internal.processors.cache.IgniteCacheProxy$2
@@ -483,9 +482,10 @@ org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtGetFuture$1
 org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtGetFuture$2
 org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtGetFuture$3
 org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtInvalidPartitionException
-org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLocalPartition$3
+org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLocalPartition$4
 org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLockFuture$1
 org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLockFuture$2
+org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLockFuture$3
 org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLockRequest
 org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLockResponse
 org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionState
@@ -520,7 +520,8 @@ org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtUnlockRequest
 org.apache.ignite.internal.processors.cache.distributed.dht.GridPartitionedGetFuture$1
 org.apache.ignite.internal.processors.cache.distributed.dht.GridPartitionedGetFuture$2
 org.apache.ignite.internal.processors.cache.distributed.dht.GridPartitionedGetFuture$MiniFuture$1
-org.apache.ignite.internal.processors.cache.distributed.dht.GridPartitionedGetFuture$MiniFuture$1$1
+org.apache.ignite.internal.processors.cache.distributed.dht.GridPartitionedGetFuture$MiniFuture$2
+org.apache.ignite.internal.processors.cache.distributed.dht.GridPartitionedGetFuture$MiniFuture$2$1
 org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache
 org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$10
 org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$11
@@ -656,7 +657,6 @@ org.apache.ignite.internal.processors.cache.query.GridCacheDistributedQueryManag
 org.apache.ignite.internal.processors.cache.query.GridCacheDistributedQueryManager$4
 org.apache.ignite.internal.processors.cache.query.GridCacheDistributedQueryManager$5
 org.apache.ignite.internal.processors.cache.query.GridCacheDistributedQueryManager$6
-org.apache.ignite.internal.processors.cache.query.GridCacheQueriesImpl
 org.apache.ignite.internal.processors.cache.query.GridCacheQueriesProxy
 org.apache.ignite.internal.processors.cache.query.GridCacheQueryAdapter$1
 org.apache.ignite.internal.processors.cache.query.GridCacheQueryFutureAdapter$1
@@ -695,6 +695,7 @@ org.apache.ignite.internal.processors.cache.query.GridCacheSqlQuery
 org.apache.ignite.internal.processors.cache.query.GridCacheTwoStepQuery
 org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryEntry
 org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryEvent
+org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryFilterEx
 org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryHandler
 org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryHandler$2
 org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryHandler$DeployableObject
@@ -766,9 +767,9 @@ org.apache.ignite.internal.processors.cache.version.GridCacheRawVersionedEntry
 org.apache.ignite.internal.processors.cache.version.GridCacheVersion
 org.apache.ignite.internal.processors.cache.version.GridCacheVersionConflictContext$State
 org.apache.ignite.internal.processors.cache.version.GridCacheVersionEx
-org.apache.ignite.internal.processors.cacheobject.IgniteCacheObjectProcessorImpl$1
-org.apache.ignite.internal.processors.cacheobject.IgniteCacheObjectProcessorImpl$2
-org.apache.ignite.internal.processors.cacheobject.IgniteCacheObjectProcessorImpl$IgniteCacheObjectImpl
+org.apache.ignite.internal.processors.cacheobject.IgniteCacheObjectProcessorImpl$UserCacheObjectByteArrayImpl
+org.apache.ignite.internal.processors.cacheobject.IgniteCacheObjectProcessorImpl$UserCacheObjectImpl
+org.apache.ignite.internal.processors.cacheobject.IgniteCacheObjectProcessorImpl$UserKeyCacheObjectImpl
 org.apache.ignite.internal.processors.clock.GridClockDeltaSnapshotMessage
 org.apache.ignite.internal.processors.clock.GridClockDeltaVersion
 org.apache.ignite.internal.processors.closure.GridClosurePolicy
@@ -1008,21 +1009,6 @@ org.apache.ignite.internal.processors.service.GridServiceProxy
 org.apache.ignite.internal.processors.service.GridServiceProxy$ServiceProxyCallable
 org.apache.ignite.internal.processors.service.ServiceContextImpl
 org.apache.ignite.internal.processors.service.ServiceDescriptorImpl
-org.apache.ignite.internal.processors.streamer.GridStreamerAttributes
-org.apache.ignite.internal.processors.streamer.GridStreamerCancelRequest
-org.apache.ignite.internal.processors.streamer.GridStreamerExecutionBatch
-org.apache.ignite.internal.processors.streamer.GridStreamerExecutionRequest
-org.apache.ignite.internal.processors.streamer.GridStreamerResponse
-org.apache.ignite.internal.processors.streamer.GridStreamerRouteFailedException
-org.apache.ignite.internal.processors.streamer.IgniteStreamerImpl
-org.apache.ignite.internal.processors.streamer.IgniteStreamerImpl$3
-org.apache.ignite.internal.processors.streamer.IgniteStreamerImpl$StreamerPda
-org.apache.ignite.internal.processors.streamer.task.GridStreamerBroadcastTask
-org.apache.ignite.internal.processors.streamer.task.GridStreamerBroadcastTask$StreamerBroadcastJob
-org.apache.ignite.internal.processors.streamer.task.GridStreamerQueryTask
-org.apache.ignite.internal.processors.streamer.task.GridStreamerQueryTask$QueryJob
-org.apache.ignite.internal.processors.streamer.task.GridStreamerReduceTask
-org.apache.ignite.internal.processors.streamer.task.GridStreamerReduceTask$ReduceJob
 org.apache.ignite.internal.processors.task.GridTaskProcessor$1
 org.apache.ignite.internal.processors.task.GridTaskThreadContextKey
 org.apache.ignite.internal.processors.task.GridTaskWorker$3
@@ -1420,7 +1406,6 @@ org.apache.ignite.internal.visor.event.VisorGridDiscoveryEvent
 org.apache.ignite.internal.visor.event.VisorGridEvent
 org.apache.ignite.internal.visor.event.VisorGridEventsLost
 org.apache.ignite.internal.visor.event.VisorGridJobEvent
-org.apache.ignite.internal.visor.event.VisorGridSecuritySessionEvent
 org.apache.ignite.internal.visor.event.VisorGridTaskEvent
 org.apache.ignite.internal.visor.file.VisorFileBlock
 org.apache.ignite.internal.visor.file.VisorFileBlockTask
@@ -1501,14 +1486,6 @@ org.apache.ignite.internal.visor.query.VisorQueryTask
 org.apache.ignite.internal.visor.query.VisorQueryTask$VisorFutureResultSetHolder
 org.apache.ignite.internal.visor.query.VisorQueryTask$VisorQueryArg
 org.apache.ignite.internal.visor.query.VisorQueryTask$VisorQueryJob
-org.apache.ignite.internal.visor.streamer.VisorStreamer
-org.apache.ignite.internal.visor.streamer.VisorStreamerConfiguration
-org.apache.ignite.internal.visor.streamer.VisorStreamerMetrics
-org.apache.ignite.internal.visor.streamer.VisorStreamerMetricsResetTask
-org.apache.ignite.internal.visor.streamer.VisorStreamerMetricsResetTask$VisorStreamerMetricsResetJob
-org.apache.ignite.internal.visor.streamer.VisorStreamerResetTask
-org.apache.ignite.internal.visor.streamer.VisorStreamerResetTask$VisorStreamerResetJob
-org.apache.ignite.internal.visor.streamer.VisorStreamerStageMetrics
 org.apache.ignite.internal.visor.util.VisorEventMapper
 org.apache.ignite.internal.visor.util.VisorTaskUtils$4
 org.apache.ignite.lang.IgniteBiClosure
@@ -1530,6 +1507,7 @@ org.apache.ignite.lifecycle.LifecycleEventType
 org.apache.ignite.marshaller.jdk.JdkMarshallerDummySerializable
 org.apache.ignite.marshaller.optimized.OptimizedFieldType
 org.apache.ignite.messaging.MessagingListenActor
+org.apache.ignite.plugin.CachePluginConfiguration
 org.apache.ignite.plugin.PluginNotFoundException
 org.apache.ignite.plugin.PluginValidationException
 org.apache.ignite.plugin.extensions.communication.Message
@@ -1600,15 +1578,9 @@ org.apache.ignite.startup.cmdline.AboutDialog
 org.apache.ignite.startup.cmdline.AboutDialog$1
 org.apache.ignite.stream.StreamReceiver
 org.apache.ignite.stream.StreamTransformer
-org.apache.ignite.streamer.index.StreamerIndexPolicy
-org.apache.ignite.streamer.index.StreamerIndexProviderAdapter$1
-org.apache.ignite.streamer.index.StreamerIndexProviderAdapter$2
-org.apache.ignite.streamer.window.StreamerBoundedSizeBatchWindow$Batch
-org.apache.ignite.streamer.window.StreamerBoundedSizeBatchWindow$QueueHolder
-org.apache.ignite.streamer.window.StreamerBoundedSizeWindowAdapter$WindowHolder
-org.apache.ignite.streamer.window.StreamerBoundedTimeBatchWindow$Batch
-org.apache.ignite.streamer.window.StreamerBoundedTimeBatchWindow$WindowHolder
-org.apache.ignite.streamer.window.StreamerBoundedTimeWindow$WindowHolder
+org.apache.ignite.stream.StreamTransformer$1
+org.apache.ignite.stream.StreamVisitor
+org.apache.ignite.stream.StreamVisitor$1
 org.apache.ignite.transactions.TransactionConcurrency
 org.apache.ignite.transactions.TransactionHeuristicException
 org.apache.ignite.transactions.TransactionIsolation
@@ -1617,12 +1589,3 @@ org.apache.ignite.transactions.TransactionOptimisticException
 org.apache.ignite.transactions.TransactionRollbackException
 org.apache.ignite.transactions.TransactionState
 org.apache.ignite.transactions.TransactionTimeoutException
-org.jdk8.backport.ConcurrentHashMap8
-org.jdk8.backport.ConcurrentHashMap8$KeySetView
-org.jdk8.backport.ConcurrentHashMap8$Segment
-org.jdk8.backport.ConcurrentLinkedHashMap$QueuePolicy
-org.jdk8.backport.ConcurrentLinkedHashMap$Segment
-org.jdk8.backport.ConcurrentLinkedHashMap$WriteThroughEntry
-org.jdk8.backport.LongAdder8
-org.jdk8.backport.Striped64_8
-org.jdk8.backport.ThreadLocalRandom8


[27/37] incubator-ignite git commit: # GG-9973: Fixed.

Posted by sb...@apache.org.
# GG-9973: Fixed.


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/c6629012
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/c6629012
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/c6629012

Branch: refs/heads/ignite-cacheplug-rmtvalid
Commit: c66290121e8eaae4999ecf3104c556dfc778edc3
Parents: 07ca9fa
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Thu Apr 2 17:29:12 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Apr 2 17:29:12 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/CacheMetricsImpl.java      |    1 +
 .../cache/CacheStorePartialUpdateException.java |    2 +-
 .../processors/cache/GridCacheAdapter.java      |   16 +-
 .../processors/cache/GridCacheContext.java      |    9 +-
 .../processors/cache/GridCacheMapEntry.java     |   28 +-
 .../processors/cache/GridCacheProcessor.java    |   13 +-
 .../processors/cache/GridCacheStoreManager.java | 1202 ------------------
 .../cache/GridCacheWriteBehindStore.java        | 1015 ---------------
 .../distributed/dht/GridDhtCacheAdapter.java    |    6 +-
 .../distributed/dht/GridDhtCacheEntry.java      |    4 +-
 .../distributed/dht/GridDhtLocalPartition.java  |    4 +-
 .../distributed/dht/GridDhtLockFuture.java      |    2 +-
 .../dht/atomic/GridDhtAtomicCache.java          |    8 +-
 .../local/atomic/GridLocalAtomicCache.java      |    4 +-
 .../cache/store/CacheOsStoreManager.java        |   59 +
 .../cache/store/CacheStoreManager.java          |  182 +++
 .../store/GridCacheStoreManagerAdapter.java     | 1111 ++++++++++++++++
 .../cache/store/GridCacheWriteBehindStore.java  | 1015 +++++++++++++++
 .../cache/transactions/IgniteTxAdapter.java     |    5 +-
 .../transactions/IgniteTxLocalAdapter.java      |   39 +-
 .../cacheobject/IgniteCacheObjectProcessor.java |    6 -
 .../IgniteCacheObjectProcessorImpl.java         |    5 -
 .../processors/plugin/CachePluginManager.java   |    8 +-
 .../resources/META-INF/classnames.properties    |   14 +-
 .../cache/GridCachePartitionedWritesTest.java   |    3 +-
 ...idCacheWriteBehindStoreAbstractSelfTest.java |  189 ---
 .../GridCacheWriteBehindStoreAbstractTest.java  |  349 -----
 .../GridCacheWriteBehindStoreLocalTest.java     |   30 -
 ...heWriteBehindStoreMultithreadedSelfTest.java |  163 ---
 ...BehindStorePartitionedMultiNodeSelfTest.java |  215 ----
 ...ridCacheWriteBehindStorePartitionedTest.java |   30 -
 ...GridCacheWriteBehindStoreReplicatedTest.java |   30 -
 .../GridCacheWriteBehindStoreSelfTest.java      |  267 ----
 ...idCacheWriteBehindStoreAbstractSelfTest.java |  191 +++
 .../GridCacheWriteBehindStoreAbstractTest.java  |  350 +++++
 .../GridCacheWriteBehindStoreLocalTest.java     |   30 +
 ...heWriteBehindStoreMultithreadedSelfTest.java |  163 +++
 ...BehindStorePartitionedMultiNodeSelfTest.java |  216 ++++
 ...ridCacheWriteBehindStorePartitionedTest.java |   30 +
 ...GridCacheWriteBehindStoreReplicatedTest.java |   30 +
 .../GridCacheWriteBehindStoreSelfTest.java      |  268 ++++
 .../loadtests/hashmap/GridCacheTestContext.java |    8 +-
 .../IgniteCacheWriteBehindTestSuite.java        |    3 +-
 43 files changed, 3741 insertions(+), 3582 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c6629012/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheMetricsImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheMetricsImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheMetricsImpl.java
index 446070e..deebab4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheMetricsImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheMetricsImpl.java
@@ -19,6 +19,7 @@ package org.apache.ignite.internal.processors.cache;
 
 import org.apache.ignite.*;
 import org.apache.ignite.cache.*;
+import org.apache.ignite.internal.processors.cache.store.*;
 import org.apache.ignite.internal.util.tostring.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c6629012/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheStorePartialUpdateException.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheStorePartialUpdateException.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheStorePartialUpdateException.java
index 6a364da..f7fca59 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheStorePartialUpdateException.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheStorePartialUpdateException.java
@@ -36,7 +36,7 @@ public class CacheStorePartialUpdateException extends IgniteCheckedException {
      * @param cause Cause.
      */
     @SuppressWarnings("unchecked")
-    CacheStorePartialUpdateException(Collection failedKeys, Exception cause) {
+    public CacheStorePartialUpdateException(Collection failedKeys, Exception cause) {
         super(cause);
 
         this.failedKeys = failedKeys;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c6629012/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
index eb1a98f..ca84c1a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
@@ -993,7 +993,7 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>,
      * @throws IgniteCheckedException In case of any errors.
      */
     @Nullable private Object peekDb(KeyCacheObject key) throws IgniteCheckedException {
-        return ctx.store().loadFromStore(ctx.tm().localTxx(), key);
+        return ctx.store().load(ctx.tm().localTxx(), key);
     }
 
     /**
@@ -1581,7 +1581,7 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>,
         return ctx.closures().callLocalSafe(new GPC<Object>() {
             @Nullable @Override public Object call() {
                 try {
-                    ctx.store().loadAllFromStore(tx, keys, vis);
+                    ctx.store().loadAll(tx, keys, vis);
                 }
                 catch (IgniteCheckedException e) {
                     throw new GridClosureException(e);
@@ -2096,7 +2096,7 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>,
                     return new GridEmbeddedFuture(
                         ctx.closures().callLocalSafe(ctx.projectSafe(new GPC<Map<K1, V1>>() {
                             @Override public Map<K1, V1> call() throws Exception {
-                                ctx.store().loadAllFromStore(null/*tx*/, loadKeys.keySet(), new CI2<KeyCacheObject, Object>() {
+                                ctx.store().loadAll(null/*tx*/, loadKeys.keySet(), new CI2<KeyCacheObject, Object>() {
                                     /** New version for all new entries. */
                                     private GridCacheVersion nextVer;
 
@@ -3676,7 +3676,7 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>,
 
         final ExpiryPolicy plc = plc0 != null ? plc0 : ctx.expiry();
 
-        if (ctx.store().isLocalStore()) {
+        if (ctx.store().isLocal()) {
             DataStreamerImpl ldr = ctx.kernalContext().dataStream().dataStreamer(ctx.namex());
 
             try {
@@ -3789,7 +3789,7 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>,
         ExpiryPolicy plc = prj != null ? prj.expiry() : null;
 
         if (replaceExisting) {
-            if (ctx.store().isLocalStore()) {
+            if (ctx.store().isLocal()) {
                 Collection<ClusterNode> nodes = ctx.grid().cluster().forDataNodes(name()).nodes();
 
                 if (nodes.isEmpty())
@@ -3837,7 +3837,7 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>,
 
             Collection<KeyCacheObject> keys0 = ctx.cacheKeysView(keys);
 
-            ctx.store().loadAllFromStore(null, keys0, new CIX2<KeyCacheObject, Object>() {
+            ctx.store().loadAll(null, keys0, new CIX2<KeyCacheObject, Object>() {
                 @Override public void applyx(KeyCacheObject key, Object val) {
                     col.add(new DataStreamerEntry(key, ctx.toCacheObject(val)));
 
@@ -3870,7 +3870,7 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>,
 
         Collection<KeyCacheObject> keys0 = ctx.cacheKeysView(keys);
 
-        if (ctx.store().isLocalStore()) {
+        if (ctx.store().isLocal()) {
             DataStreamerImpl ldr = ctx.kernalContext().dataStream().dataStreamer(ctx.namex());
 
             try {
@@ -3890,7 +3890,7 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>,
             // Version for all loaded entries.
             final GridCacheVersion ver0 = ctx.versions().nextForLoad();
 
-            ctx.store().loadAllFromStore(null, keys0, new CI2<KeyCacheObject, Object>() {
+            ctx.store().loadAll(null, keys0, new CI2<KeyCacheObject, Object>() {
                 @Override public void apply(KeyCacheObject key, Object val) {
                     long ttl = CU.ttlForLoad(plc0);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c6629012/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
index e7f3ad4..dfa82e6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
@@ -38,6 +38,7 @@ import org.apache.ignite.internal.processors.cache.jta.*;
 import org.apache.ignite.internal.processors.cache.local.*;
 import org.apache.ignite.internal.processors.cache.query.*;
 import org.apache.ignite.internal.processors.cache.query.continuous.*;
+import org.apache.ignite.internal.processors.cache.store.*;
 import org.apache.ignite.internal.processors.cache.transactions.*;
 import org.apache.ignite.internal.processors.cache.version.*;
 import org.apache.ignite.internal.processors.cacheobject.*;
@@ -127,7 +128,7 @@ public class GridCacheContext<K, V> implements Externalizable {
     private GridCacheTtlManager ttlMgr;
 
     /** Store manager. */
-    private GridCacheStoreManager storeMgr;
+    private CacheStoreManager storeMgr;
 
     /** Replication manager. */
     private GridCacheDrManager drMgr;
@@ -233,7 +234,7 @@ public class GridCacheContext<K, V> implements Externalizable {
 
         GridCacheEventManager evtMgr,
         GridCacheSwapManager swapMgr,
-        GridCacheStoreManager storeMgr,
+        CacheStoreManager storeMgr,
         GridCacheEvictionManager evictMgr,
         GridCacheQueryManager<K, V> qryMgr,
         CacheContinuousQueryManager contQryMgr,
@@ -882,7 +883,7 @@ public class GridCacheContext<K, V> implements Externalizable {
      *      are set to {@code true} or the store is local.
      */
     public boolean writeToStoreFromDht() {
-        return store().isLocalStore() || cacheCfg.isWriteBehindEnabled();
+        return store().isLocal() || cacheCfg.isWriteBehindEnabled();
     }
 
     /**
@@ -951,7 +952,7 @@ public class GridCacheContext<K, V> implements Externalizable {
     /**
      * @return Store manager.
      */
-    public GridCacheStoreManager store() {
+    public CacheStoreManager store() {
         return storeMgr;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c6629012/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
index d7fbde9..542d0ad 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
@@ -590,7 +590,7 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
     @SuppressWarnings({"RedundantTypeArguments"})
     @Nullable protected Object readThrough(@Nullable IgniteInternalTx tx, KeyCacheObject key, boolean reload, UUID subjId,
         String taskName) throws IgniteCheckedException {
-        return cctx.store().loadFromStore(tx, key);
+        return cctx.store().load(tx, key);
     }
 
     /** {@inheritDoc} */
@@ -1077,7 +1077,7 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
         // Persist outside of synchronization. The correctness of the
         // value will be handled by current transaction.
         if (writeThrough)
-            cctx.store().putToStore(tx, keyValue(false), CU.value(val, cctx, false), newVer);
+            cctx.store().put(tx, keyValue(false), CU.value(val, cctx, false), newVer);
 
         if (intercept)
             cctx.config().getInterceptor().onAfterPut(new CacheLazyEntry(cctx, key, key0, val, val0));
@@ -1235,7 +1235,7 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
         // Persist outside of synchronization. The correctness of the
         // value will be handled by current transaction.
         if (writeThrough)
-            cctx.store().removeFromStore(tx, keyValue(false));
+            cctx.store().remove(tx, keyValue(false));
 
         if (!cctx.deferredDelete()) {
             boolean marked = false;
@@ -1489,7 +1489,7 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
 
                 if (writeThrough)
                     // Must persist inside synchronization in non-tx mode.
-                    cctx.store().putToStore(null, keyValue(false), CU.value(updated, cctx, false), ver);
+                    cctx.store().put(null, keyValue(false), CU.value(updated, cctx, false), ver);
 
                 // Update index inside synchronization since it can be updated
                 // in load methods without actually holding entry lock.
@@ -1523,7 +1523,7 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
             else {
                 if (writeThrough)
                     // Must persist inside synchronization in non-tx mode.
-                    cctx.store().removeFromStore(null, keyValue(false));
+                    cctx.store().remove(null, keyValue(false));
 
                 boolean hasValPtr = valPtr != 0;
 
@@ -1724,10 +1724,10 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
                             if (val == null) {
                                 assert deletedUnlocked();
 
-                                cctx.store().removeFromStore(null, keyValue(false));
+                                cctx.store().remove(null, keyValue(false));
                             }
                             else
-                                cctx.store().putToStore(null, keyValue(false), CU.value(val, cctx, false), ver);
+                                cctx.store().put(null, keyValue(false), CU.value(val, cctx, false), ver);
                         }
 
                         return new GridCacheUpdateAtomicResult(false,
@@ -1776,10 +1776,10 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
                             if (val == null) {
                                 assert deletedUnlocked();
 
-                                cctx.store().removeFromStore(null, keyValue(false));
+                                cctx.store().remove(null, keyValue(false));
                             }
                             else
-                                cctx.store().putToStore(null, keyValue(false), CU.value(val, cctx, false), ver);
+                                cctx.store().put(null, keyValue(false), CU.value(val, cctx, false), ver);
                         }
                         else {
                             if (log.isDebugEnabled())
@@ -2029,7 +2029,7 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
                 // Try write-through.
                 if (writeThrough)
                     // Must persist inside synchronization in non-tx mode.
-                    cctx.store().putToStore(null, keyValue(false), CU.value(updated, cctx, false), newVer);
+                    cctx.store().put(null, keyValue(false), CU.value(updated, cctx, false), newVer);
 
                 if (!hadVal) {
                     boolean new0 = isNew();
@@ -2099,7 +2099,7 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
 
                 if (writeThrough)
                     // Must persist inside synchronization in non-tx mode.
-                    cctx.store().removeFromStore(null, keyValue(false));
+                    cctx.store().remove(null, keyValue(false));
 
                 // Update index inside synchronization since it can be updated
                 // in load methods without actually holding entry lock.
@@ -3085,7 +3085,7 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
                 return null;
         }
 
-        return cctx.toCacheObject(cctx.store().loadFromStore(cctx.tm().localTxx(), key));
+        return cctx.toCacheObject(cctx.store().load(cctx.tm().localTxx(), key));
     }
 
     /**
@@ -3225,9 +3225,9 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
                     cctx.dataStructures().onEntryUpdated(key, false);
                 }
 
-                if (cctx.store().isLocalStore()) {
+                if (cctx.store().isLocal()) {
                     if (val != null)
-                        cctx.store().putToStore(null, keyValue(false), CU.value(val, cctx, false), ver);
+                        cctx.store().put(null, keyValue(false), CU.value(val, cctx, false), ver);
                 }
 
                 return true;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c6629012/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index 00852fc..64602c6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
@@ -40,6 +40,7 @@ import org.apache.ignite.internal.processors.cache.local.*;
 import org.apache.ignite.internal.processors.cache.local.atomic.*;
 import org.apache.ignite.internal.processors.cache.query.*;
 import org.apache.ignite.internal.processors.cache.query.continuous.*;
+import org.apache.ignite.internal.processors.cache.store.*;
 import org.apache.ignite.internal.processors.cache.transactions.*;
 import org.apache.ignite.internal.processors.cache.version.*;
 import org.apache.ignite.internal.processors.plugin.*;
@@ -1020,10 +1021,14 @@ public class GridCacheProcessor extends GridProcessorAdapter {
         
         pluginMgr.validate();
 
-        CacheConflictResolutionManager rslvrMgr = pluginMgr.createComponent(CacheConflictResolutionManager.class);
-        GridCacheDrManager drMgr = pluginMgr.createComponent(GridCacheDrManager.class);
+        CacheConflictResolutionManager rslvrMgr = pluginMgr.createComponent(ctx, cfg,
+            CacheConflictResolutionManager.class);
 
-        GridCacheStoreManager storeMgr = new GridCacheStoreManager(ctx, sesHolders, cfgStore, cfg);
+        GridCacheDrManager drMgr = pluginMgr.createComponent(ctx, cfg,GridCacheDrManager.class);
+
+        CacheStoreManager storeMgr = pluginMgr.createComponent(ctx, cfg, CacheStoreManager.class);
+
+        storeMgr.initialize(cfgStore, sesHolders);
 
         GridCacheContext<?, ?> cacheCtx = new GridCacheContext(
             ctx,
@@ -1150,8 +1155,8 @@ public class GridCacheProcessor extends GridProcessorAdapter {
             swapMgr = new GridCacheSwapManager(true);
             evictMgr = new GridCacheEvictionManager();
             evtMgr = new GridCacheEventManager();
-            drMgr = pluginMgr.createComponent(GridCacheDrManager.class);
             pluginMgr = new CachePluginManager(ctx, cfg);
+            drMgr = pluginMgr.createComponent(ctx, cfg, GridCacheDrManager.class);
 
             cacheCtx = new GridCacheContext(
                 ctx,

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c6629012/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManager.java
deleted file mode 100644
index d30aa06..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManager.java
+++ /dev/null
@@ -1,1202 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache;
-
-import org.apache.ignite.*;
-import org.apache.ignite.cache.store.*;
-import org.apache.ignite.configuration.*;
-import org.apache.ignite.internal.*;
-import org.apache.ignite.internal.processors.cache.store.*;
-import org.apache.ignite.internal.processors.cache.transactions.*;
-import org.apache.ignite.internal.processors.cache.version.*;
-import org.apache.ignite.internal.util.*;
-import org.apache.ignite.internal.util.lang.*;
-import org.apache.ignite.internal.util.tostring.*;
-import org.apache.ignite.internal.util.typedef.*;
-import org.apache.ignite.internal.util.typedef.internal.*;
-import org.apache.ignite.lang.*;
-import org.apache.ignite.lifecycle.*;
-import org.apache.ignite.transactions.*;
-import org.jetbrains.annotations.*;
-
-import javax.cache.*;
-import javax.cache.integration.*;
-import java.util.*;
-
-/**
- * Store manager.
- */
-@SuppressWarnings("AssignmentToCatchBlockParameter")
-public class GridCacheStoreManager extends GridCacheManagerAdapter {
-    /** */
-    private static final UUID SES_ATTR = UUID.randomUUID();
-
-    /** */
-    private final CacheStore<Object, Object> store;
-
-    /** */
-    private final CacheStore<?, ?> cfgStore;
-
-    /** */
-    private final CacheStoreBalancingWrapper<Object, Object> singleThreadGate;
-
-    /** */
-    private final ThreadLocal<SessionData> sesHolder;
-
-    /** */
-    private final boolean locStore;
-
-    /** */
-    private final boolean writeThrough;
-
-    /** */
-    private boolean convertPortable;
-
-    /**
-     * @param ctx Kernal context.
-     * @param sesHolders Session holders map to use the same session holder for different managers if they use
-     *        the same store instance.
-     * @param cfgStore Store provided in configuration.
-     * @param cfg Cache configuration.
-     * @throws IgniteCheckedException In case of error.
-     */
-    @SuppressWarnings("unchecked")
-    public GridCacheStoreManager(
-        GridKernalContext ctx,
-        Map<CacheStore, ThreadLocal> sesHolders,
-        @Nullable CacheStore<Object, Object> cfgStore,
-        CacheConfiguration cfg
-    ) throws IgniteCheckedException {
-        this.cfgStore = cfgStore;
-
-        store = cacheStoreWrapper(ctx, cfgStore, cfg);
-
-        singleThreadGate = store == null ? null : new CacheStoreBalancingWrapper<>(store);
-
-        writeThrough = cfg.isWriteThrough();
-
-        ThreadLocal<SessionData> sesHolder0 = null;
-
-        if (cfgStore != null) {
-            sesHolder0 = sesHolders.get(cfgStore);
-
-            if (sesHolder0 == null) {
-                ThreadLocalSession locSes = new ThreadLocalSession();
-
-                if (ctx.resource().injectStoreSession(cfgStore, locSes)) {
-                    sesHolder0 = locSes.sesHolder;
-
-                    sesHolders.put(cfgStore, sesHolder0);
-                }
-            }
-        }
-
-        sesHolder = sesHolder0;
-
-        locStore = U.hasAnnotation(cfgStore, CacheLocalStore.class);
-    }
-
-    /**
-     * @return {@code True} is write-through is enabled.
-     */
-    public boolean writeThrough() {
-        return writeThrough;
-    }
-
-    /**
-     * @return Unwrapped store provided in configuration.
-     */
-    public CacheStore<?, ?> configuredStore() {
-        return cfgStore;
-    }
-
-    /**
-     * Creates a wrapped cache store if write-behind cache is configured.
-     *
-     * @param ctx Kernal context.
-     * @param cfgStore Store provided in configuration.
-     * @param cfg Cache configuration.
-     * @return Instance if {@link GridCacheWriteBehindStore} if write-behind store is configured,
-     *         or user-defined cache store.
-     */
-    @SuppressWarnings({"unchecked"})
-    private CacheStore cacheStoreWrapper(GridKernalContext ctx,
-        @Nullable CacheStore cfgStore,
-        CacheConfiguration cfg) {
-        if (cfgStore == null || !cfg.isWriteBehindEnabled())
-            return cfgStore;
-
-        GridCacheWriteBehindStore store = new GridCacheWriteBehindStore(this,
-            ctx.gridName(),
-            cfg.getName(),
-            ctx.log(GridCacheWriteBehindStore.class),
-            cfgStore);
-
-        store.setFlushSize(cfg.getWriteBehindFlushSize());
-        store.setFlushThreadCount(cfg.getWriteBehindFlushThreadCount());
-        store.setFlushFrequency(cfg.getWriteBehindFlushFrequency());
-        store.setBatchSize(cfg.getWriteBehindBatchSize());
-
-        return store;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void start0() throws IgniteCheckedException {
-        if (store instanceof LifecycleAware) {
-            try {
-                // Avoid second start() call on store in case when near cache is enabled.
-                if (cctx.config().isWriteBehindEnabled()) {
-                    if (!cctx.isNear())
-                        ((LifecycleAware)store).start();
-                }
-            }
-            catch (Exception e) {
-                throw new IgniteCheckedException("Failed to start cache store: " + e, e);
-            }
-        }
-
-        convertPortable = !cctx.cacheObjects().keepPortableInStore(cctx.name());
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void stop0(boolean cancel) {
-        if (store instanceof LifecycleAware) {
-            try {
-                // Avoid second start() call on store in case when near cache is enabled.
-                if (cctx.config().isWriteBehindEnabled()) {
-                    if (!cctx.isNear())
-                        ((LifecycleAware)store).stop();
-                }
-            }
-            catch (Exception e) {
-                U.error(log(), "Failed to stop cache store.", e);
-            }
-        }
-    }
-
-    /**
-     * @return Convert-portable flag.
-     */
-    public boolean convertPortable() {
-        return convertPortable;
-    }
-
-    /**
-     * @param convertPortable Convert-portable flag.
-     */
-    public void convertPortable(boolean convertPortable) {
-        this.convertPortable = convertPortable;
-    }
-
-    /**
-     * @return {@code true} If local store is configured.
-     */
-    public boolean isLocalStore() {
-        return locStore;
-    }
-
-    /**
-     * @return {@code true} If store configured.
-     */
-    public boolean configured() {
-        return store != null;
-    }
-
-    /**
-     * Loads data from persistent store.
-     *
-     * @param tx Cache transaction.
-     * @param key Cache key.
-     * @return Loaded value, possibly <tt>null</tt>.
-     * @throws IgniteCheckedException If data loading failed.
-     */
-    @SuppressWarnings("unchecked")
-    @Nullable public Object loadFromStore(@Nullable IgniteInternalTx tx, KeyCacheObject key)
-        throws IgniteCheckedException {
-        return loadFromStore(tx, key, true);
-    }
-
-    /**
-     * Loads data from persistent store.
-     *
-     * @param tx Cache transaction.
-     * @param key Cache key.
-     * @param convert Convert flag.
-     * @return Loaded value, possibly <tt>null</tt>.
-     * @throws IgniteCheckedException If data loading failed.
-     */
-    @SuppressWarnings("unchecked")
-    @Nullable private Object loadFromStore(@Nullable IgniteInternalTx tx,
-        KeyCacheObject key,
-        boolean convert)
-        throws IgniteCheckedException {
-        if (store != null) {
-            if (key.internal())
-                // Never load internal keys from store as they are never persisted.
-                return null;
-
-            Object storeKey = key.value(cctx.cacheObjectContext(), false);
-
-            if (convertPortable)
-                storeKey = cctx.unwrapPortableIfNeeded(storeKey, false);
-
-            if (log.isDebugEnabled())
-                log.debug("Loading value from store for key: " + storeKey);
-
-            initSession(tx);
-
-            boolean thewEx = true;
-
-            Object val = null;
-
-            try {
-                val = singleThreadGate.load(storeKey);
-
-                thewEx = false;
-            }
-            catch (ClassCastException e) {
-                handleClassCastException(e);
-            }
-            catch (CacheLoaderException e) {
-                throw new IgniteCheckedException(e);
-            }
-            catch (Exception e) {
-                throw new IgniteCheckedException(new CacheLoaderException(e));
-            }
-            finally {
-                endSession(tx, thewEx);
-            }
-
-            if (log.isDebugEnabled())
-                log.debug("Loaded value from store [key=" + key + ", val=" + val + ']');
-
-            if (convert) {
-                val = convert(val);
-
-                return val;
-            }
-            else
-                return val;
-        }
-
-        return null;
-    }
-
-    /**
-     * @param val Internal value.
-     * @return User value.
-     */
-    @SuppressWarnings("unchecked")
-    private Object convert(Object val) {
-        if (val == null)
-            return null;
-
-        return locStore ? ((IgniteBiTuple<Object, GridCacheVersion>)val).get1() : val;
-    }
-
-    /**
-     * @return Whether DHT transaction can write to store from DHT.
-     */
-    public boolean writeToStoreFromDht() {
-        return cctx.config().isWriteBehindEnabled() || locStore;
-    }
-
-    /**
-     * @param tx Cache transaction.
-     * @param keys Cache keys.
-     * @param vis Closure to apply for loaded elements.
-     * @throws IgniteCheckedException If data loading failed.
-     */
-    public void localStoreLoadAll(@Nullable IgniteInternalTx tx,
-        Collection<? extends KeyCacheObject> keys,
-        final GridInClosure3<KeyCacheObject, Object, GridCacheVersion> vis)
-        throws IgniteCheckedException {
-        assert store != null;
-        assert locStore;
-
-        loadAllFromStore(tx, keys, null, vis);
-    }
-
-    /**
-     * Loads data from persistent store.
-     *
-     * @param tx Cache transaction.
-     * @param keys Cache keys.
-     * @param vis Closure.
-     * @return {@code True} if there is a persistent storage.
-     * @throws IgniteCheckedException If data loading failed.
-     */
-    @SuppressWarnings({"unchecked"})
-    public boolean loadAllFromStore(@Nullable IgniteInternalTx tx,
-        Collection<? extends KeyCacheObject> keys,
-        final IgniteBiInClosure<KeyCacheObject, Object> vis) throws IgniteCheckedException {
-        if (store != null) {
-            loadAllFromStore(tx, keys, vis, null);
-
-            return true;
-        }
-        else {
-            for (KeyCacheObject key : keys)
-                vis.apply(key, null);
-        }
-
-        return false;
-    }
-
-    /**
-     * @param tx Cache transaction.
-     * @param keys Keys to load.
-     * @param vis Key/value closure (only one of vis or verVis can be specified).
-     * @param verVis Key/value/version closure (only one of vis or verVis can be specified).
-     * @throws IgniteCheckedException If failed.
-     */
-    @SuppressWarnings("unchecked")
-    private void loadAllFromStore(@Nullable IgniteInternalTx tx,
-        Collection<? extends KeyCacheObject> keys,
-        @Nullable final IgniteBiInClosure<KeyCacheObject, Object> vis,
-        @Nullable final GridInClosure3<KeyCacheObject, Object, GridCacheVersion> verVis)
-        throws IgniteCheckedException {
-        assert vis != null ^ verVis != null;
-        assert verVis == null || locStore;
-
-        final boolean convert = verVis == null;
-
-        if (!keys.isEmpty()) {
-            if (keys.size() == 1) {
-                KeyCacheObject key = F.first(keys);
-
-                if (convert)
-                    vis.apply(key, loadFromStore(tx, key));
-                else {
-                    IgniteBiTuple<Object, GridCacheVersion> t =
-                        (IgniteBiTuple<Object, GridCacheVersion>)loadFromStore(tx, key, false);
-
-                    if (t != null)
-                        verVis.apply(key, t.get1(), t.get2());
-                }
-
-                return;
-            }
-
-            Collection<Object> keys0;
-
-            if (convertPortable) {
-                keys0 = F.viewReadOnly(keys, new C1<KeyCacheObject, Object>() {
-                    @Override public Object apply(KeyCacheObject key) {
-                        return cctx.unwrapPortableIfNeeded(key.value(cctx.cacheObjectContext(), false), false);
-                    }
-                });
-            }
-            else {
-                keys0 = F.viewReadOnly(keys, new C1<KeyCacheObject, Object>() {
-                    @Override public Object apply(KeyCacheObject key) {
-                        return key.value(cctx.cacheObjectContext(), false);
-                    }
-                });
-            }
-
-            if (log.isDebugEnabled())
-                log.debug("Loading values from store for keys: " + keys0);
-
-            initSession(tx);
-
-            boolean thewEx = true;
-
-            try {
-                IgniteBiInClosure<Object, Object> c = new CI2<Object, Object>() {
-                    @SuppressWarnings("ConstantConditions")
-                    @Override public void apply(Object k, Object val) {
-                        if (convert) {
-                            Object v = convert(val);
-
-                            vis.apply(cctx.toCacheKeyObject(k), v);
-                        }
-                        else {
-                            IgniteBiTuple<Object, GridCacheVersion> v = (IgniteBiTuple<Object, GridCacheVersion>)val;
-
-                            if (v != null)
-                                verVis.apply(cctx.toCacheKeyObject(k), v.get1(), v.get2());
-                        }
-                    }
-                };
-
-                if (keys.size() > singleThreadGate.loadAllThreshold()) {
-                    Map<Object, Object> map = store.loadAll(keys0);
-
-                    if (map != null) {
-                        for (Map.Entry<Object, Object> e : map.entrySet())
-                            c.apply(cctx.toCacheKeyObject(e.getKey()), e.getValue());
-                    }
-                }
-                else
-                    singleThreadGate.loadAll(keys0, c);
-
-                thewEx = false;
-            }
-            catch (ClassCastException e) {
-                handleClassCastException(e);
-            }
-            catch (CacheLoaderException e) {
-                throw new IgniteCheckedException(e);
-            }
-            catch (Exception e) {
-                throw new IgniteCheckedException(new CacheLoaderException(e));
-            }
-            finally {
-                endSession(tx, thewEx);
-            }
-
-            if (log.isDebugEnabled())
-                log.debug("Loaded values from store for keys: " + keys0);
-        }
-    }
-
-    /**
-     * Loads data from persistent store.
-     *
-     * @param vis Closer to cache loaded elements.
-     * @param args User arguments.
-     * @return {@code True} if there is a persistent storage.
-     * @throws IgniteCheckedException If data loading failed.
-     */
-    @SuppressWarnings({"ErrorNotRethrown", "unchecked"})
-    public boolean loadCache(final GridInClosure3<KeyCacheObject, Object, GridCacheVersion> vis, Object[] args)
-        throws IgniteCheckedException {
-        if (store != null) {
-            if (log.isDebugEnabled())
-                log.debug("Loading all values from store.");
-
-            initSession(null);
-
-            boolean thewEx = true;
-
-            try {
-                store.loadCache(new IgniteBiInClosure<Object, Object>() {
-                    @Override public void apply(Object k, Object o) {
-                        Object v;
-                        GridCacheVersion ver = null;
-
-                        if (locStore) {
-                            IgniteBiTuple<Object, GridCacheVersion> t = (IgniteBiTuple<Object, GridCacheVersion>)o;
-
-                            v = t.get1();
-                            ver = t.get2();
-                        }
-                        else
-                            v = o;
-
-                        KeyCacheObject cacheKey = cctx.toCacheKeyObject(k);
-
-                        vis.apply(cacheKey, v, ver);
-                    }
-                }, args);
-
-                thewEx = false;
-            }
-            catch (CacheLoaderException e) {
-                throw new IgniteCheckedException(e);
-            }
-            catch (Exception e) {
-                throw new IgniteCheckedException(new CacheLoaderException(e));
-            }
-            finally {
-                endSession(null, thewEx);
-            }
-
-            if (log.isDebugEnabled())
-                log.debug("Loaded all values from store.");
-
-            return true;
-        }
-
-        LT.warn(log, null, "Calling Cache.loadCache() method will have no effect, " +
-            "CacheConfiguration.getStore() is not defined for cache: " + cctx.namexx());
-
-        return false;
-    }
-
-    /**
-     * Puts key-value pair into storage.
-     *
-     * @param tx Cache transaction.
-     * @param key Key.
-     * @param val Value.
-     * @param ver Version.
-     * @return {@code true} If there is a persistent storage.
-     * @throws IgniteCheckedException If storage failed.
-     */
-    @SuppressWarnings("unchecked")
-    public boolean putToStore(@Nullable IgniteInternalTx tx, Object key, Object val, GridCacheVersion ver)
-        throws IgniteCheckedException {
-        if (store != null) {
-            // Never persist internal keys.
-            if (key instanceof GridCacheInternal)
-                return true;
-
-            if (convertPortable) {
-                key = cctx.unwrapPortableIfNeeded(key, false);
-                val = cctx.unwrapPortableIfNeeded(val, false);
-            }
-
-            if (log.isDebugEnabled())
-                log.debug("Storing value in cache store [key=" + key + ", val=" + val + ']');
-
-            initSession(tx);
-
-            boolean thewEx = true;
-
-            try {
-                store.write(new CacheEntryImpl<>(key, locStore ? F.t(val, ver) : val));
-
-                thewEx = false;
-            }
-            catch (ClassCastException e) {
-                handleClassCastException(e);
-            }
-            catch (CacheWriterException e) {
-                throw new IgniteCheckedException(e);
-            }
-            catch (Exception e) {
-                throw new IgniteCheckedException(new CacheWriterException(e));
-            }
-            finally {
-                endSession(tx, thewEx);
-            }
-
-            if (log.isDebugEnabled())
-                log.debug("Stored value in cache store [key=" + key + ", val=" + val + ']');
-
-            return true;
-        }
-
-        return false;
-    }
-
-    /**
-     * Puts key-value pair into storage.
-     *
-     * @param tx Cache transaction.
-     * @param map Map.
-     * @return {@code True} if there is a persistent storage.
-     * @throws IgniteCheckedException If storage failed.
-     */
-    public boolean putAllToStore(@Nullable IgniteInternalTx tx,
-        Map<Object, IgniteBiTuple<Object, GridCacheVersion>> map)
-        throws IgniteCheckedException
-    {
-        if (F.isEmpty(map))
-            return true;
-
-        if (map.size() == 1) {
-            Map.Entry<Object, IgniteBiTuple<Object, GridCacheVersion>> e = map.entrySet().iterator().next();
-
-            return putToStore(tx, e.getKey(), e.getValue().get1(), e.getValue().get2());
-        }
-        else {
-            if (store != null) {
-                EntriesView entries = new EntriesView((Map)map);
-
-                if (log.isDebugEnabled())
-                    log.debug("Storing values in cache store [entries=" + entries + ']');
-
-                initSession(tx);
-
-                boolean thewEx = true;
-
-                try {
-                    store.writeAll(entries);
-
-                    thewEx = false;
-                }
-                catch (ClassCastException e) {
-                    handleClassCastException(e);
-                }
-                catch (Exception e) {
-                    if (!(e instanceof CacheWriterException))
-                        e = new CacheWriterException(e);
-
-                    if (!entries.isEmpty()) {
-                        List<Object> keys = new ArrayList<>(entries.size());
-
-                        for (Cache.Entry<?, ?> entry : entries)
-                            keys.add(entry.getKey());
-
-                        throw new CacheStorePartialUpdateException(keys, e);
-                    }
-
-                    throw new IgniteCheckedException(e);
-                }
-                finally {
-                    endSession(tx, thewEx);
-                }
-
-                if (log.isDebugEnabled())
-                    log.debug("Stored value in cache store [entries=" + entries + ']');
-
-                return true;
-            }
-
-            return false;
-        }
-    }
-
-    /**
-     * @param tx Cache transaction.
-     * @param key Key.
-     * @return {@code True} if there is a persistent storage.
-     * @throws IgniteCheckedException If storage failed.
-     */
-    @SuppressWarnings("unchecked")
-    public boolean removeFromStore(@Nullable IgniteInternalTx tx, Object key) throws IgniteCheckedException {
-        if (store != null) {
-            // Never remove internal key from store as it is never persisted.
-            if (key instanceof GridCacheInternal)
-                return false;
-
-            if (convertPortable)
-                key = cctx.unwrapPortableIfNeeded(key, false);
-
-            if (log.isDebugEnabled())
-                log.debug("Removing value from cache store [key=" + key + ']');
-
-            initSession(tx);
-
-            boolean thewEx = true;
-
-            try {
-                store.delete(key);
-
-                thewEx = false;
-            }
-            catch (ClassCastException e) {
-                handleClassCastException(e);
-            }
-            catch (CacheWriterException e) {
-                throw new IgniteCheckedException(e);
-            }
-            catch (Exception e) {
-                throw new IgniteCheckedException(new CacheWriterException(e));
-            }
-            finally {
-                endSession(tx, thewEx);
-            }
-
-            if (log.isDebugEnabled())
-                log.debug("Removed value from cache store [key=" + key + ']');
-
-            return true;
-        }
-
-        return false;
-    }
-
-    /**
-     * @param tx Cache transaction.
-     * @param keys Key.
-     * @return {@code True} if there is a persistent storage.
-     * @throws IgniteCheckedException If storage failed.
-     */
-    @SuppressWarnings("unchecked")
-    public boolean removeAllFromStore(@Nullable IgniteInternalTx tx, Collection<Object> keys)
-        throws IgniteCheckedException {
-        if (F.isEmpty(keys))
-            return true;
-
-        if (keys.size() == 1) {
-            Object key = keys.iterator().next();
-
-            return removeFromStore(tx, key);
-        }
-
-        if (store != null) {
-            Collection<Object> keys0 = convertPortable ? cctx.unwrapPortablesIfNeeded(keys, false) : keys;
-
-            if (log.isDebugEnabled())
-                log.debug("Removing values from cache store [keys=" + keys0 + ']');
-
-            initSession(tx);
-
-            boolean thewEx = true;
-
-            try {
-                store.deleteAll(keys0);
-
-                thewEx = false;
-            }
-            catch (ClassCastException e) {
-                handleClassCastException(e);
-            }
-            catch (Exception e) {
-                if (!(e instanceof CacheWriterException))
-                    e = new CacheWriterException(e);
-
-                if (!keys0.isEmpty())
-                    throw new CacheStorePartialUpdateException(keys0, e);
-
-                throw new IgniteCheckedException(e);
-            }
-            finally {
-                endSession(tx, thewEx);
-            }
-
-            if (log.isDebugEnabled())
-                log.debug("Removed values from cache store [keys=" + keys0 + ']');
-
-            return true;
-        }
-
-        return false;
-    }
-
-    /**
-     * @return Store.
-     */
-    public CacheStore<Object, Object> store() {
-        return store;
-    }
-
-    /**
-     * @throws IgniteCheckedException If failed.
-     */
-    public void forceFlush() throws IgniteCheckedException {
-        if (store instanceof GridCacheWriteBehindStore)
-            ((GridCacheWriteBehindStore)store).forceFlush();
-    }
-
-    /**
-     * @param tx Transaction.
-     * @param commit Commit.
-     * @throws IgniteCheckedException If failed.
-     */
-    public void txEnd(IgniteInternalTx tx, boolean commit) throws IgniteCheckedException {
-        assert store != null;
-
-        initSession(tx);
-
-        try {
-            store.sessionEnd(commit);
-        }
-        finally {
-            if (sesHolder != null) {
-                sesHolder.set(null);
-
-                tx.removeMeta(SES_ATTR);
-            }
-        }
-    }
-
-    /**
-     * @param e Class cast exception.
-     * @throws IgniteCheckedException Thrown exception.
-     */
-    private void handleClassCastException(ClassCastException e) throws IgniteCheckedException {
-        assert e != null;
-
-        if (e.getMessage() != null) {
-            throw new IgniteCheckedException("Cache store must work with portable objects if portables are " +
-                "enabled for cache [cacheName=" + cctx.namex() + ']', e);
-        }
-        else
-            throw e;
-    }
-
-    /**
-     * Clears session holder.
-     */
-    void endSession(@Nullable IgniteInternalTx tx, boolean threwEx) throws IgniteCheckedException {
-        try {
-            if (tx == null)
-                store.sessionEnd(threwEx);
-        }
-        catch (Exception e) {
-            if (!threwEx)
-                throw U.cast(e);
-        }
-        finally {
-            if (sesHolder != null)
-                sesHolder.set(null);
-        }
-    }
-
-    /**
-     * @param tx Current transaction.
-     */
-    void initSession(@Nullable IgniteInternalTx tx) {
-        if (sesHolder == null)
-            return;
-
-        assert sesHolder.get() == null;
-
-        SessionData ses;
-
-        if (tx != null) {
-            ses = tx.meta(SES_ATTR);
-
-            if (ses == null) {
-                ses = new SessionData(tx, cctx.name());
-
-                tx.addMeta(SES_ATTR, ses);
-            }
-            else
-                // Session cache name may change in cross-cache transaction.
-                ses.cacheName(cctx.name());
-        }
-        else
-            ses = new SessionData(null, cctx.name());
-
-        sesHolder.set(ses);
-    }
-
-    /**
-     *
-     */
-    private static class SessionData {
-        /** */
-        @GridToStringExclude
-        private final IgniteInternalTx tx;
-
-        /** */
-        private String cacheName;
-
-        /** */
-        @GridToStringInclude
-        private Map<Object, Object> props;
-
-        /**
-         * @param tx Current transaction.
-         * @param cacheName Cache name.
-         */
-        private SessionData(@Nullable IgniteInternalTx tx, @Nullable String cacheName) {
-            this.tx = tx;
-            this.cacheName = cacheName;
-        }
-
-        /**
-         * @return Transaction.
-         */
-        @Nullable private Transaction transaction() {
-            return tx != null ? tx.proxy() : null;
-        }
-
-        /**
-         * @return Properties.
-         */
-        private Map<Object, Object> properties() {
-            if (props == null)
-                props = new GridLeanMap<>();
-
-            return props;
-        }
-
-        /**
-         * @return Cache name.
-         */
-        private String cacheName() {
-            return cacheName;
-        }
-
-        /**
-         * @param cacheName Cache name.
-         */
-        private void cacheName(String cacheName) {
-            this.cacheName = cacheName;
-        }
-
-        /** {@inheritDoc} */
-        @Override public String toString() {
-            return S.toString(SessionData.class, this, "tx", CU.txString(tx));
-        }
-    }
-
-    /**
-     *
-     */
-    private static class ThreadLocalSession implements CacheStoreSession {
-        /** */
-        private final ThreadLocal<SessionData> sesHolder = new ThreadLocal<>();
-
-        /** {@inheritDoc} */
-        @Nullable @Override public Transaction transaction() {
-            SessionData ses0 = sesHolder.get();
-
-            return ses0 != null ? ses0.transaction() : null;
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean isWithinTransaction() {
-            return transaction() != null;
-        }
-
-        /** {@inheritDoc} */
-        @SuppressWarnings("unchecked")
-        @Override public <K1, V1> Map<K1, V1> properties() {
-            SessionData ses0 = sesHolder.get();
-
-            return ses0 != null ? (Map<K1, V1>)ses0.properties() : null;
-        }
-
-        /** {@inheritDoc} */
-        @Nullable @Override public String cacheName() {
-            SessionData ses0 = sesHolder.get();
-
-            return ses0 != null ? ses0.cacheName() : null;
-        }
-
-        /** {@inheritDoc} */
-        @Override public String toString() {
-            return S.toString(ThreadLocalSession.class, this);
-        }
-    }
-
-    /**
-     *
-     */
-    @SuppressWarnings("unchecked")
-    private class EntriesView extends AbstractCollection<Cache.Entry<?, ?>> {
-        /** */
-        private final Map<?, IgniteBiTuple<?, GridCacheVersion>> map;
-
-        /** */
-        private Set<Object> rmvd;
-
-        /** */
-        private boolean cleared;
-
-        /**
-         * @param map Map.
-         */
-        private EntriesView(Map<?, IgniteBiTuple<?, GridCacheVersion>> map) {
-            assert map != null;
-
-            this.map = map;
-        }
-
-        /** {@inheritDoc} */
-        @Override public int size() {
-            return cleared ? 0 : (map.size() - (rmvd != null ? rmvd.size() : 0));
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean isEmpty() {
-            return cleared || !iterator().hasNext();
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean contains(Object o) {
-            if (cleared || !(o instanceof Cache.Entry))
-                return false;
-
-            Cache.Entry<?, ?> e = (Cache.Entry<?, ?>)o;
-
-            return map.containsKey(e.getKey());
-        }
-
-        /** {@inheritDoc} */
-        @NotNull @Override public Iterator<Cache.Entry<?, ?>> iterator() {
-            if (cleared)
-                return F.emptyIterator();
-
-            final Iterator<Map.Entry<?, IgniteBiTuple<?, GridCacheVersion>>> it0 = (Iterator)map.entrySet().iterator();
-
-            return new Iterator<Cache.Entry<?, ?>>() {
-                /** */
-                private Cache.Entry<?, ?> cur;
-
-                /** */
-                private Cache.Entry<?, ?> next;
-
-                /**
-                 *
-                 */
-                {
-                    checkNext();
-                }
-
-                /**
-                 *
-                 */
-                private void checkNext() {
-                    while (it0.hasNext()) {
-                        Map.Entry<?, IgniteBiTuple<?, GridCacheVersion>> e = it0.next();
-
-                        Object k = e.getKey();
-
-                        if (rmvd != null && rmvd.contains(k))
-                            continue;
-
-                        Object v = locStore ? e.getValue() : e.getValue().get1();
-
-                        if (convertPortable) {
-                            k = cctx.unwrapPortableIfNeeded(k, false);
-                            v = cctx.unwrapPortableIfNeeded(v, false);
-                        }
-
-                        next = new CacheEntryImpl<>(k, v);
-
-                        break;
-                    }
-                }
-
-                @Override public boolean hasNext() {
-                    return next != null;
-                }
-
-                @Override public Cache.Entry<?, ?> next() {
-                    if (next == null)
-                        throw new NoSuchElementException();
-
-                    cur = next;
-
-                    next = null;
-
-                    checkNext();
-
-                    return cur;
-                }
-
-                @Override public void remove() {
-                    if (cur == null)
-                        throw new IllegalStateException();
-
-                    addRemoved(cur);
-
-                    cur = null;
-                }
-            };
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean add(Cache.Entry<?, ?> entry) {
-            throw new UnsupportedOperationException();
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean addAll(Collection<? extends Cache.Entry<?, ?>> col) {
-            throw new UnsupportedOperationException();
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean remove(Object o) {
-            if (cleared || !(o instanceof Cache.Entry))
-                return false;
-
-            Cache.Entry<?, ?> e = (Cache.Entry<?, ?>)o;
-
-            if (rmvd != null && rmvd.contains(e.getKey()))
-                return false;
-
-            if (mapContains(e)) {
-                addRemoved(e);
-
-                return true;
-            }
-
-            return false;
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean containsAll(Collection<?> col) {
-            if (cleared)
-                return false;
-
-            for (Object o : col) {
-                if (contains(o))
-                    return false;
-            }
-
-            return true;
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean removeAll(Collection<?> col) {
-            if (cleared)
-                return false;
-
-            boolean modified = false;
-
-            for (Object o : col) {
-                if (remove(o))
-                    modified = true;
-            }
-
-            return modified;
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean retainAll(Collection<?> col) {
-            if (cleared)
-                return false;
-
-            boolean modified = false;
-
-            for (Cache.Entry<?, ?> e : this) {
-                if (!col.contains(e)) {
-                    addRemoved(e);
-
-                    modified = true;
-                }
-            }
-
-            return modified;
-        }
-
-        /** {@inheritDoc} */
-        @Override public void clear() {
-            cleared = true;
-        }
-
-        /**
-         * @param e Entry.
-         */
-        private void addRemoved(Cache.Entry<?, ?> e) {
-            if (rmvd == null)
-                rmvd = new HashSet<>();
-
-            rmvd.add(e.getKey());
-        }
-
-        /**
-         * @param e Entry.
-         * @return {@code True} if original map contains entry.
-         */
-        private boolean mapContains(Cache.Entry<?, ?> e) {
-            return map.containsKey(e.getKey());
-        }
-
-        /** {@inheritDoc} */
-        public String toString() {
-            Iterator<Cache.Entry<?, ?>> it = iterator();
-
-            if (!it.hasNext())
-                return "[]";
-
-            SB sb = new SB("[");
-
-            while (true) {
-                Cache.Entry<?, ?> e = it.next();
-
-                sb.a(e.toString());
-
-                if (!it.hasNext())
-                    return sb.a(']').toString();
-
-                sb.a(", ");
-            }
-        }
-    }
-}


[28/37] incubator-ignite git commit: Updated devnotes.

Posted by sb...@apache.org.
Updated devnotes.


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/c213edcd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/c213edcd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/c213edcd

Branch: refs/heads/ignite-cacheplug-rmtvalid
Commit: c213edcde1bd0649a14dbf72d03a580db375cec3
Parents: c662901
Author: thatcoach <pp...@list.ru>
Authored: Thu Apr 2 20:52:16 2015 +0300
Committer: thatcoach <pp...@list.ru>
Committed: Thu Apr 2 20:52:16 2015 +0300

----------------------------------------------------------------------
 DEVNOTES.txt | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c213edcd/DEVNOTES.txt
----------------------------------------------------------------------
diff --git a/DEVNOTES.txt b/DEVNOTES.txt
index 3a712c7..f2c885f 100644
--- a/DEVNOTES.txt
+++ b/DEVNOTES.txt
@@ -1,5 +1,5 @@
-Maven Build Instructions
-========================
+Ignite Fabric Maven Build Instructions
+======================================
 Without LGPL dependencies (default):
   mvn clean package -DskipTests
 
@@ -11,6 +11,17 @@ Look for ignite-fabric-<version>.zip in ./target directory.
 NOTE: JDK version should be 1.7.0-* or >= 1.8.0-u40.
 
 
+Ignite Hadoop Accelerator Maven Build Instructions
+============================================
+mvn clean package -DskipTests -Dignite.edition=hadoop [-Dhadoop.version=X.X.X]
+
+Use 'hadoop.version' parameter to build Ignite against a specific Hadoop version.
+
+Look for ignite-hadoop-<version>.zip in ./target directory.
+
+NOTE: JDK version should be 1.7.0-* or >= 1.8.0-u40.
+
+
 JCache TCK compliance
 ======================
 To test compliance with JCache TCK use:


[29/37] incubator-ignite git commit: Updated devnotes to reflect zip name produced by parent pom.xml.

Posted by sb...@apache.org.
Updated devnotes to reflect zip name produced by parent pom.xml.


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/7e86251e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/7e86251e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/7e86251e

Branch: refs/heads/ignite-cacheplug-rmtvalid
Commit: 7e86251e8bb5d0c610ef8414a5454c5376ef75b9
Parents: c213edc
Author: thatcoach <pp...@list.ru>
Authored: Thu Apr 2 20:58:49 2015 +0300
Committer: thatcoach <pp...@list.ru>
Committed: Thu Apr 2 20:58:49 2015 +0300

----------------------------------------------------------------------
 DEVNOTES.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7e86251e/DEVNOTES.txt
----------------------------------------------------------------------
diff --git a/DEVNOTES.txt b/DEVNOTES.txt
index f2c885f..3726774 100644
--- a/DEVNOTES.txt
+++ b/DEVNOTES.txt
@@ -6,7 +6,7 @@ Without LGPL dependencies (default):
 With LGPL dependencies:
   mvn clean package -DskipTests -Prelease,lgpl
 
-Look for ignite-fabric-<version>.zip in ./target directory.
+Look for incubator-ignite-<version>-bin.zip in ./target directory.
 
 NOTE: JDK version should be 1.7.0-* or >= 1.8.0-u40.
 
@@ -17,7 +17,7 @@ mvn clean package -DskipTests -Dignite.edition=hadoop [-Dhadoop.version=X.X.X]
 
 Use 'hadoop.version' parameter to build Ignite against a specific Hadoop version.
 
-Look for ignite-hadoop-<version>.zip in ./target directory.
+Look for incubator-ignite-<version>-bin.zip in ./target directory.
 
 NOTE: JDK version should be 1.7.0-* or >= 1.8.0-u40.
 


[33/37] incubator-ignite git commit: Merge remote-tracking branch 'remotes/origin/ignite-670' into ignite-sprint-3

Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-670' into ignite-sprint-3


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/6c3f1013
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/6c3f1013
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/6c3f1013

Branch: refs/heads/ignite-cacheplug-rmtvalid
Commit: 6c3f1013a5dc981ee139668369ae75a427ebc49a
Parents: b10fdc7 f19a611
Author: sboikov <sb...@gridgain.com>
Authored: Fri Apr 3 08:59:57 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri Apr 3 08:59:57 2015 +0300

----------------------------------------------------------------------
 .../configuration/CacheConfiguration.java       |  29 --
 .../processors/cache/GridCacheAdapter.java      |   3 +-
 .../processors/cache/GridCacheAttributes.java   |   8 -
 .../cache/GridCacheConcurrentMap.java           |  34 +-
 .../processors/cache/GridCacheMapEntry.java     |  28 +-
 .../cache/GridCacheMapEntryFactory.java         |   2 -
 .../processors/cache/GridCacheProcessor.java    |   3 -
 .../distributed/GridDistributedCacheEntry.java  |   4 +-
 .../distributed/dht/GridDhtCacheAdapter.java    |  16 +-
 .../distributed/dht/GridDhtCacheEntry.java      |   4 +-
 .../distributed/dht/GridNoStorageCacheMap.java  |  11 +-
 .../dht/atomic/GridDhtAtomicCache.java          |   3 +-
 .../dht/atomic/GridDhtAtomicCacheEntry.java     |   4 +-
 .../dht/colocated/GridDhtColocatedCache.java    |   5 +-
 .../colocated/GridDhtColocatedCacheEntry.java   |   4 +-
 .../colocated/GridDhtDetachedCacheEntry.java    |   5 +-
 .../distributed/near/GridNearCacheAdapter.java  |   3 +-
 .../distributed/near/GridNearCacheEntry.java    |   4 +-
 .../processors/cache/local/GridLocalCache.java  |   3 +-
 .../cache/local/GridLocalCacheEntry.java        |   3 +-
 .../local/atomic/GridLocalAtomicCache.java      |   3 +-
 .../datastreamer/DataStreamerImpl.java          |  21 +-
 .../cache/VisorCacheDefaultConfiguration.java   |  11 -
 ...idCacheConfigurationConsistencySelfTest.java |   3 -
 .../GridCacheDhtEvictionsDisabledSelfTest.java  |   8 +-
 .../distributed/dht/GridCacheDhtTestUtils.java  |   2 +-
 .../loadtests/hashmap/GridHashMapLoadTest.java  |   2 +-
 .../cache/ttl/CacheTtlAbstractSelfTest.java     | 368 +++++++++++++++++++
 .../ttl/CacheTtlOffheapAbstractSelfTest.java    |  29 ++
 .../CacheTtlOffheapAtomicAbstractSelfTest.java  |  29 ++
 .../ttl/CacheTtlOffheapAtomicLocalSelfTest.java |  34 ++
 ...acheTtlOffheapAtomicPartitionedSelfTest.java |  34 ++
 ...TtlOffheapTransactionalAbstractSelfTest.java |  29 ++
 ...cheTtlOffheapTransactionalLocalSelfTest.java |  34 ++
 ...OffheapTransactionalPartitionedSelfTest.java |  34 ++
 .../ttl/CacheTtlOnheapAbstractSelfTest.java     |  29 ++
 .../CacheTtlOnheapAtomicAbstractSelfTest.java   |  29 ++
 .../ttl/CacheTtlOnheapAtomicLocalSelfTest.java  |  34 ++
 ...CacheTtlOnheapAtomicPartitionedSelfTest.java |  34 ++
 ...eTtlOnheapTransactionalAbstractSelfTest.java |  29 ++
 ...acheTtlOnheapTransactionalLocalSelfTest.java |  34 ++
 ...lOnheapTransactionalPartitionedSelfTest.java |  34 ++
 .../IgniteCacheWithIndexingTestSuite.java       |  51 +++
 .../IgniteH2IndexingSpiTestSuite.java           |   7 -
 .../commands/cache/VisorCacheCommand.scala      |   1 -
 45 files changed, 950 insertions(+), 149 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6c3f1013/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6c3f1013/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6c3f1013/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6c3f1013/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6c3f1013/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheEntry.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6c3f1013/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6c3f1013/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
----------------------------------------------------------------------


[07/37] incubator-ignite git commit: ignite-gg-10002 - removed unneeded marshalling-unmarshalling for local node

Posted by sb...@apache.org.
ignite-gg-10002 - removed unneeded marshalling-unmarshalling for local node


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/f8d5d445
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/f8d5d445
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/f8d5d445

Branch: refs/heads/ignite-cacheplug-rmtvalid
Commit: f8d5d4457dae69966d94d5e43ba030d6ef97b435
Parents: e78ce56
Author: S.Vladykin <sv...@gridgain.com>
Authored: Wed Apr 1 18:15:11 2015 +0300
Committer: S.Vladykin <sv...@gridgain.com>
Committed: Wed Apr 1 18:15:11 2015 +0300

----------------------------------------------------------------------
 .../messages/GridQueryNextPageResponse.java     | 32 ++++++++------------
 .../query/h2/twostep/GridMapQueryExecutor.java  |  6 ++--
 .../query/h2/twostep/GridResultPage.java        |  9 +++++-
 3 files changed, 25 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f8d5d445/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryNextPageResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryNextPageResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryNextPageResponse.java
index e798051..22f9cb4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryNextPageResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryNextPageResponse.java
@@ -26,7 +26,7 @@ import java.nio.*;
 /**
  * Next page response.
  */
-public class GridQueryNextPageResponse implements Externalizable, Message {
+public class GridQueryNextPageResponse implements Message {
     /** */
     private static final long serialVersionUID = 0L;
 
@@ -45,6 +45,9 @@ public class GridQueryNextPageResponse implements Externalizable, Message {
     /** */
     private byte[] rows;
 
+    /** */
+    private transient Object plainRows;
+
     /**
      * For {@link Externalizable}.
      */
@@ -58,16 +61,18 @@ public class GridQueryNextPageResponse implements Externalizable, Message {
      * @param page Page.
      * @param allRows All rows count.
      * @param rows Rows.
+     * @param plainRows Not marshalled rows for local node.
      */
     public GridQueryNextPageResponse(long qryReqId, int qry, int page, int allRows,
-        byte[] rows) {
-        assert rows != null;
+        byte[] rows, Object plainRows) {
+        assert rows != null ^ plainRows != null;
 
         this.qryReqId = qryReqId;
         this.qry = qry;
         this.page = page;
         this.allRows = allRows;
         this.rows = rows;
+        this.plainRows = plainRows;
     }
 
     /**
@@ -105,22 +110,11 @@ public class GridQueryNextPageResponse implements Externalizable, Message {
         return rows;
     }
 
-    /** {@inheritDoc} */
-    @Override public void writeExternal(ObjectOutput out) throws IOException {
-        out.writeLong(qryReqId);
-        out.writeInt(qry);
-        out.writeInt(page);
-        out.writeInt(allRows);
-        U.writeByteArray(out, rows);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-        qryReqId = in.readLong();
-        qry = in.readInt();
-        page = in.readInt();
-        allRows = in.readInt();
-        rows = U.readByteArray(in);
+    /**
+     * @return Plain rows.
+     */
+    public Object plainRows() {
+        return plainRows;
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f8d5d445/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java
index 2f54943..a0718e5 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java
@@ -309,10 +309,12 @@ public class GridMapQueryExecutor implements GridMessageListener {
         }
 
         try {
+            boolean loc = node.isLocal();
+
             GridQueryNextPageResponse msg = new GridQueryNextPageResponse(qr.qryReqId, qry, page,
-                page == 0 ? res.rowCount : -1, marshallRows(rows));
+                page == 0 ? res.rowCount : -1, loc ? null : marshallRows(rows), loc ? rows : null);
 
-            if (node.isLocal())
+            if (loc)
                 h2.reduceQueryExecutor().onMessage(ctx.localNodeId(), msg);
             else
                 ctx.io().send(node, GridTopic.TOPIC_QUERY, msg, GridIoPolicy.PUBLIC_POOL);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f8d5d445/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridResultPage.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridResultPage.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridResultPage.java
index e31829d..5f58b95 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridResultPage.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridResultPage.java
@@ -44,6 +44,7 @@ public class GridResultPage {
      * @param res Response.
      * @param last If this is the globally last page.
      */
+    @SuppressWarnings("unchecked")
     public GridResultPage(UUID src, GridQueryNextPageResponse res, boolean last) {
         assert src != null;
 
@@ -55,7 +56,13 @@ public class GridResultPage {
             assert res == null : "The last page must be dummy.";
 
         // res == null means that it is a terminating dummy page for the given source node ID.
-        rows = res == null ? Collections.<Value[]>emptySet() : GridMapQueryExecutor.unmarshallRows(res.rows());
+        if (res != null) {
+            Object plainRows = res.plainRows();
+
+            rows = plainRows != null ? (Collection<Value[]>)plainRows : GridMapQueryExecutor.unmarshallRows(res.rows());
+        }
+        else
+            rows = Collections.emptySet();
     }
 
     /**


[11/37] incubator-ignite git commit: Merge branches 'ignite-gg-10002' and 'ignite-sprint-3' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-gg-10002

Posted by sb...@apache.org.
Merge branches 'ignite-gg-10002' and 'ignite-sprint-3' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-gg-10002


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/aabe5a9c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/aabe5a9c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/aabe5a9c

Branch: refs/heads/ignite-cacheplug-rmtvalid
Commit: aabe5a9c37421910bdb075b4289e21f8191219b9
Parents: 9a62962 ed6632a
Author: S.Vladykin <sv...@gridgain.com>
Authored: Thu Apr 2 09:10:31 2015 +0300
Committer: S.Vladykin <sv...@gridgain.com>
Committed: Thu Apr 2 09:10:31 2015 +0300

----------------------------------------------------------------------
 .../apache/ignite/cache/CachingProvider.java    |   2 +-
 .../processors/cache/CacheObjectContext.java    |  14 +-
 .../processors/cache/CacheObjectImpl.java       |  10 +-
 .../processors/cache/GridCacheMapEntry.java     |   2 +-
 .../cache/query/GridCacheQueryManager.java      |  16 +-
 .../IgniteCacheObjectProcessorImpl.java         | 172 ++++++----
 .../IgniteCacheAtomicLocalStoreValueTest.java   |  49 +++
 ...iteCacheAtomicNearEnabledStoreValueTest.java |  30 ++
 ...maryWriteOrderNearEnabledStoreValueTest.java |  31 ++
 ...heAtomicPrimaryWriteOrderStoreValueTest.java |  32 ++
 .../cache/IgniteCacheAtomicStoreValueTest.java  |  55 ++++
 .../IgniteCacheStoreValueAbstractTest.java      | 311 +++++++++++++++++++
 .../cache/IgniteCacheTxLocalStoreValueTest.java |  49 +++
 .../IgniteCacheTxNearEnabledStoreValueTest.java |  30 ++
 .../cache/IgniteCacheTxStoreValueTest.java      |  49 +++
 .../junits/common/GridCommonAbstractTest.java   |   2 +-
 .../ignite/testsuites/IgniteCacheTestSuite.java |   9 +
 .../scala/org/apache/ignite/visor/visor.scala   |   2 +-
 18 files changed, 788 insertions(+), 77 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aabe5a9c/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessorImpl.java
----------------------------------------------------------------------


[19/37] incubator-ignite git commit: sprint-3 dependency fix

Posted by sb...@apache.org.
sprint-3 dependency fix


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/07ca9fac
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/07ca9fac
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/07ca9fac

Branch: refs/heads/ignite-cacheplug-rmtvalid
Commit: 07ca9facd0bd67eba935c05b120457082ec51b5c
Parents: 214a461
Author: avinogradov <av...@gridgain.com>
Authored: Thu Apr 2 14:44:54 2015 +0300
Committer: avinogradov <av...@gridgain.com>
Committed: Thu Apr 2 14:44:54 2015 +0300

----------------------------------------------------------------------
 examples/pom-standalone.xml | 1 -
 1 file changed, 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/07ca9fac/examples/pom-standalone.xml
----------------------------------------------------------------------
diff --git a/examples/pom-standalone.xml b/examples/pom-standalone.xml
index f07b214..996753e 100644
--- a/examples/pom-standalone.xml
+++ b/examples/pom-standalone.xml
@@ -28,7 +28,6 @@
 
     <properties>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-        <ignite.version>1.0.0</ignite.version>
     </properties>
 
     <groupId>org.apache.ignite</groupId>


[20/37] incubator-ignite git commit: # ignite-670 removed defaultTtl from configuration

Posted by sb...@apache.org.
# ignite-670 removed defaultTtl from configuration


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/93912fef
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/93912fef
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/93912fef

Branch: refs/heads/ignite-cacheplug-rmtvalid
Commit: 93912fefab66605c2cbca4447753385b07c9cb1a
Parents: fd51341
Author: sboikov <sb...@gridgain.com>
Authored: Thu Apr 2 15:22:47 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu Apr 2 15:22:47 2015 +0300

----------------------------------------------------------------------
 .../configuration/CacheConfiguration.java       | 29 -----------
 .../processors/cache/GridCacheAdapter.java      |  3 +-
 .../processors/cache/GridCacheAttributes.java   |  8 ---
 .../cache/GridCacheConcurrentMap.java           | 34 +++++--------
 .../processors/cache/GridCacheMapEntry.java     | 28 ++++++-----
 .../cache/GridCacheMapEntryFactory.java         |  2 -
 .../processors/cache/GridCacheProcessor.java    |  3 --
 .../distributed/GridDistributedCacheEntry.java  |  4 +-
 .../distributed/dht/GridDhtCacheAdapter.java    | 16 ++++--
 .../distributed/dht/GridDhtCacheEntry.java      |  4 +-
 .../distributed/dht/GridNoStorageCacheMap.java  | 11 +++--
 .../dht/atomic/GridDhtAtomicCache.java          |  3 +-
 .../dht/atomic/GridDhtAtomicCacheEntry.java     |  4 +-
 .../dht/colocated/GridDhtColocatedCache.java    |  5 +-
 .../colocated/GridDhtColocatedCacheEntry.java   |  4 +-
 .../colocated/GridDhtDetachedCacheEntry.java    |  5 +-
 .../distributed/near/GridNearCacheAdapter.java  |  3 +-
 .../distributed/near/GridNearCacheEntry.java    |  4 +-
 .../processors/cache/local/GridLocalCache.java  |  3 +-
 .../cache/local/GridLocalCacheEntry.java        |  3 +-
 .../local/atomic/GridLocalAtomicCache.java      |  3 +-
 .../cache/VisorCacheDefaultConfiguration.java   | 11 -----
 ...idCacheConfigurationConsistencySelfTest.java |  3 --
 .../GridCacheDhtEvictionsDisabledSelfTest.java  |  8 +--
 .../distributed/dht/GridCacheDhtTestUtils.java  |  2 +-
 .../loadtests/hashmap/GridHashMapLoadTest.java  |  2 +-
 .../cache/ttl/CacheTtlAbstractSelfTest.java     |  5 +-
 .../IgniteCacheWithIndexingTestSuite.java       | 51 ++++++++++++++++++++
 .../IgniteH2IndexingSpiTestSuite.java           | 18 -------
 .../commands/cache/VisorCacheCommand.scala      |  1 -
 30 files changed, 121 insertions(+), 159 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/93912fef/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
index 8d5ba6c..22148ad 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
@@ -63,12 +63,6 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
     /** Time in milliseconds to wait between rebalance messages to avoid overloading CPU. */
     public static final long DFLT_REBALANCE_THROTTLE = 0;
 
-    /**
-     * Default time to live. The value is <tt>0</tt> which means that
-     * cached objects never expire based on time.
-     */
-    public static final long DFLT_TIME_TO_LIVE = 0;
-
     /** Default number of backups. */
     public static final int DFLT_BACKUPS = 0;
 
@@ -180,9 +174,6 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
     /** Rebalance timeout. */
     private long rebalanceTimeout = DFLT_REBALANCE_TIMEOUT;
 
-    /** Default time to live for cache entries. */
-    private long ttl = DFLT_TIME_TO_LIVE;
-
     /** Cache expiration policy. */
     private EvictionPolicy evictPlc;
 
@@ -405,7 +396,6 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
         storeFactory = cc.getCacheStoreFactory();
         swapEnabled = cc.isSwapEnabled();
         tmLookupClsName = cc.getTransactionManagerLookupClassName();
-        ttl = cc.getDefaultTimeToLive();
         typeMeta = cc.getTypeMetadata();
         writeBehindBatchSize = cc.getWriteBehindBatchSize();
         writeBehindEnabled = cc.isWriteBehindEnabled();
@@ -439,25 +429,6 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
     }
 
     /**
-     * Gets time to live for all objects in cache. This value can be overridden for individual objects.
-     * If not set, then value is {@code 0} which means that objects never expire.
-     *
-     * @return Time to live for all objects in cache.
-     */
-    public long getDefaultTimeToLive() {
-        return ttl;
-    }
-
-    /**
-     * Sets time to live for all objects in cache. This value can be override for individual objects.
-     *
-     * @param ttl Time to live for all objects in cache.
-     */
-    public void setDefaultTimeToLive(long ttl) {
-        this.ttl = ttl;
-    }
-
-    /**
      * Gets cache eviction policy. By default, returns {@code null}
      * which means that evictions are disabled for cache.
      *

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/93912fef/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
index eb1a98f..1d53444 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
@@ -1121,8 +1121,7 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>,
      */
     @Nullable private GridCacheEntryEx entry0(KeyCacheObject key, AffinityTopologyVersion topVer, boolean create,
         boolean touch) {
-        GridTriple<GridCacheMapEntry> t = map.putEntryIfObsoleteOrAbsent(topVer, key, null,
-            ctx.config().getDefaultTimeToLive(), create);
+        GridTriple<GridCacheMapEntry> t = map.putEntryIfObsoleteOrAbsent(topVer, key, null, create);
 
         GridCacheEntryEx cur = t.get1();
         GridCacheEntryEx created = t.get2();

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/93912fef/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAttributes.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAttributes.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAttributes.java
index 496817e..755b89a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAttributes.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAttributes.java
@@ -198,14 +198,6 @@ public class GridCacheAttributes implements Serializable {
         return ccfg.isSwapEnabled();
     }
 
-
-    /**
-     * @return Default time to live for cache entries.
-     */
-    public long defaultTimeToLive() {
-        return ccfg.getDefaultTimeToLive();
-    }
-
     /**
      * @return Flag indicating whether eviction is synchronized.
      */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/93912fef/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMap.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMap.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMap.java
index f45d00e..5e9c2da 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMap.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMap.java
@@ -461,24 +461,22 @@ public class GridCacheConcurrentMap {
      * @param topVer Topology version.
      * @param key Key.
      * @param val Value.
-     * @param ttl Time to live.
      * @return Cache entry for corresponding key-value pair.
      */
-    public GridCacheMapEntry putEntry(AffinityTopologyVersion topVer, KeyCacheObject key, @Nullable CacheObject val, long ttl) {
+    public GridCacheMapEntry putEntry(AffinityTopologyVersion topVer, KeyCacheObject key, @Nullable CacheObject val) {
         assert key != null;
 
         checkWeakQueue();
 
         int hash = hash(key.hashCode());
 
-        return segmentFor(hash).put(key, hash, val, topVer, ttl);
+        return segmentFor(hash).put(key, hash, val, topVer);
     }
 
     /**
      * @param topVer Topology version.
      * @param key Key.
      * @param val Value.
-     * @param ttl Time to live.
      * @param create Create flag.
      * @return Triple where the first element is current entry associated with the key,
      *      the second is created entry and the third is doomed (all may be null).
@@ -487,7 +485,6 @@ public class GridCacheConcurrentMap {
         AffinityTopologyVersion topVer,
         KeyCacheObject key,
         @Nullable CacheObject val,
-        long ttl,
         boolean create)
     {
         assert key != null;
@@ -496,7 +493,7 @@ public class GridCacheConcurrentMap {
 
         int hash = hash(key.hashCode());
 
-        return segmentFor(hash).putIfObsolete(key, hash, val, topVer, ttl, create);
+        return segmentFor(hash).putIfObsolete(key, hash, val, topVer, create);
     }
 
     /**
@@ -505,12 +502,11 @@ public class GridCacheConcurrentMap {
      * this map had for any of the keys currently in the specified map.
      *
      * @param m mappings to be stored in this map.
-     * @param ttl Time to live.
      * @throws NullPointerException If the specified map is null.
      */
-    public void putAll(Map<KeyCacheObject, CacheObject> m, long ttl) {
+    public void putAll(Map<KeyCacheObject, CacheObject> m) {
         for (Map.Entry<KeyCacheObject, CacheObject> e : m.entrySet())
-            putEntry(AffinityTopologyVersion.NONE, e.getKey(), e.getValue(), ttl);
+            putEntry(AffinityTopologyVersion.NONE, e.getKey(), e.getValue());
     }
 
     /**
@@ -896,15 +892,14 @@ public class GridCacheConcurrentMap {
          * @param hash Hash.
          * @param val Value.
          * @param topVer Topology version.
-         * @param ttl TTL.
          * @return Associated value.
          */
         @SuppressWarnings({"unchecked"})
-        GridCacheMapEntry put(KeyCacheObject key, int hash, @Nullable CacheObject val, AffinityTopologyVersion topVer, long ttl) {
+        GridCacheMapEntry put(KeyCacheObject key, int hash, @Nullable CacheObject val, AffinityTopologyVersion topVer) {
             lock();
 
             try {
-                return put0(key, hash, val, topVer, ttl);
+                return put0(key, hash, val, topVer);
             }
             finally {
                 unlock();
@@ -916,11 +911,10 @@ public class GridCacheConcurrentMap {
          * @param hash Hash.
          * @param val Value.
          * @param topVer Topology version.
-         * @param ttl TTL.
          * @return Associated value.
          */
         @SuppressWarnings({"unchecked", "SynchronizationOnLocalVariableOrMethodParameter"})
-        private GridCacheMapEntry put0(KeyCacheObject key, int hash, CacheObject val, AffinityTopologyVersion topVer, long ttl) {
+        private GridCacheMapEntry put0(KeyCacheObject key, int hash, CacheObject val, AffinityTopologyVersion topVer) {
             try {
                 SegmentHeader hdr = this.hdr;
 
@@ -950,12 +944,12 @@ public class GridCacheConcurrentMap {
                 if (e != null) {
                     retVal = e;
 
-                    e.rawPut(val, ttl);
+                    e.rawPut(val, 0);
                 }
                 else {
                     GridCacheMapEntry next = bin != null ? bin : null;
 
-                    GridCacheMapEntry newRoot = factory.create(ctx, topVer, key, hash, val, next, ttl, hdr.id());
+                    GridCacheMapEntry newRoot = factory.create(ctx, topVer, key, hash, val, next, hdr.id());
 
                     // Avoiding delete (decrement) before creation (increment).
                     synchronized (newRoot) {
@@ -989,7 +983,6 @@ public class GridCacheConcurrentMap {
          * @param hash Hash.
          * @param val Value.
          * @param topVer Topology version.
-         * @param ttl TTL.
          * @param create Create flag.
          * @return Triple where the first element is current entry associated with the key,
          *      the second is created entry and the third is doomed (all may be null).
@@ -999,7 +992,6 @@ public class GridCacheConcurrentMap {
             int hash,
             @Nullable CacheObject val,
             AffinityTopologyVersion topVer,
-            long ttl,
             boolean create)
         {
             lock();
@@ -1021,7 +1013,7 @@ public class GridCacheConcurrentMap {
 
                 if (bin == null) {
                     if (create)
-                        cur = created = put0(key, hash, val, topVer, ttl);
+                        cur = created = put0(key, hash, val, topVer);
 
                     return new GridTriple<>(cur, created, doomed);
                 }
@@ -1036,13 +1028,13 @@ public class GridCacheConcurrentMap {
                         doomed = remove(key, hash, null);
 
                         if (create)
-                            cur = created = put0(key, hash, val, topVer, ttl);
+                            cur = created = put0(key, hash, val, topVer);
                     }
                     else
                         cur = e;
                 }
                 else if (create)
-                    cur = created = put0(key, hash, val, topVer, ttl);
+                    cur = created = put0(key, hash, val, topVer);
 
                 return new GridTriple<>(cur, created, doomed);
             }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/93912fef/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
index 58ff57f..78045d2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
@@ -139,7 +139,6 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
      * @param hash Key hash value.
      * @param val Entry value.
      * @param next Next entry in the linked list.
-     * @param ttl Time to live.
      * @param hdrId Header id.
      */
     protected GridCacheMapEntry(GridCacheContext<?, ?> cctx,
@@ -147,7 +146,6 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
         int hash,
         CacheObject val,
         GridCacheMapEntry next,
-        long ttl,
         int hdrId)
     {
         if (log == null)
@@ -161,8 +159,6 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
         this.hash = hash;
         this.cctx = cctx;
 
-        ttlAndExpireTimeExtras(ttl, CU.toExpireTime(ttl));
-
         val = cctx.kernalContext().cacheObjects().prepareForCache(val, cctx);
 
         synchronized (this) {
@@ -3515,19 +3511,25 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
                 boolean expired = checkExpired();
 
                 if (expired) {
-                    if (cctx.deferredDelete() && !detached() && !isInternal()) {
-                        if (!deletedUnlocked()) {
-                            update(null, 0L, 0L, ver);
+                    if (!obsolete()) {
+                        if (cctx.deferredDelete() && !detached() && !isInternal()) {
+                            if (!deletedUnlocked()) {
+                                update(null, 0L, 0L, ver);
 
-                            deletedUnlocked(true);
+                                deletedUnlocked(true);
 
-                            deferred = true;
+                                deferred = true;
+                            }
+                        }
+                        else {
+                            if (markObsolete0(obsoleteVer, true))
+                                obsolete = true; // Success, will return "true".
                         }
                     }
-                    else {
-                        if (markObsolete0(obsoleteVer, true))
-                            obsolete = true; // Success, will return "true".
-                    }
+
+                    clearIndex(saveValueForIndexUnlocked());
+
+                    releaseSwap();
 
                     if (cctx.events().isRecordable(EVT_CACHE_OBJECT_EXPIRED)) {
                         cctx.events().addEvent(partition(),

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/93912fef/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntryFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntryFactory.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntryFactory.java
index 1e56674..2c7c28d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntryFactory.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntryFactory.java
@@ -31,7 +31,6 @@ public interface GridCacheMapEntryFactory {
      * @param hash Key hash value.
      * @param val Entry value.
      * @param next Next entry in the linked list.
-     * @param ttl Time to live.
      * @param hdrId Header id.
      * @return New cache entry.
      */
@@ -41,6 +40,5 @@ public interface GridCacheMapEntryFactory {
         int hash,
         CacheObject val,
         @Nullable GridCacheMapEntry next,
-        long ttl,
         int hdrId);
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/93912fef/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index 00852fc..91c35f4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
@@ -1967,9 +1967,6 @@ public class GridCacheProcessor extends GridProcessorAdapter {
             CU.checkAttributeMismatch(log, rmtAttr.cacheName(), rmt, "defaultLockTimeout",
                 "Default lock timeout", locAttr.defaultLockTimeout(), rmtAttr.defaultLockTimeout(), false);
 
-            CU.checkAttributeMismatch(log, rmtAttr.cacheName(), rmt, "defaultTimeToLive",
-                "Default time to live", locAttr.defaultTimeToLive(), rmtAttr.defaultTimeToLive(), false);
-
             CU.checkAttributeMismatch(log, rmtAttr.cacheName(), rmt, "preloadBatchSize",
                 "Preload batch size", locAttr.rebalanceBatchSize(), rmtAttr.rebalanceBatchSize(), false);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/93912fef/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheEntry.java
index a1d83d5..0947a8e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheEntry.java
@@ -42,7 +42,6 @@ public class GridDistributedCacheEntry extends GridCacheMapEntry {
      * @param hash Key hash value.
      * @param val Entry value.
      * @param next Next entry in the linked list.
-     * @param ttl Time to live.
      * @param hdrId Cache map header ID.
      */
     public GridDistributedCacheEntry(GridCacheContext ctx,
@@ -50,10 +49,9 @@ public class GridDistributedCacheEntry extends GridCacheMapEntry {
         int hash,
         CacheObject val,
         GridCacheMapEntry next,
-        long ttl,
         int hdrId)
     {
-        super(ctx, key, hash, val, next, ttl, hdrId);
+        super(ctx, key, hash, val, next, hdrId);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/93912fef/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
index 6c27566..5594feb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
@@ -94,9 +94,15 @@ public abstract class GridDhtCacheAdapter<K, V> extends GridDistributedCacheAdap
     @Override protected void init() {
         map.setEntryFactory(new GridCacheMapEntryFactory() {
             /** {@inheritDoc} */
-            @Override public GridCacheMapEntry create(GridCacheContext ctx, AffinityTopologyVersion topVer, KeyCacheObject key, int hash,
-                CacheObject val, GridCacheMapEntry next, long ttl, int hdrId) {
-                return new GridDhtCacheEntry(ctx, topVer, key, hash, val, next, ttl, hdrId);
+            @Override public GridCacheMapEntry create(GridCacheContext ctx,
+                AffinityTopologyVersion topVer,
+                KeyCacheObject key,
+                int hash,
+                CacheObject val,
+                GridCacheMapEntry next,
+                int hdrId)
+            {
+                return new GridDhtCacheEntry(ctx, topVer, key, hash, val, next, hdrId);
             }
         });
     }
@@ -346,14 +352,14 @@ public abstract class GridDhtCacheAdapter<K, V> extends GridDistributedCacheAdap
     public GridCacheEntryEx entryExx(KeyCacheObject key, AffinityTopologyVersion topVer, boolean allowDetached, boolean touch) {
         try {
             return allowDetached && !ctx.affinity().localNode(key, topVer) ?
-                new GridDhtDetachedCacheEntry(ctx, key, key.hashCode(), null, null, 0, 0) :
+                new GridDhtDetachedCacheEntry(ctx, key, key.hashCode(), null, null, 0) :
                 entryEx(key, touch);
         }
         catch (GridDhtInvalidPartitionException e) {
             if (!allowDetached)
                 throw e;
 
-            return new GridDhtDetachedCacheEntry(ctx, key, key.hashCode(), null, null, 0, 0);
+            return new GridDhtDetachedCacheEntry(ctx, key, key.hashCode(), null, null, 0);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/93912fef/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheEntry.java
index 7195d1c..35ac08b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheEntry.java
@@ -63,7 +63,6 @@ public class GridDhtCacheEntry extends GridDistributedCacheEntry {
      * @param hash Key hash value.
      * @param val Entry value.
      * @param next Next entry in the linked list.
-     * @param ttl Time to live.
      * @param hdrId Header id.
      */
     public GridDhtCacheEntry(GridCacheContext ctx,
@@ -72,10 +71,9 @@ public class GridDhtCacheEntry extends GridDistributedCacheEntry {
         int hash,
         CacheObject val,
         GridCacheMapEntry next,
-        long ttl,
         int hdrId)
     {
-        super(ctx, key, hash, val, next, ttl, hdrId);
+        super(ctx, key, hash, val, next, hdrId);
 
         // Record this entry with partition.
         locPart = ctx.dht().topology().onAdded(topVer, this);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/93912fef/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridNoStorageCacheMap.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridNoStorageCacheMap.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridNoStorageCacheMap.java
index 7bcc5c3..8da4da5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridNoStorageCacheMap.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridNoStorageCacheMap.java
@@ -71,7 +71,10 @@ public class GridNoStorageCacheMap extends GridCacheConcurrentMap {
     }
 
     /** {@inheritDoc} */
-    @Override public GridCacheMapEntry putEntry(AffinityTopologyVersion topVer, KeyCacheObject key, @Nullable CacheObject val, long ttl) {
+    @Override public GridCacheMapEntry putEntry(AffinityTopologyVersion topVer,
+        KeyCacheObject key,
+        @Nullable CacheObject val)
+    {
         throw new AssertionError();
     }
 
@@ -80,12 +83,10 @@ public class GridNoStorageCacheMap extends GridCacheConcurrentMap {
         AffinityTopologyVersion topVer,
         KeyCacheObject key,
         @Nullable CacheObject val,
-        long ttl,
         boolean create)
     {
         if (create) {
-            GridCacheMapEntry entry = new GridDhtCacheEntry(ctx, topVer, key, hash(key.hashCode()), val,
-                null, 0, 0);
+            GridCacheMapEntry entry = new GridDhtCacheEntry(ctx, topVer, key, hash(key.hashCode()), val, null, 0);
 
             return new GridTriple<>(entry, null, null);
         }
@@ -94,7 +95,7 @@ public class GridNoStorageCacheMap extends GridCacheConcurrentMap {
     }
 
     /** {@inheritDoc} */
-    @Override public void putAll(Map<KeyCacheObject, CacheObject> m, long ttl) {
+    @Override public void putAll(Map<KeyCacheObject, CacheObject> m) {
         throw new AssertionError();
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/93912fef/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
index c376fa0..6e7c17f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
@@ -133,10 +133,9 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
                 int hash,
                 CacheObject val,
                 GridCacheMapEntry next,
-                long ttl,
                 int hdrId)
             {
-                return new GridDhtAtomicCacheEntry(ctx, topVer, key, hash, val, next, ttl, hdrId);
+                return new GridDhtAtomicCacheEntry(ctx, topVer, key, hash, val, next, hdrId);
             }
         });
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/93912fef/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCacheEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCacheEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCacheEntry.java
index c918e1e..9ded1f1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCacheEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCacheEntry.java
@@ -33,7 +33,6 @@ public class GridDhtAtomicCacheEntry extends GridDhtCacheEntry {
      * @param hash Key hash value.
      * @param val Entry value.
      * @param next Next entry in the linked list.
-     * @param ttl Time to live.
      * @param hdrId Header id.
      */
     public GridDhtAtomicCacheEntry(GridCacheContext ctx,
@@ -42,10 +41,9 @@ public class GridDhtAtomicCacheEntry extends GridDhtCacheEntry {
         int hash,
         CacheObject val,
         GridCacheMapEntry next,
-        long ttl,
         int hdrId)
     {
-        super(ctx, topVer, key, hash, val, next, ttl, hdrId);
+        super(ctx, topVer, key, hash, val, next, hdrId);
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/93912fef/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
index eb6d9a6..77224ca 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
@@ -87,10 +87,9 @@ public class GridDhtColocatedCache<K, V> extends GridDhtTransactionalCacheAdapte
                 int hash,
                 CacheObject val,
                 GridCacheMapEntry next,
-                long ttl,
                 int hdrId)
             {
-                return new GridDhtColocatedCacheEntry(ctx, topVer, key, hash, val, next, ttl, hdrId);
+                return new GridDhtColocatedCacheEntry(ctx, topVer, key, hash, val, next, hdrId);
             }
         });
     }
@@ -130,7 +129,7 @@ public class GridDhtColocatedCache<K, V> extends GridDhtTransactionalCacheAdapte
         boolean allowDetached
     ) {
         return allowDetached && !ctx.affinity().primary(ctx.localNode(), key, topVer) ?
-            new GridDhtDetachedCacheEntry(ctx, key, key.hashCode(), null, null, 0, 0) : entryExx(key, topVer);
+            new GridDhtDetachedCacheEntry(ctx, key, key.hashCode(), null, null, 0) : entryExx(key, topVer);
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/93912fef/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCacheEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCacheEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCacheEntry.java
index 1ccc0da..fab9605 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCacheEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCacheEntry.java
@@ -33,7 +33,6 @@ public class GridDhtColocatedCacheEntry extends GridDhtCacheEntry {
      * @param hash Key hash value.
      * @param val Entry value.
      * @param next Next entry in the linked list.
-     * @param ttl Time to live.
      * @param hdrId Header id.
      */
     public GridDhtColocatedCacheEntry(GridCacheContext ctx,
@@ -42,10 +41,9 @@ public class GridDhtColocatedCacheEntry extends GridDhtCacheEntry {
         int hash,
         CacheObject val,
         GridCacheMapEntry next,
-        long ttl,
         int hdrId
     ) {
-        super(ctx, topVer, key, hash, val, next, ttl, hdrId);
+        super(ctx, topVer, key, hash, val, next, hdrId);
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/93912fef/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtDetachedCacheEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtDetachedCacheEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtDetachedCacheEntry.java
index 77547db..5c4dd13 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtDetachedCacheEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtDetachedCacheEntry.java
@@ -34,12 +34,11 @@ public class GridDhtDetachedCacheEntry extends GridDistributedCacheEntry {
      * @param hash Key hash value.
      * @param val Entry value.
      * @param next Next entry in the linked list.
-     * @param ttl Time to live.
      * @param hdrId Header ID.
      */
     public GridDhtDetachedCacheEntry(GridCacheContext ctx, KeyCacheObject key, int hash, CacheObject val,
-        GridCacheMapEntry next, long ttl, int hdrId) {
-        super(ctx, key, hash, val, next, ttl, hdrId);
+        GridCacheMapEntry next, int hdrId) {
+        super(ctx, key, hash, val, next, hdrId);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/93912fef/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
index 75c8978..846efff 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
@@ -75,12 +75,11 @@ public abstract class GridNearCacheAdapter<K, V> extends GridDistributedCacheAda
                 int hash,
                 CacheObject val,
                 GridCacheMapEntry next,
-                long ttl,
                 int hdrId
             ) {
                 // Can't hold any locks here - this method is invoked when
                 // holding write-lock on the whole cache map.
-                return new GridNearCacheEntry(ctx, key, hash, val, next, ttl, hdrId);
+                return new GridNearCacheEntry(ctx, key, hash, val, next, hdrId);
             }
         });
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/93912fef/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheEntry.java
index ce80ad9..13089aa 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheEntry.java
@@ -58,7 +58,6 @@ public class GridNearCacheEntry extends GridDistributedCacheEntry {
      * @param hash Key hash value.
      * @param val Entry value.
      * @param next Next entry in the linked list.
-     * @param ttl Time to live.
      * @param hdrId Header id.
      */
     public GridNearCacheEntry(GridCacheContext ctx,
@@ -66,10 +65,9 @@ public class GridNearCacheEntry extends GridDistributedCacheEntry {
         int hash,
         CacheObject val,
         GridCacheMapEntry next,
-        long ttl,
         int hdrId)
     {
-        super(ctx, key, hash, val, next, ttl, hdrId);
+        super(ctx, key, hash, val, next, hdrId);
 
         part = ctx.affinity().partition(key);
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/93912fef/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalCache.java
index 272dca6..5780144 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalCache.java
@@ -79,10 +79,9 @@ public class GridLocalCache<K, V> extends GridCacheAdapter<K, V> {
                 int hash,
                 CacheObject val,
                 GridCacheMapEntry next,
-                long ttl,
                 int hdrId
             ) {
-                return new GridLocalCacheEntry(ctx, key, hash, val, next, ttl, hdrId);
+                return new GridLocalCacheEntry(ctx, key, hash, val, next, hdrId);
             }
         });
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/93912fef/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalCacheEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalCacheEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalCacheEntry.java
index db8038d..d05d1bb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalCacheEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalCacheEntry.java
@@ -43,10 +43,9 @@ public class GridLocalCacheEntry extends GridCacheMapEntry {
         int hash,
         CacheObject val,
         GridCacheMapEntry next,
-        long ttl,
         int hdrId)
     {
-        super(ctx, key, hash, val, next, ttl, hdrId);
+        super(ctx, key, hash, val, next, hdrId);
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/93912fef/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
index a9a6f23..d276501 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
@@ -81,10 +81,9 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
                 int hash,
                 CacheObject val,
                 @Nullable GridCacheMapEntry next,
-                long ttl,
                 int hdrId
             ) {
-                return new GridLocalCacheEntry(ctx, key, hash, val, next, ttl, hdrId);
+                return new GridLocalCacheEntry(ctx, key, hash, val, next, hdrId);
             }
         });
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/93912fef/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheDefaultConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheDefaultConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheDefaultConfiguration.java
index 858ba75..a0d9990 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheDefaultConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheDefaultConfiguration.java
@@ -29,9 +29,6 @@ public class VisorCacheDefaultConfiguration implements Serializable {
     /** */
     private static final long serialVersionUID = 0L;
 
-    /** TTL value. */
-    private long ttl;
-
     /** Default transaction timeout. */
     private long txLockTimeout;
 
@@ -45,20 +42,12 @@ public class VisorCacheDefaultConfiguration implements Serializable {
     public static VisorCacheDefaultConfiguration from(CacheConfiguration ccfg) {
         VisorCacheDefaultConfiguration cfg = new VisorCacheDefaultConfiguration();
 
-        cfg.ttl = ccfg.getDefaultTimeToLive();
         cfg.txLockTimeout = ccfg.getDefaultLockTimeout();
 
         return cfg;
     }
 
     /**
-     * @return TTL value.
-     */
-    public long timeToLive() {
-        return ttl;
-    }
-
-    /**
      * @return Default transaction timeout.
      */
     public long txLockTimeout() {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/93912fef/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConfigurationConsistencySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConfigurationConsistencySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConfigurationConsistencySelfTest.java
index 3737f46..44171a8 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConfigurationConsistencySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConfigurationConsistencySelfTest.java
@@ -576,7 +576,6 @@ public class GridCacheConfigurationConsistencySelfTest extends GridCommonAbstrac
             /** {@inheritDoc} */
             @Override public Void apply(CacheConfiguration cfg) {
                 cfg.setDefaultLockTimeout(1000);
-                cfg.setDefaultTimeToLive(1000);
 
                 return null;
             }
@@ -590,7 +589,6 @@ public class GridCacheConfigurationConsistencySelfTest extends GridCommonAbstrac
             /** {@inheritDoc} */
             @Override public Void apply(CacheConfiguration cfg) {
                 cfg.setDefaultLockTimeout(2 * 1000);
-                cfg.setDefaultTimeToLive(2 * 1000);
 
                 return null;
             }
@@ -601,7 +599,6 @@ public class GridCacheConfigurationConsistencySelfTest extends GridCommonAbstrac
         String log = strLog.toString();
 
         assertTrue(log.contains("Default lock timeout"));
-        assertTrue(log.contains("Default time to live"));
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/93912fef/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEvictionsDisabledSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEvictionsDisabledSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEvictionsDisabledSelfTest.java
index c35f106..6662413 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEvictionsDisabledSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEvictionsDisabledSelfTest.java
@@ -18,7 +18,6 @@
 package org.apache.ignite.internal.processors.cache.distributed.dht;
 
 import org.apache.ignite.*;
-import org.apache.ignite.cache.*;
 import org.apache.ignite.configuration.*;
 import org.apache.ignite.spi.discovery.tcp.*;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
@@ -26,6 +25,8 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
 import org.apache.ignite.testframework.junits.common.*;
 
 import static org.apache.ignite.cache.CacheAtomicityMode.*;
+import static org.apache.ignite.cache.CacheMode.*;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.*;
 
 /**
  * Test cache closure execution.
@@ -54,9 +55,8 @@ public class GridCacheDhtEvictionsDisabledSelfTest extends GridCommonAbstractTes
         CacheConfiguration cc = defaultCacheConfiguration();
 
         cc.setName("test");
-        cc.setCacheMode(CacheMode.PARTITIONED);
-        cc.setDefaultTimeToLive(0);
-        cc.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
+        cc.setCacheMode(PARTITIONED);
+        cc.setWriteSynchronizationMode(FULL_SYNC);
         cc.setAtomicityMode(TRANSACTIONAL);
         cc.setNearConfiguration(null);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/93912fef/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtTestUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtTestUtils.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtTestUtils.java
index 51a3d1c..765fd0e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtTestUtils.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtTestUtils.java
@@ -71,7 +71,7 @@ public class GridCacheDhtTestUtils {
         for (int i = 0; i < keyCnt; i++) {
             KeyCacheObject cacheKey = ctx.toCacheKeyObject(i);
 
-            cacheMap.putEntry(AffinityTopologyVersion.NONE, cacheKey, ctx.toCacheKeyObject("value" + i), 0);
+            cacheMap.putEntry(AffinityTopologyVersion.NONE, cacheKey, ctx.toCacheKeyObject("value" + i));
 
             dht.preloader().request(Collections.singleton(cacheKey), AffinityTopologyVersion.NONE);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/93912fef/modules/core/src/test/java/org/apache/ignite/loadtests/hashmap/GridHashMapLoadTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/loadtests/hashmap/GridHashMapLoadTest.java b/modules/core/src/test/java/org/apache/ignite/loadtests/hashmap/GridHashMapLoadTest.java
index 00ee851..de85025 100644
--- a/modules/core/src/test/java/org/apache/ignite/loadtests/hashmap/GridHashMapLoadTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/loadtests/hashmap/GridHashMapLoadTest.java
@@ -80,7 +80,7 @@ public class GridHashMapLoadTest extends GridCommonAbstractTest {
             Integer val = i++;
 
             map.put(key, new GridCacheMapEntry(ctx, ctx.toCacheKeyObject(key),
-                key.hashCode(), ctx.toCacheObject(val), null, 0, 1) {
+                key.hashCode(), ctx.toCacheObject(val), null, 1) {
                 @Override public boolean tmLock(IgniteInternalTx tx, long timeout) {
                     return false;
                 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/93912fef/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlAbstractSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlAbstractSelfTest.java
index 552e2ea..ebe6f16 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlAbstractSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlAbstractSelfTest.java
@@ -27,6 +27,7 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
 import org.apache.ignite.testframework.junits.common.*;
 
+import javax.cache.configuration.*;
 import javax.cache.expiry.*;
 import java.util.*;
 
@@ -58,10 +59,12 @@ public abstract class CacheTtlAbstractSelfTest extends GridCommonAbstractTest {
         cache.setAtomicityMode(atomicityMode());
         cache.setMemoryMode(memoryMode());
         cache.setOffHeapMaxMemory(0);
-        cache.setDefaultTimeToLive(DEFAULT_TIME_TO_LIVE);
         cache.setEvictionPolicy(new LruEvictionPolicy(MAX_CACHE_SIZE));
         cache.setIndexedTypes(Integer.class, Integer.class);
 
+        cache.setExpiryPolicyFactory(
+            FactoryBuilder.factoryOf(new TouchedExpiryPolicy(new Duration(MILLISECONDS, DEFAULT_TIME_TO_LIVE))));
+
         cfg.setCacheConfiguration(cache);
 
         TcpDiscoverySpi disco = new TcpDiscoverySpi();

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/93912fef/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheWithIndexingTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheWithIndexingTestSuite.java b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheWithIndexingTestSuite.java
new file mode 100644
index 0000000..ba6fe36
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheWithIndexingTestSuite.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.testsuites;
+
+import junit.framework.*;
+import org.apache.ignite.internal.processors.cache.*;
+import org.apache.ignite.internal.processors.cache.ttl.*;
+
+/**
+ * Cache tests using indexing.
+ */
+public class IgniteCacheWithIndexingTestSuite extends TestSuite {
+    /**
+     * @return Test suite.
+     * @throws Exception Thrown in case of the failure.
+     */
+    public static TestSuite suite() throws Exception {
+        TestSuite suite = new TestSuite("Ignite Cache With Indexing Test Suite");
+
+        suite.addTestSuite(GridCacheOffHeapAndSwapSelfTest.class);
+        suite.addTestSuite(GridIndexingWithNoopSwapSelfTest.class);
+        suite.addTestSuite(GridCacheSwapSelfTest.class);
+        suite.addTestSuite(GridCacheOffHeapSelfTest.class);
+
+        suite.addTestSuite(CacheTtlOffheapAtomicLocalSelfTest.class);
+        suite.addTestSuite(CacheTtlOffheapAtomicPartitionedSelfTest.class);
+        suite.addTestSuite(CacheTtlOffheapTransactionalLocalSelfTest.class);
+        suite.addTestSuite(CacheTtlOffheapTransactionalPartitionedSelfTest.class);
+        suite.addTestSuite(CacheTtlOnheapTransactionalLocalSelfTest.class);
+        suite.addTestSuite(CacheTtlOnheapTransactionalPartitionedSelfTest.class);
+        suite.addTestSuite(CacheTtlOnheapAtomicLocalSelfTest.class);
+        suite.addTestSuite(CacheTtlOnheapAtomicPartitionedSelfTest.class);
+
+        return suite;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/93912fef/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteH2IndexingSpiTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteH2IndexingSpiTestSuite.java b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteH2IndexingSpiTestSuite.java
index 21076bd..3aff923 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteH2IndexingSpiTestSuite.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteH2IndexingSpiTestSuite.java
@@ -18,8 +18,6 @@
 package org.apache.ignite.testsuites;
 
 import junit.framework.*;
-import org.apache.ignite.internal.processors.cache.*;
-import org.apache.ignite.internal.processors.cache.ttl.*;
 import org.apache.ignite.internal.processors.query.h2.*;
 import org.apache.ignite.internal.processors.query.h2.opt.*;
 
@@ -46,22 +44,6 @@ public class IgniteH2IndexingSpiTestSuite extends TestSuite {
         // Index rebuilding.
         suite.addTest(new TestSuite(GridH2IndexRebuildTest.class));
 
-        // Tests moved to this suite since they require GridH2IndexingSpi.
-        suite.addTestSuite(GridCacheOffHeapAndSwapSelfTest.class);
-        suite.addTestSuite(GridIndexingWithNoopSwapSelfTest.class);
-        suite.addTestSuite(GridCacheSwapSelfTest.class);
-        suite.addTestSuite(GridCacheOffHeapSelfTest.class);
-
-        //ttl
-        suite.addTestSuite(CacheTtlOffheapAtomicLocalSelfTest.class);
-        suite.addTestSuite(CacheTtlOffheapAtomicPartitionedSelfTest.class);
-        suite.addTestSuite(CacheTtlOffheapTransactionalLocalSelfTest.class);
-        suite.addTestSuite(CacheTtlOffheapTransactionalPartitionedSelfTest.class);
-        suite.addTestSuite(CacheTtlOnheapTransactionalLocalSelfTest.class);
-        suite.addTestSuite(CacheTtlOnheapTransactionalPartitionedSelfTest.class);
-        suite.addTestSuite(CacheTtlOnheapAtomicLocalSelfTest.class);
-        suite.addTestSuite(CacheTtlOnheapAtomicPartitionedSelfTest.class);
-
         return suite;
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/93912fef/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
index eb6e040..4365364 100644
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
@@ -766,7 +766,6 @@ object VisorCacheCommand {
         cacheT += ("Statistic Enabled", bool2Str(cfg.statisticsEnabled()))
         cacheT += ("Management Enabled", bool2Str(cfg.managementEnabled()))
 
-        cacheT += ("Time To Live", defaultCfg.timeToLive())
         cacheT += ("Time To Live Eager Flag", cfg.eagerTtl)
 
         cacheT += ("Write Synchronization Mode", safe(cfg.writeSynchronizationMode))


[21/37] incubator-ignite git commit: Merge remote-tracking branch 'remotes/origin/ignite-sprint-3' into ignite-gg-10009-2

Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-sprint-3' into ignite-gg-10009-2


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/f1112946
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/f1112946
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/f1112946

Branch: refs/heads/ignite-cacheplug-rmtvalid
Commit: f111294648e856b6a68c78cdf753a50e81d800f5
Parents: 93912fe 214a461
Author: sboikov <sb...@gridgain.com>
Authored: Thu Apr 2 15:23:42 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu Apr 2 15:23:42 2015 +0300

----------------------------------------------------------------------
 DEVNOTES.txt                                    |   2 +
 examples/pom.xml                                |  19 +-
 examples/schema-import/pom.xml                  |  10 +-
 ipc/shmem/README.txt                            |   2 +-
 modules/aop/pom.xml                             |   6 +-
 modules/aws/pom.xml                             |   4 +-
 modules/clients/pom.xml                         |  10 +-
 modules/codegen/pom.xml                         |   4 +-
 modules/core/pom.xml                            |   8 +-
 .../apache/ignite/cache/CachingProvider.java    |   2 +-
 .../processors/cache/CacheObjectContext.java    |  14 +-
 .../processors/cache/CacheObjectImpl.java       |  10 +-
 .../processors/cache/GridCacheMapEntry.java     |   2 +-
 .../cache/query/GridCacheQueryManager.java      |  16 +-
 .../transactions/IgniteTxLocalAdapter.java      |   4 +-
 .../IgniteCacheObjectProcessorImpl.java         | 173 +++++++----
 .../visor/cache/VisorCacheConfiguration.java    |  81 ++---
 .../cache/VisorCacheNearConfiguration.java      |  11 +-
 .../visor/node/VisorGridConfiguration.java      |  28 +-
 .../internal/visor/util/VisorMimeTypes.java     |   4 +-
 .../spi/discovery/tcp/TcpDiscoverySpi.java      |   9 +-
 .../resources/META-INF/classnames.properties    |  79 ++---
 .../ignite/IgniteCacheAffinitySelfTest.java     |   2 +
 .../GridCacheOnCopyFlagAbstractSelfTest.java    |  16 +-
 .../IgniteCacheAtomicLocalStoreValueTest.java   |  49 +++
 ...iteCacheAtomicNearEnabledStoreValueTest.java |  30 ++
 ...maryWriteOrderNearEnabledStoreValueTest.java |  31 ++
 ...heAtomicPrimaryWriteOrderStoreValueTest.java |  32 ++
 .../cache/IgniteCacheAtomicStoreValueTest.java  |  55 ++++
 .../IgniteCacheStoreValueAbstractTest.java      | 311 +++++++++++++++++++
 .../cache/IgniteCacheTxLocalStoreValueTest.java |  49 +++
 .../IgniteCacheTxNearEnabledStoreValueTest.java |  30 ++
 .../cache/IgniteCacheTxStoreValueTest.java      |  49 +++
 .../processors/igfs/IgsfStartCacheTest.java     | 115 +++++++
 .../junits/common/GridCommonAbstractTest.java   |   2 +-
 .../ignite/testsuites/IgniteCacheTestSuite.java |   9 +
 modules/extdata/p2p/pom.xml                     |   4 +-
 modules/extdata/uri/pom.xml                     |   4 +-
 modules/geospatial/pom.xml                      |   4 +-
 modules/hadoop/pom.xml                          |   8 +-
 modules/hibernate/pom.xml                       |   6 +-
 modules/indexing/pom.xml                        |   4 +-
 modules/jcl/pom.xml                             |   4 +-
 modules/jta/pom.xml                             |   4 +-
 modules/log4j/pom.xml                           |   4 +-
 modules/rest-http/pom.xml                       |   2 +-
 modules/scalar/pom.xml                          |  10 +-
 modules/schedule/pom.xml                        |   4 +-
 modules/schema-import/pom.xml                   |   2 +-
 modules/slf4j/pom.xml                           |   2 +-
 modules/spring/pom.xml                          |   8 +-
 modules/ssh/pom.xml                             |   8 +-
 modules/urideploy/pom.xml                       |   6 +-
 .../GridUriDeploymentFileResourceLoader.java    |   2 +-
 modules/visor-console/pom.xml                   |   8 +-
 .../scala/org/apache/ignite/visor/visor.scala   |   2 +-
 modules/visor-plugins/pom.xml                   |   2 +-
 modules/web/pom.xml                             |   8 +-
 modules/yardstick/pom.xml                       |   6 +-
 parent/pom.xml                                  |  10 +-
 pom.xml                                         |  56 ++--
 61 files changed, 1138 insertions(+), 318 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f1112946/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
----------------------------------------------------------------------


[06/37] incubator-ignite git commit: ignite-gg-10009: add tests to test suite.

Posted by sb...@apache.org.
ignite-gg-10009: add tests to test suite.


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/fd51341c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/fd51341c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/fd51341c

Branch: refs/heads/ignite-cacheplug-rmtvalid
Commit: fd51341c05024ef4a501c756fc2db001f4d3a9c3
Parents: b8f6904
Author: ivasilinets <iv...@gridgain.com>
Authored: Wed Apr 1 17:57:26 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Wed Apr 1 17:57:26 2015 +0300

----------------------------------------------------------------------
 .../cache/ttl/CacheTtlAbstractSelfTest.java     |  4 +--
 ...lOnheapTransactionalPartitionedSelfTest.java | 34 ++++++++++++++++++++
 .../IgniteH2IndexingSpiTestSuite.java           | 11 +++++++
 3 files changed, 47 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fd51341c/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlAbstractSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlAbstractSelfTest.java
index 25d32c0..552e2ea 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlAbstractSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlAbstractSelfTest.java
@@ -172,11 +172,11 @@ public abstract class CacheTtlAbstractSelfTest extends GridCommonAbstractTest {
      */
     private void checkSizeBeforeLive(IgniteCache<Integer, Integer> cache, int size) throws Exception {
         if (memoryMode() == CacheMemoryMode.OFFHEAP_TIERED) {
-            assertEquals(0, cache.localSize());
+            assertEquals(0, cache.localSize(CachePeekMode.ONHEAP));
             assertEquals(size, cache.localSize(CachePeekMode.OFFHEAP));
         }
         else {
-            assertEquals(size > MAX_CACHE_SIZE ? MAX_CACHE_SIZE : size, cache.localSize());
+            assertEquals(size > MAX_CACHE_SIZE ? MAX_CACHE_SIZE : size, cache.localSize(CachePeekMode.ONHEAP));
             assertEquals(size > MAX_CACHE_SIZE ? size - MAX_CACHE_SIZE : 0, cache.localSize(CachePeekMode.OFFHEAP));
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fd51341c/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlOnheapTransactionalPartitionedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlOnheapTransactionalPartitionedSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlOnheapTransactionalPartitionedSelfTest.java
new file mode 100644
index 0000000..6f88844
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlOnheapTransactionalPartitionedSelfTest.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ignite.internal.processors.cache.ttl;
+
+import org.apache.ignite.cache.*;
+
+/**
+ * TTL test with offheap.
+ */
+public class CacheTtlOnheapTransactionalPartitionedSelfTest extends CacheTtlOnheapTransactionalAbstractSelfTest {
+    /** {@inheritDoc} */
+    @Override protected CacheMode cacheMode() {
+        return CacheMode.PARTITIONED;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected int gridCount() {
+        return 2;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fd51341c/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteH2IndexingSpiTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteH2IndexingSpiTestSuite.java b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteH2IndexingSpiTestSuite.java
index bd9cca6..21076bd 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteH2IndexingSpiTestSuite.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteH2IndexingSpiTestSuite.java
@@ -19,6 +19,7 @@ package org.apache.ignite.testsuites;
 
 import junit.framework.*;
 import org.apache.ignite.internal.processors.cache.*;
+import org.apache.ignite.internal.processors.cache.ttl.*;
 import org.apache.ignite.internal.processors.query.h2.*;
 import org.apache.ignite.internal.processors.query.h2.opt.*;
 
@@ -51,6 +52,16 @@ public class IgniteH2IndexingSpiTestSuite extends TestSuite {
         suite.addTestSuite(GridCacheSwapSelfTest.class);
         suite.addTestSuite(GridCacheOffHeapSelfTest.class);
 
+        //ttl
+        suite.addTestSuite(CacheTtlOffheapAtomicLocalSelfTest.class);
+        suite.addTestSuite(CacheTtlOffheapAtomicPartitionedSelfTest.class);
+        suite.addTestSuite(CacheTtlOffheapTransactionalLocalSelfTest.class);
+        suite.addTestSuite(CacheTtlOffheapTransactionalPartitionedSelfTest.class);
+        suite.addTestSuite(CacheTtlOnheapTransactionalLocalSelfTest.class);
+        suite.addTestSuite(CacheTtlOnheapTransactionalPartitionedSelfTest.class);
+        suite.addTestSuite(CacheTtlOnheapAtomicLocalSelfTest.class);
+        suite.addTestSuite(CacheTtlOnheapAtomicPartitionedSelfTest.class);
+
         return suite;
     }
 }


[23/37] incubator-ignite git commit: ignite-gg-10002 - events

Posted by sb...@apache.org.
ignite-gg-10002 - events


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/5cabdf25
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/5cabdf25
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/5cabdf25

Branch: refs/heads/ignite-cacheplug-rmtvalid
Commit: 5cabdf25e8c8e20015020b399621c3fd9b75212e
Parents: 162bdac
Author: S.Vladykin <sv...@gridgain.com>
Authored: Thu Apr 2 17:10:21 2015 +0300
Committer: S.Vladykin <sv...@gridgain.com>
Committed: Thu Apr 2 17:10:21 2015 +0300

----------------------------------------------------------------------
 .../query/h2/twostep/GridMapQueryExecutor.java  | 80 ++++++++++++++++++--
 1 file changed, 72 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5cabdf25/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java
index a0718e5..959d1cc 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java
@@ -23,6 +23,7 @@ import org.apache.ignite.events.*;
 import org.apache.ignite.internal.*;
 import org.apache.ignite.internal.managers.communication.*;
 import org.apache.ignite.internal.managers.eventstorage.*;
+import org.apache.ignite.internal.processors.cache.*;
 import org.apache.ignite.internal.processors.cache.query.*;
 import org.apache.ignite.internal.processors.query.h2.*;
 import org.apache.ignite.internal.processors.query.h2.twostep.messages.*;
@@ -182,7 +183,9 @@ public class GridMapQueryExecutor implements GridMessageListener {
             throw new IgniteException(e);
         }
 
-        QueryResults qr = new QueryResults(req.requestId(), qrys.size());
+        GridCacheContext<?,?> cctx = ctx.cache().internalCache(req.space()).context();
+
+        QueryResults qr = new QueryResults(req.requestId(), qrys.size(), cctx);
 
         if (nodeRess.put(req.requestId(), qr) != null)
             throw new IllegalStateException();
@@ -207,19 +210,19 @@ public class GridMapQueryExecutor implements GridMessageListener {
                         "SQL query executed.",
                         EVT_CACHE_QUERY_EXECUTED,
                         CacheQueryType.SQL,
-                        null,
+                        cctx.namex(),
                         null,
                         qry.query(),
                         null,
                         null,
                         qry.parameters(),
-                        null,
+                        node.id(),
                         null));
                 }
 
                 assert rs instanceof JdbcResultSet : rs.getClass();
 
-                qr.addResult(i, rs);
+                qr.addResult(i, qry, node.id(), rs);
 
                 if (qr.canceled) {
                     qr.result(i).close();
@@ -393,14 +396,19 @@ public class GridMapQueryExecutor implements GridMessageListener {
         private final AtomicReferenceArray<QueryResult> results;
 
         /** */
+        private final GridCacheContext<?,?> cctx;
+
+        /** */
         private volatile boolean canceled;
 
         /**
          * @param qryReqId Query request ID.
          * @param qrys Number of queries.
+         * @param cctx Cache context.
          */
-        private QueryResults(long qryReqId, int qrys) {
+        private QueryResults(long qryReqId, int qrys, GridCacheContext<?,?> cctx) {
             this.qryReqId = qryReqId;
+            this.cctx = cctx;
 
             results = new AtomicReferenceArray<>(qrys);
         }
@@ -415,10 +423,12 @@ public class GridMapQueryExecutor implements GridMessageListener {
 
         /**
          * @param qry Query result index.
+         * @param q Query object.
+         * @param qrySrcNodeId Query source node.
          * @param rs Result set.
          */
-        void addResult(int qry, ResultSet rs) {
-            if (!results.compareAndSet(qry, null, new QueryResult(rs)))
+        void addResult(int qry, GridCacheSqlQuery q, UUID qrySrcNodeId, ResultSet rs) {
+            if (!results.compareAndSet(qry, null, new QueryResult(rs, cctx, qrySrcNodeId, q)))
                 throw new IllegalStateException();
         }
 
@@ -462,6 +472,15 @@ public class GridMapQueryExecutor implements GridMessageListener {
         private final ResultSet rs;
 
         /** */
+        private final GridCacheContext<?,?> cctx;
+
+        /** */
+        private final GridCacheSqlQuery qry;
+
+        /** */
+        private final UUID qrySrcNodeId;
+
+        /** */
         private int page;
 
         /** */
@@ -472,9 +491,15 @@ public class GridMapQueryExecutor implements GridMessageListener {
 
         /**
          * @param rs Result set.
+         * @param cctx Cache context.
+         * @param qrySrcNodeId Query source node.
+         * @param qry Query.
          */
-        private QueryResult(ResultSet rs) {
+        private QueryResult(ResultSet rs, GridCacheContext<?,?> cctx, UUID qrySrcNodeId, GridCacheSqlQuery qry) {
             this.rs = rs;
+            this.cctx = cctx;
+            this.qry = qry;
+            this.qrySrcNodeId = qrySrcNodeId;
 
             try {
                 res = (ResultInterface)RESULT_FIELD.get(rs);
@@ -495,18 +520,57 @@ public class GridMapQueryExecutor implements GridMessageListener {
             if (closed)
                 return true;
 
+            boolean readEvt = cctx.gridEvents().isRecordable(EVT_CACHE_QUERY_OBJECT_READ);
+
             page++;
 
             for (int i = 0 ; i < pageSize; i++) {
                 if (!res.next())
                     return true;
 
+                Value[] row = res.currentRow();
+
+                assert row != null;
+
+                if (readEvt) {
+                    cctx.gridEvents().record(new CacheQueryReadEvent<>(
+                        cctx.localNode(),
+                        "SQL fields query result set row read.",
+                        EVT_CACHE_QUERY_OBJECT_READ,
+                        CacheQueryType.SQL,
+                        cctx.namex(),
+                        null,
+                        qry.query(),
+                        null,
+                        null,
+                        qry.parameters(),
+                        qrySrcNodeId,
+                        null,
+                        null,
+                        null,
+                        null,
+                        row(row)));
+                }
+
                 rows.add(res.currentRow());
             }
 
             return false;
         }
 
+        /**
+         * @param row Values array row.
+         * @return Objects list row.
+         */
+        private List<?> row(Value[] row) {
+            List<Object> res = new ArrayList<>(row.length);
+
+            for (Value v : row)
+                res.add(v.getObject());
+
+            return res;
+        }
+
         /** {@inheritDoc} */
         @Override public synchronized void close() {
             if (closed)


[14/37] incubator-ignite git commit: # ignite-sprint-3 added test

Posted by sb...@apache.org.
# ignite-sprint-3 added test


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/71f201cb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/71f201cb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/71f201cb

Branch: refs/heads/ignite-cacheplug-rmtvalid
Commit: 71f201cb203f68a497a404731091c254072fd10e
Parents: 505a7bf
Author: sboikov <sb...@gridgain.com>
Authored: Thu Apr 2 12:08:36 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu Apr 2 12:08:36 2015 +0300

----------------------------------------------------------------------
 .../transactions/IgniteTxLocalAdapter.java      |   4 +-
 .../processors/igfs/IgsfStartCacheTest.java     | 115 +++++++++++++++++++
 2 files changed, 117 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/71f201cb/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
index 9d7f332..f2407ce 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
@@ -3080,8 +3080,8 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
                     "(cache configurations are not compatible) [" +
                     "activeCaches=[" + cacheNames + "]" +
                     ", cacheName=" + cacheCtx.name() +
-                    ", txSystem=" + system() +
-                    ", cacheSystem=" + cacheCtx.system() + ']');
+                    ", cacheSystem=" + cacheCtx.system() +
+                    ", txSystem=" + system() + ']');
             }
             else
                 activeCacheIds.add(cacheId);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/71f201cb/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgsfStartCacheTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgsfStartCacheTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgsfStartCacheTest.java
new file mode 100644
index 0000000..e2eedbe
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgsfStartCacheTest.java
@@ -0,0 +1,115 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.igfs;
+
+import org.apache.ignite.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.igfs.*;
+import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.spi.discovery.tcp.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
+
+import java.io.*;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.*;
+import static org.apache.ignite.cache.CacheMode.*;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.*;
+import static org.apache.ignite.igfs.IgfsMode.*;
+
+/**
+ *
+ */
+public class IgsfStartCacheTest extends IgfsCommonAbstractTest {
+    /** IP finder. */
+    private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+    /**
+     * @param igfs If {@code true} created IGFS configuration.
+     * @param idx Node index.
+     * @return Configuration
+     */
+    private IgniteConfiguration config(boolean igfs, int idx) {
+        IgniteConfiguration cfg = new IgniteConfiguration();
+
+        TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
+
+        discoSpi.setIpFinder(IP_FINDER);
+
+        cfg.setDiscoverySpi(discoSpi);
+
+        if (igfs) {
+            FileSystemConfiguration igfsCfg = new FileSystemConfiguration();
+
+            igfsCfg.setDataCacheName("dataCache");
+            igfsCfg.setMetaCacheName("metaCache");
+            igfsCfg.setName("igfs");
+            igfsCfg.setDefaultMode(PRIMARY);
+            igfsCfg.setFragmentizerEnabled(false);
+
+            CacheConfiguration dataCacheCfg = new CacheConfiguration();
+
+            dataCacheCfg.setName("dataCache");
+            dataCacheCfg.setCacheMode(PARTITIONED);
+            dataCacheCfg.setAtomicityMode(TRANSACTIONAL);
+            dataCacheCfg.setWriteSynchronizationMode(FULL_SYNC);
+            dataCacheCfg.setAffinityMapper(new IgfsGroupDataBlocksKeyMapper(1));
+
+            CacheConfiguration metaCacheCfg = new CacheConfiguration();
+
+            metaCacheCfg.setName("metaCache");
+            metaCacheCfg.setCacheMode(REPLICATED);
+            metaCacheCfg.setAtomicityMode(TRANSACTIONAL);
+            dataCacheCfg.setWriteSynchronizationMode(FULL_SYNC);
+
+            cfg.setCacheConfiguration(dataCacheCfg, metaCacheCfg);
+            cfg.setFileSystemConfiguration(igfsCfg);
+        }
+
+        cfg.setGridName("node-" + idx);
+
+        return cfg;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        super.afterTest();
+
+        stopAllGrids();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testCacheStart() throws Exception {
+        Ignite g0 = G.start(config(true, 0));
+
+        G.start(config(false, 1));
+
+        IgniteFileSystem igfs = g0.fileSystem("igfs");
+
+        igfs.mkdirs(new IgfsPath("/test"));
+
+        try (BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(igfs.create(
+            new IgfsPath("/test/test.file"), true)))) {
+
+            for (int i = 0; i < 1000; i++)
+                bw.write("test-" + i);
+        }
+    }
+}


[35/37] incubator-ignite git commit: # Fixed JavaDoc issue.

Posted by sb...@apache.org.
# Fixed JavaDoc issue.


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/d173f370
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/d173f370
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/d173f370

Branch: refs/heads/ignite-cacheplug-rmtvalid
Commit: d173f370e9eb6c0707d76aba11c293643837e0d5
Parents: d33191c
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Fri Apr 3 11:09:25 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Fri Apr 3 11:09:25 2015 +0300

----------------------------------------------------------------------
 .../ignite/internal/processors/cache/local/GridLocalCacheEntry.java | 1 -
 1 file changed, 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d173f370/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalCacheEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalCacheEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalCacheEntry.java
index d05d1bb..84d4c90 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalCacheEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalCacheEntry.java
@@ -35,7 +35,6 @@ public class GridLocalCacheEntry extends GridCacheMapEntry {
      * @param hash Key hash value.
      * @param val Entry value.
      * @param next Next entry in the linked list.
-     * @param ttl  Time to live.
      * @param hdrId Header id.
      */
     public GridLocalCacheEntry(GridCacheContext ctx,


[24/37] incubator-ignite git commit: # GG-9973: Fixed.

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c6629012/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheWriteBehindStoreSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheWriteBehindStoreSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheWriteBehindStoreSelfTest.java
deleted file mode 100644
index a3b1072..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheWriteBehindStoreSelfTest.java
+++ /dev/null
@@ -1,267 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache;
-
-import org.apache.ignite.internal.*;
-import org.apache.ignite.internal.util.typedef.*;
-import org.apache.ignite.internal.util.typedef.internal.*;
-import org.jsr166.*;
-
-import java.util.*;
-import java.util.concurrent.atomic.*;
-
-/**
- * This class provides basic tests for {@link GridCacheWriteBehindStore}.
- */
-public class GridCacheWriteBehindStoreSelfTest extends GridCacheWriteBehindStoreAbstractSelfTest {
-    /**
-     * Tests correct store shutdown when underlying store fails,
-     *
-     * @throws Exception If failed.
-     */
-    public void testShutdownWithFailure() throws Exception {
-        final AtomicReference<Exception> err = new AtomicReference<>();
-
-        multithreadedAsync(new Runnable() {
-            @Override public void run() {
-                try {
-                    delegate.setShouldFail(true);
-
-                    initStore(2);
-
-                    try {
-                        store.write(new CacheEntryImpl<>(1, "val1"));
-                        store.write(new CacheEntryImpl<>(2, "val2"));
-                    }
-                    finally {
-                        shutdownStore();
-
-                        delegate.setShouldFail(false);
-                    }
-                }
-                catch (Exception e) {
-                    err.set(e);
-                }
-            }
-        }, 1).get();
-
-        if (err.get() != null)
-            throw err.get();
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testSimpleStore() throws Exception {
-        initStore(2);
-
-        try {
-            store.write(new CacheEntryImpl<>(1, "v1"));
-            store.write(new CacheEntryImpl<>(2, "v2"));
-
-            assertEquals("v1", store.load(1));
-            assertEquals("v2", store.load(2));
-            assertNull(store.load(3));
-
-            store.delete(1);
-
-            assertNull(store.load(1));
-            assertEquals("v2", store.load(2));
-            assertNull(store.load(3));
-        }
-        finally {
-            shutdownStore();
-        }
-    }
-
-    /**
-     * Check that all values written to the store will be in underlying store after timeout or due to size limits.
-     *
-     * @throws Exception If failed.
-     */
-    @SuppressWarnings({"NullableProblems"})
-    public void testValuePropagation() throws Exception {
-        // Need to test size-based write.
-        initStore(1);
-
-        try {
-            for (int i = 0; i < CACHE_SIZE * 2; i++)
-                store.write(new CacheEntryImpl<>(i, "val" + i));
-
-            U.sleep(200);
-
-            for (int i = 0; i < CACHE_SIZE; i++) {
-                String val = delegate.load(i);
-
-                assertNotNull("Value for [key= " + i + "] was not written in store", val);
-                assertEquals("Invalid value [key=" + i + "]", "val" + i, val);
-            }
-
-            U.sleep(FLUSH_FREQUENCY + 300);
-
-            for (int i = CACHE_SIZE; i < CACHE_SIZE * 2; i++) {
-                String val = delegate.load(i);
-
-                assertNotNull("Value for [key= " + i + "] was not written in store", val);
-                assertEquals("Invalid value [key=" + i + "]", "val" + i, val);
-            }
-        }
-        finally {
-            shutdownStore();
-        }
-    }
-
-    /**
-     * Tests store behaviour under continuous put of the same key with different values.
-     *
-     * @throws Exception If failed
-     */
-    public void testContinuousPut() throws Exception {
-        initStore(2);
-
-        try {
-            final AtomicBoolean running = new AtomicBoolean(true);
-
-            final AtomicInteger actualPutCnt = new AtomicInteger();
-
-            IgniteInternalFuture<?> fut = multithreadedAsync(new Runnable() {
-                @SuppressWarnings({"NullableProblems"})
-                @Override public void run() {
-                    try {
-                        while (running.get()) {
-                            for (int i = 0; i < CACHE_SIZE; i++) {
-                                store.write(new CacheEntryImpl<>(i, "val-0"));
-
-                                actualPutCnt.incrementAndGet();
-
-                                store.write(new CacheEntryImpl<>(i, "val" + i));
-
-                                actualPutCnt.incrementAndGet();
-                            }
-                        }
-                    }
-                    catch (Exception e) {
-                        error("Unexpected exception in put thread", e);
-
-                        assert false;
-                    }
-                }
-            }, 1, "put");
-
-            U.sleep(FLUSH_FREQUENCY * 2 + 500);
-
-            int delegatePutCnt = delegate.getPutAllCount();
-
-            running.set(false);
-
-            fut.get();
-
-            log().info(">>> [putCnt = " + actualPutCnt.get() + ", delegatePutCnt=" + delegatePutCnt + "]");
-
-            assertTrue("No puts were made to the underlying store", delegatePutCnt > 0);
-            assertTrue("Too many puts were made to the underlying store", delegatePutCnt < actualPutCnt.get() / 10);
-        }
-        finally {
-            shutdownStore();
-        }
-
-        // These checks must be done after the store shut down
-        assertEquals("Invalid store size", CACHE_SIZE, delegate.getMap().size());
-
-        for (int i = 0; i < CACHE_SIZE; i++)
-            assertEquals("Invalid value stored", "val" + i, delegate.getMap().get(i));
-    }
-
-    /**
-     * Tests that all values were put into the store will be written to the underlying store
-     * after shutdown is called.
-     *
-     * @throws Exception If failed.
-     */
-    public void testShutdown() throws Exception {
-        initStore(2);
-
-        try {
-            final AtomicBoolean running = new AtomicBoolean(true);
-
-            IgniteInternalFuture<?> fut = multithreadedAsync(new Runnable() {
-                @SuppressWarnings({"NullableProblems"})
-                @Override public void run() {
-                    try {
-                        while (running.get()) {
-                            for (int i = 0; i < CACHE_SIZE; i++) {
-                                store.write(new CacheEntryImpl<>(i, "val-0"));
-
-                                store.write(new CacheEntryImpl<>(i, "val" + i));
-                            }
-                        }
-                    }
-                    catch (Exception e) {
-                        error("Unexpected exception in put thread", e);
-
-                        assert false;
-                    }
-                }
-            }, 1, "put");
-
-            U.sleep(300);
-
-            running.set(false);
-
-            fut.get();
-        }
-        finally {
-            shutdownStore();
-        }
-
-        // These checks must be done after the store shut down
-        assertEquals("Invalid store size", CACHE_SIZE, delegate.getMap().size());
-
-        for (int i = 0; i < CACHE_SIZE; i++)
-            assertEquals("Invalid value stored", "val" + i, delegate.getMap().get(i));
-    }
-
-    /**
-     * Tests that all values will be written to the underlying store
-     * right in the same order as they were put into the store.
-     *
-     * @throws Exception If failed.
-     */
-    public void testBatchApply() throws Exception {
-        delegate = new GridCacheTestStore(new ConcurrentLinkedHashMap<Integer, String>());
-
-        initStore(1);
-
-        List<Integer> intList = new ArrayList<>(CACHE_SIZE);
-
-        try {
-            for (int i = 0; i < CACHE_SIZE; i++) {
-                store.write(new CacheEntryImpl<>(i, "val" + i));
-
-                intList.add(i);
-            }
-        }
-        finally {
-            shutdownStore();
-        }
-
-        Map<Integer, String> underlyingMap = delegate.getMap();
-
-        assertTrue("Store map key set: " + underlyingMap.keySet(), F.eqOrdered(underlyingMap.keySet(), intList));
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c6629012/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStoreAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStoreAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStoreAbstractSelfTest.java
new file mode 100644
index 0000000..c1dd081
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStoreAbstractSelfTest.java
@@ -0,0 +1,191 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.store;
+
+import org.apache.ignite.internal.*;
+import org.apache.ignite.internal.processors.cache.*;
+import org.apache.ignite.internal.processors.cache.store.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.testframework.junits.common.*;
+
+import java.util.*;
+import java.util.concurrent.*;
+import java.util.concurrent.atomic.*;
+
+/**
+ * Harness for {@link GridCacheWriteBehindStore} tests.
+ */
+public abstract class GridCacheWriteBehindStoreAbstractSelfTest extends GridCommonAbstractTest {
+    /** Write cache size. */
+    public static final int CACHE_SIZE = 1024;
+
+    /** Value dump interval. */
+    public static final int FLUSH_FREQUENCY = 1000;
+
+    /** Underlying store. */
+    protected GridCacheTestStore delegate = new GridCacheTestStore();
+
+    /** Tested store. */
+    protected GridCacheWriteBehindStore<Integer, String> store;
+
+    /** {@inheritDoc} */
+    @Override protected void afterTestsStopped() throws Exception {
+        delegate = null;
+        store = null;
+
+        super.afterTestsStopped();
+    }
+
+    /**
+     * Initializes store.
+     *
+     * @param flushThreadCnt Count of flush threads
+     * @throws Exception If failed.
+     */
+    protected void initStore(int flushThreadCnt) throws Exception {
+        store = new GridCacheWriteBehindStore<>(null, "", "", log, delegate);
+
+        store.setFlushFrequency(FLUSH_FREQUENCY);
+
+        store.setFlushSize(CACHE_SIZE);
+
+        store.setFlushThreadCount(flushThreadCnt);
+
+        delegate.reset();
+
+        store.start();
+    }
+
+    /**
+     * Shutdowns store.
+     *
+     * @throws Exception If failed.
+     */
+    protected void shutdownStore() throws Exception {
+        store.stop();
+
+        assertTrue("Store cache must be empty after shutdown", store.writeCache().isEmpty());
+    }
+
+    /**
+     * Performs multiple put, get and remove operations in several threads on a store. After
+     * all threads finished their operations, returns the total set of keys that should be
+     * in underlying store.
+     *
+     * @param threadCnt Count of threads that should update keys.
+     * @param keysPerThread Count of unique keys assigned to a thread.
+     * @return Set of keys that was totally put in store.
+     * @throws Exception If failed.
+     */
+    protected Set<Integer> runPutGetRemoveMultithreaded(int threadCnt, final int keysPerThread) throws Exception {
+        final ConcurrentMap<String, Set<Integer>> perThread = new ConcurrentHashMap<>();
+
+        final AtomicBoolean running = new AtomicBoolean(true);
+
+        final AtomicInteger cntr = new AtomicInteger();
+
+        final AtomicInteger operations = new AtomicInteger();
+
+        IgniteInternalFuture<?> fut = multithreadedAsync(new Runnable() {
+            @SuppressWarnings({"NullableProblems"})
+            @Override public void run() {
+                // Initialize key set for this thread.
+                Set<Integer> set = new HashSet<>();
+
+                Set<Integer> old = perThread.putIfAbsent(Thread.currentThread().getName(), set);
+
+                if (old != null)
+                    set = old;
+
+                List<Integer> original = new ArrayList<>();
+
+                Random rnd = new Random();
+
+                for (int i = 0; i < keysPerThread; i++)
+                    original.add(cntr.getAndIncrement());
+
+                try {
+                    while (running.get()) {
+                        int op = rnd.nextInt(3);
+                        int idx = rnd.nextInt(keysPerThread);
+
+                        int key = original.get(idx);
+
+                        switch (op) {
+                            case 0:
+                                store.write(new CacheEntryImpl<>(key, "val" + key));
+                                set.add(key);
+
+                                operations.incrementAndGet();
+
+                                break;
+
+                            case 1:
+                                store.delete(key);
+                                set.remove(key);
+
+                                operations.incrementAndGet();
+
+                                break;
+
+                            case 2:
+                            default:
+                                store.write(new CacheEntryImpl<>(key, "broken"));
+
+                                String val = store.load(key);
+
+                                assertEquals("Invalid intermediate value: " + val, "broken", val);
+
+                                store.write(new CacheEntryImpl<>(key, "val" + key));
+
+                                set.add(key);
+
+                                // 2 put operations performed here.
+                                operations.incrementAndGet();
+                                operations.incrementAndGet();
+                                operations.incrementAndGet();
+
+                                break;
+                        }
+                    }
+                }
+                catch (Exception e) {
+                    error("Unexpected exception in put thread", e);
+
+                    assert false;
+                }
+            }
+        }, threadCnt, "put");
+
+        U.sleep(10000);
+
+        running.set(false);
+
+        fut.get();
+
+        log().info(">>> " + operations + " operations performed totally");
+
+        Set<Integer> total = new HashSet<>();
+
+        for (Set<Integer> threadVals : perThread.values()) {
+            total.addAll(threadVals);
+        }
+
+        return total;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c6629012/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStoreAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStoreAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStoreAbstractTest.java
new file mode 100644
index 0000000..d4d6f02
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStoreAbstractTest.java
@@ -0,0 +1,350 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.store;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.internal.*;
+import org.apache.ignite.internal.processors.cache.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.spi.discovery.tcp.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
+import org.apache.ignite.testframework.junits.common.*;
+import org.apache.ignite.transactions.*;
+import org.jetbrains.annotations.*;
+
+import javax.cache.configuration.*;
+import java.util.*;
+import java.util.concurrent.*;
+import java.util.concurrent.atomic.*;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.*;
+import static org.apache.ignite.transactions.TransactionConcurrency.*;
+import static org.apache.ignite.transactions.TransactionIsolation.*;
+
+/**
+ * Basic store test.
+ */
+public abstract class GridCacheWriteBehindStoreAbstractTest extends GridCommonAbstractTest {
+    /** Flush frequency. */
+    private static final int WRITE_FROM_BEHIND_FLUSH_FREQUENCY = 1000;
+
+    /** Cache store. */
+    private static final GridCacheTestStore store = new GridCacheTestStore();
+
+    /**
+     *
+     */
+    protected GridCacheWriteBehindStoreAbstractTest() {
+        super(true /*start grid. */);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        store.resetTimestamp();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        IgniteCache<?, ?> cache = jcache();
+
+        if (cache != null)
+            cache.clear();
+
+        store.reset();
+    }
+
+    /** @return Caching mode. */
+    protected abstract CacheMode cacheMode();
+
+    /** {@inheritDoc} */
+    @SuppressWarnings("unchecked")
+    @Override protected final IgniteConfiguration getConfiguration() throws Exception {
+        IgniteConfiguration c = super.getConfiguration();
+
+        TcpDiscoverySpi disco = new TcpDiscoverySpi();
+
+        disco.setIpFinder(new TcpDiscoveryVmIpFinder(true));
+
+        c.setDiscoverySpi(disco);
+
+        CacheConfiguration cc = defaultCacheConfiguration();
+
+        cc.setCacheMode(cacheMode());
+        cc.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
+        cc.setSwapEnabled(false);
+        cc.setAtomicityMode(TRANSACTIONAL);
+
+        cc.setCacheStoreFactory(singletonFactory(store));
+        cc.setReadThrough(true);
+        cc.setWriteThrough(true);
+        cc.setLoadPreviousValue(true);
+
+        cc.setWriteBehindEnabled(true);
+        cc.setWriteBehindFlushFrequency(WRITE_FROM_BEHIND_FLUSH_FREQUENCY);
+
+        c.setCacheConfiguration(cc);
+
+        return c;
+    }
+
+    /** @throws Exception If test fails. */
+    public void testWriteThrough() throws Exception {
+        IgniteCache<Integer, String> cache = jcache();
+
+        Map<Integer, String> map = store.getMap();
+
+        assert map.isEmpty();
+
+        Transaction tx = grid().transactions().txStart(OPTIMISTIC, REPEATABLE_READ);
+
+        try {
+            for (int i = 1; i <= 10; i++) {
+                cache.put(i, Integer.toString(i));
+
+                checkLastMethod(null);
+            }
+
+            tx.commit();
+        }
+        finally {
+            tx.close();
+        }
+
+        // Need to wait WFB flush timeout.
+        U.sleep(WRITE_FROM_BEHIND_FLUSH_FREQUENCY + 100);
+
+        checkLastMethod("putAll");
+
+        assert cache.size() == 10;
+
+        for (int i = 1; i <= 10; i++) {
+            String val = map.get(i);
+
+            assert val != null;
+            assert val.equals(Integer.toString(i));
+        }
+
+        store.resetLastMethod();
+
+        tx = grid().transactions().txStart();
+
+        try {
+            for (int i = 1; i <= 10; i++) {
+                String val = cache.getAndRemove(i);
+
+                checkLastMethod(null);
+
+                assert val != null;
+                assert val.equals(Integer.toString(i));
+            }
+
+            tx.commit();
+        }
+        finally {
+            tx.close();
+        }
+
+        // Need to wait WFB flush timeout.
+        U.sleep(WRITE_FROM_BEHIND_FLUSH_FREQUENCY + 100);
+
+        checkLastMethod("removeAll");
+
+        assert map.isEmpty();
+    }
+
+    /** @throws Exception If test failed. */
+    public void testReadThrough() throws Exception {
+        IgniteCache<Integer, String> cache = jcache();
+
+        Map<Integer, String> map = store.getMap();
+
+        assert map.isEmpty();
+
+        try (Transaction tx = grid().transactions().txStart(OPTIMISTIC, REPEATABLE_READ)) {
+            for (int i = 1; i <= 10; i++)
+                cache.put(i, Integer.toString(i));
+
+            checkLastMethod(null);
+
+            tx.commit();
+        }
+
+        // Need to wait WFB flush timeout.
+        U.sleep(WRITE_FROM_BEHIND_FLUSH_FREQUENCY + 100);
+
+        checkLastMethod("putAll");
+
+        for (int i = 1; i <= 10; i++) {
+            String val = map.get(i);
+
+            assert val != null;
+            assert val.equals(Integer.toString(i));
+        }
+
+        cache.clear();
+
+        assert cache.localSize() == 0;
+        assert cache.localSize() == 0;
+
+        // Need to wait WFB flush timeout.
+        U.sleep(WRITE_FROM_BEHIND_FLUSH_FREQUENCY + 100);
+
+        assert map.size() == 10;
+
+        for (int i = 1; i <= 10; i++) {
+            // Read through.
+            String val = cache.get(i);
+
+            checkLastMethod("load");
+
+            assert val != null;
+            assert val.equals(Integer.toString(i));
+        }
+
+        assert cache.size() == 10;
+
+        cache.clear();
+
+        assert cache.localSize() == 0;
+        assert cache.localSize() == 0;
+
+        assert map.size() == 10;
+
+        Set<Integer> keys = new HashSet<>();
+
+        for (int i = 1; i <= 10; i++)
+            keys.add(i);
+
+        // Read through.
+        Map<Integer, String> vals = cache.getAll(keys);
+
+        checkLastMethod("loadAll");
+
+        assert vals != null;
+        assert vals.size() == 10;
+
+        for (int i = 1; i <= 10; i++) {
+            String val = vals.get(i);
+
+            assert val != null;
+            assert val.equals(Integer.toString(i));
+        }
+
+        // Write through.
+        cache.removeAll(keys);
+
+        // Need to wait WFB flush timeout.
+        U.sleep(WRITE_FROM_BEHIND_FLUSH_FREQUENCY + 100);
+
+        checkLastMethod("removeAll");
+
+        assert cache.localSize() == 0;
+        assert cache.localSize() == 0;
+
+        assert map.isEmpty();
+    }
+
+    /** @throws Exception If failed. */
+    public void testMultithreaded() throws Exception {
+        final ConcurrentMap<String, Set<Integer>> perThread = new ConcurrentHashMap<>();
+
+        final AtomicBoolean running = new AtomicBoolean(true);
+
+        final IgniteCache<Integer, String> cache = jcache();
+
+        IgniteInternalFuture<?> fut = multithreadedAsync(new Runnable() {
+            @SuppressWarnings({"NullableProblems"})
+            @Override public void run() {
+                // Initialize key set for this thread.
+                Set<Integer> set = new HashSet<>();
+
+                Set<Integer> old = perThread.putIfAbsent(Thread.currentThread().getName(), set);
+
+                if (old != null)
+                    set = old;
+
+                Random rnd = new Random();
+
+                int keyCnt = 20000;
+
+                while (running.get()) {
+                    int op = rnd.nextInt(2);
+                    int key = rnd.nextInt(keyCnt);
+
+                    switch (op) {
+                        case 0:
+                            cache.put(key, "val" + key);
+                            set.add(key);
+
+                            break;
+
+                        case 1:
+                        default:
+                            cache.remove(key);
+                            set.remove(key);
+
+                            break;
+                    }
+                }
+            }
+        }, 10, "put");
+
+        U.sleep(10000);
+
+        running.set(false);
+
+        fut.get();
+
+        U.sleep(5 * WRITE_FROM_BEHIND_FLUSH_FREQUENCY);
+
+        Map<Integer, String> stored = store.getMap();
+
+        for (Map.Entry<Integer, String> entry : stored.entrySet()) {
+            int key = entry.getKey();
+
+            assertEquals("Invalid value for key " + key, "val" + key, entry.getValue());
+
+            boolean found = false;
+
+            for (Set<Integer> threadPuts : perThread.values()) {
+                if (threadPuts.contains(key)) {
+                    found = true;
+
+                    break;
+                }
+            }
+
+            assert found : "No threads found that put key " + key;
+        }
+    }
+
+    /** @param mtd Expected last method value. */
+    private void checkLastMethod(@Nullable String mtd) {
+        String lastMtd = store.getLastMethod();
+
+        if (mtd == null)
+            assert lastMtd == null : "Last method must be null: " + lastMtd;
+        else {
+            assert lastMtd != null : "Last method must be not null";
+            assert lastMtd.equals(mtd) : "Last method does not match [expected=" + mtd + ", lastMtd=" + lastMtd + ']';
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c6629012/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStoreLocalTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStoreLocalTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStoreLocalTest.java
new file mode 100644
index 0000000..2325fa6
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStoreLocalTest.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.store;
+
+import org.apache.ignite.cache.*;
+
+/**
+ * Tests {@link org.apache.ignite.internal.processors.cache.store.GridCacheWriteBehindStore} in grid configuration.
+ */
+public class GridCacheWriteBehindStoreLocalTest extends GridCacheWriteBehindStoreAbstractTest {
+    /** {@inheritDoc} */
+    @Override protected CacheMode cacheMode() {
+        return CacheMode.LOCAL;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c6629012/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStoreMultithreadedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStoreMultithreadedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStoreMultithreadedSelfTest.java
new file mode 100644
index 0000000..3bcebb0
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStoreMultithreadedSelfTest.java
@@ -0,0 +1,163 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.store;
+
+import org.apache.ignite.internal.util.typedef.internal.*;
+
+import java.util.*;
+
+/**
+ * Multithreaded tests for {@link org.apache.ignite.internal.processors.cache.store.GridCacheWriteBehindStore}.
+ */
+public class GridCacheWriteBehindStoreMultithreadedSelfTest extends GridCacheWriteBehindStoreAbstractSelfTest {
+    /**
+     * This test performs complex set of operations on store from multiple threads.
+     *
+     * @throws Exception If failed.
+     */
+    public void testPutGetRemove() throws Exception {
+        initStore(2);
+
+        Set<Integer> exp;
+
+        try {
+            exp = runPutGetRemoveMultithreaded(10, 10);
+        }
+        finally {
+            shutdownStore();
+        }
+
+        Map<Integer, String> map = delegate.getMap();
+
+        Collection<Integer> extra = new HashSet<>(map.keySet());
+
+        extra.removeAll(exp);
+
+        assertTrue("The underlying store contains extra keys: " + extra, extra.isEmpty());
+
+        Collection<Integer> missing = new HashSet<>(exp);
+
+        missing.removeAll(map.keySet());
+
+        assertTrue("Missing keys in the underlying store: " + missing, missing.isEmpty());
+
+        for (Integer key : exp)
+            assertEquals("Invalid value for key " + key, "val" + key, map.get(key));
+    }
+
+    /**
+     * Tests that cache would keep values if underlying store fails.
+     *
+     * @throws Exception If failed.
+     */
+    public void testStoreFailure() throws Exception {
+        delegate.setShouldFail(true);
+
+        initStore(2);
+
+        Set<Integer> exp;
+
+        try {
+            exp = runPutGetRemoveMultithreaded(10, 10);
+
+            U.sleep(FLUSH_FREQUENCY);
+
+            info(">>> There are " + store.getWriteBehindErrorRetryCount() + " entries in RETRY state");
+
+            delegate.setShouldFail(false);
+
+            // Despite that we set shouldFail flag to false, flush thread may just have caught an exception.
+            // If we move store to the stopping state right away, this value will be lost. That's why this sleep
+            // is inserted here to let all exception handlers in write-behind store exit.
+            U.sleep(1000);
+        }
+        finally {
+            shutdownStore();
+        }
+
+        Map<Integer, String> map = delegate.getMap();
+
+        Collection<Integer> extra = new HashSet<>(map.keySet());
+
+        extra.removeAll(exp);
+
+        assertTrue("The underlying store contains extra keys: " + extra, extra.isEmpty());
+
+        Collection<Integer> missing = new HashSet<>(exp);
+
+        missing.removeAll(map.keySet());
+
+        assertTrue("Missing keys in the underlying store: " + missing, missing.isEmpty());
+
+        for (Integer key : exp)
+            assertEquals("Invalid value for key " + key, "val" + key, map.get(key));
+    }
+
+    /**
+     * Tests store consistency in case of high put rate, when flush is performed from the same thread
+     * as put or remove operation.
+     *
+     * @throws Exception If failed.
+     */
+    public void testFlushFromTheSameThread() throws Exception {
+        // 50 milliseconds should be enough.
+        delegate.setOperationDelay(50);
+
+        initStore(2);
+
+        Set<Integer> exp;
+
+        int start = store.getWriteBehindTotalCriticalOverflowCount();
+
+        try {
+            //We will have in total 5 * CACHE_SIZE keys that should be enough to grow map size to critical value.
+            exp = runPutGetRemoveMultithreaded(5, CACHE_SIZE);
+        }
+        finally {
+            log.info(">>> Done inserting, shutting down the store");
+
+            shutdownStore();
+        }
+
+        // Restore delay.
+        delegate.setOperationDelay(0);
+
+        Map<Integer, String> map = delegate.getMap();
+
+        int end = store.getWriteBehindTotalCriticalOverflowCount();
+
+        log.info(">>> There are " + exp.size() + " keys in store, " + (end - start) + " overflows detected");
+
+        assertTrue("No cache overflows detected (a bug or too few keys or too few delay?)", end > start);
+
+        Collection<Integer> extra = new HashSet<>(map.keySet());
+
+        extra.removeAll(exp);
+
+        assertTrue("The underlying store contains extra keys: " + extra, extra.isEmpty());
+
+        Collection<Integer> missing = new HashSet<>(exp);
+
+        missing.removeAll(map.keySet());
+
+        assertTrue("Missing keys in the underlying store: " + missing, missing.isEmpty());
+
+        for (Integer key : exp)
+            assertEquals("Invalid value for key " + key, "val" + key, map.get(key));
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c6629012/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStorePartitionedMultiNodeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStorePartitionedMultiNodeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStorePartitionedMultiNodeSelfTest.java
new file mode 100644
index 0000000..e9821fb
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStorePartitionedMultiNodeSelfTest.java
@@ -0,0 +1,216 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.store;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.*;
+import org.apache.ignite.cache.store.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.internal.*;
+import org.apache.ignite.internal.processors.cache.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.spi.discovery.tcp.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
+import org.apache.ignite.testframework.junits.common.*;
+import org.apache.ignite.transactions.*;
+
+import java.util.*;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.*;
+import static org.apache.ignite.transactions.TransactionConcurrency.*;
+import static org.apache.ignite.transactions.TransactionIsolation.*;
+
+/**
+ * Tests write-behind store with near and dht commit option.
+ */
+public class GridCacheWriteBehindStorePartitionedMultiNodeSelfTest extends GridCommonAbstractTest {
+    /** Grids to start. */
+    private static final int GRID_CNT = 5;
+
+    /** Ip finder. */
+    private static final TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+
+    /** Flush frequency. */
+    public static final int WRITE_BEHIND_FLUSH_FREQ = 1000;
+
+    /** Stores per grid. */
+    private GridCacheTestStore[] stores = new GridCacheTestStore[GRID_CNT];
+
+    /** Start grid counter. */
+    private int idx;
+
+    /** {@inheritDoc} */
+    @SuppressWarnings("unchecked")
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+        IgniteConfiguration c = super.getConfiguration(gridName);
+
+        TcpDiscoverySpi disco = new TcpDiscoverySpi();
+
+        disco.setIpFinder(ipFinder);
+
+        c.setDiscoverySpi(disco);
+
+        CacheConfiguration cc = defaultCacheConfiguration();
+
+        cc.setCacheMode(CacheMode.PARTITIONED);
+        cc.setWriteBehindEnabled(true);
+        cc.setWriteBehindFlushFrequency(WRITE_BEHIND_FLUSH_FREQ);
+        cc.setAtomicityMode(TRANSACTIONAL);
+        cc.setNearConfiguration(new NearCacheConfiguration());
+
+        CacheStore store = stores[idx] = new GridCacheTestStore();
+
+        cc.setCacheStoreFactory(singletonFactory(store));
+        cc.setReadThrough(true);
+        cc.setWriteThrough(true);
+        cc.setLoadPreviousValue(true);
+
+        c.setCacheConfiguration(cc);
+
+        idx++;
+
+        return c;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTestsStopped() throws Exception {
+        stores = null;
+
+        super.afterTestsStopped();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    private void prepare() throws Exception {
+        idx = 0;
+
+        startGrids(GRID_CNT);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        super.afterTest();
+
+        stopAllGrids();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testSingleWritesOnDhtNode() throws Exception {
+        checkSingleWrites();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testBatchWritesOnDhtNode() throws Exception {
+        checkBatchWrites();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testTxWritesOnDhtNode() throws Exception {
+        checkTxWrites();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    private void checkSingleWrites() throws Exception {
+        prepare();
+
+        IgniteCache<Integer, String> cache = grid(0).cache(null);
+
+        for (int i = 0; i < 100; i++)
+            cache.put(i, String.valueOf(i));
+
+        checkWrites();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    private void checkBatchWrites() throws Exception {
+        prepare();
+
+        Map<Integer, String> map = new HashMap<>();
+
+        for (int i = 0; i < 100; i++)
+            map.put(i, String.valueOf(i));
+
+        grid(0).cache(null).putAll(map);
+
+        checkWrites();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    private void checkTxWrites() throws Exception {
+        prepare();
+
+        IgniteCache<Object, Object> cache = grid(0).cache(null);
+
+        try (Transaction tx = grid(0).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
+            for (int i = 0; i < 100; i++)
+                cache.put(i, String.valueOf(i));
+
+            tx.commit();
+        }
+
+        checkWrites();
+    }
+
+    /**
+     * @throws IgniteInterruptedCheckedException If sleep was interrupted.
+     */
+    private void checkWrites() throws IgniteInterruptedCheckedException {
+        U.sleep(WRITE_BEHIND_FLUSH_FREQ * 2);
+
+        Collection<Integer> allKeys = new ArrayList<>(100);
+
+        for (int i = 0; i < GRID_CNT; i++) {
+            Map<Integer,String> map = stores[i].getMap();
+
+            assertFalse("Missing writes for node: " + i, map.isEmpty());
+
+            allKeys.addAll(map.keySet());
+
+            // Check there is no intersection.
+            for (int j = 0; j < GRID_CNT; j++) {
+                if (i == j)
+                    continue;
+
+                Collection<Integer> intersection = new HashSet<>(stores[j].getMap().keySet());
+
+                intersection.retainAll(map.keySet());
+
+                assertTrue(intersection.isEmpty());
+            }
+        }
+
+        assertEquals(100, allKeys.size());
+
+        for (int i = 0; i < 100; i++)
+            assertTrue(allKeys.contains(i));
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c6629012/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStorePartitionedTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStorePartitionedTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStorePartitionedTest.java
new file mode 100644
index 0000000..fe589ca
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStorePartitionedTest.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.store;
+
+import org.apache.ignite.cache.*;
+
+/**
+ * Tests {@link org.apache.ignite.internal.processors.cache.store.GridCacheWriteBehindStore} in partitioned configuration.
+ */
+public class GridCacheWriteBehindStorePartitionedTest extends GridCacheWriteBehindStoreAbstractTest {
+    /** {@inheritDoc} */
+    @Override protected CacheMode cacheMode() {
+        return CacheMode.PARTITIONED;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c6629012/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStoreReplicatedTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStoreReplicatedTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStoreReplicatedTest.java
new file mode 100644
index 0000000..26f8431
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStoreReplicatedTest.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.store;
+
+import org.apache.ignite.cache.*;
+
+/**
+ * Tests {@link org.apache.ignite.internal.processors.cache.store.GridCacheWriteBehindStore} in grid configuration.
+ */
+public class GridCacheWriteBehindStoreReplicatedTest extends GridCacheWriteBehindStoreAbstractTest {
+    /** {@inheritDoc} */
+    @Override protected CacheMode cacheMode() {
+        return CacheMode.REPLICATED;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c6629012/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStoreSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStoreSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStoreSelfTest.java
new file mode 100644
index 0000000..937e597
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStoreSelfTest.java
@@ -0,0 +1,268 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.store;
+
+import org.apache.ignite.internal.*;
+import org.apache.ignite.internal.processors.cache.*;
+import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.jsr166.*;
+
+import java.util.*;
+import java.util.concurrent.atomic.*;
+
+/**
+ * This class provides basic tests for {@link org.apache.ignite.internal.processors.cache.store.GridCacheWriteBehindStore}.
+ */
+public class GridCacheWriteBehindStoreSelfTest extends GridCacheWriteBehindStoreAbstractSelfTest {
+    /**
+     * Tests correct store shutdown when underlying store fails,
+     *
+     * @throws Exception If failed.
+     */
+    public void testShutdownWithFailure() throws Exception {
+        final AtomicReference<Exception> err = new AtomicReference<>();
+
+        multithreadedAsync(new Runnable() {
+            @Override public void run() {
+                try {
+                    delegate.setShouldFail(true);
+
+                    initStore(2);
+
+                    try {
+                        store.write(new CacheEntryImpl<>(1, "val1"));
+                        store.write(new CacheEntryImpl<>(2, "val2"));
+                    }
+                    finally {
+                        shutdownStore();
+
+                        delegate.setShouldFail(false);
+                    }
+                }
+                catch (Exception e) {
+                    err.set(e);
+                }
+            }
+        }, 1).get();
+
+        if (err.get() != null)
+            throw err.get();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testSimpleStore() throws Exception {
+        initStore(2);
+
+        try {
+            store.write(new CacheEntryImpl<>(1, "v1"));
+            store.write(new CacheEntryImpl<>(2, "v2"));
+
+            assertEquals("v1", store.load(1));
+            assertEquals("v2", store.load(2));
+            assertNull(store.load(3));
+
+            store.delete(1);
+
+            assertNull(store.load(1));
+            assertEquals("v2", store.load(2));
+            assertNull(store.load(3));
+        }
+        finally {
+            shutdownStore();
+        }
+    }
+
+    /**
+     * Check that all values written to the store will be in underlying store after timeout or due to size limits.
+     *
+     * @throws Exception If failed.
+     */
+    @SuppressWarnings({"NullableProblems"})
+    public void testValuePropagation() throws Exception {
+        // Need to test size-based write.
+        initStore(1);
+
+        try {
+            for (int i = 0; i < CACHE_SIZE * 2; i++)
+                store.write(new CacheEntryImpl<>(i, "val" + i));
+
+            U.sleep(200);
+
+            for (int i = 0; i < CACHE_SIZE; i++) {
+                String val = delegate.load(i);
+
+                assertNotNull("Value for [key= " + i + "] was not written in store", val);
+                assertEquals("Invalid value [key=" + i + "]", "val" + i, val);
+            }
+
+            U.sleep(FLUSH_FREQUENCY + 300);
+
+            for (int i = CACHE_SIZE; i < CACHE_SIZE * 2; i++) {
+                String val = delegate.load(i);
+
+                assertNotNull("Value for [key= " + i + "] was not written in store", val);
+                assertEquals("Invalid value [key=" + i + "]", "val" + i, val);
+            }
+        }
+        finally {
+            shutdownStore();
+        }
+    }
+
+    /**
+     * Tests store behaviour under continuous put of the same key with different values.
+     *
+     * @throws Exception If failed
+     */
+    public void testContinuousPut() throws Exception {
+        initStore(2);
+
+        try {
+            final AtomicBoolean running = new AtomicBoolean(true);
+
+            final AtomicInteger actualPutCnt = new AtomicInteger();
+
+            IgniteInternalFuture<?> fut = multithreadedAsync(new Runnable() {
+                @SuppressWarnings({"NullableProblems"})
+                @Override public void run() {
+                    try {
+                        while (running.get()) {
+                            for (int i = 0; i < CACHE_SIZE; i++) {
+                                store.write(new CacheEntryImpl<>(i, "val-0"));
+
+                                actualPutCnt.incrementAndGet();
+
+                                store.write(new CacheEntryImpl<>(i, "val" + i));
+
+                                actualPutCnt.incrementAndGet();
+                            }
+                        }
+                    }
+                    catch (Exception e) {
+                        error("Unexpected exception in put thread", e);
+
+                        assert false;
+                    }
+                }
+            }, 1, "put");
+
+            U.sleep(FLUSH_FREQUENCY * 2 + 500);
+
+            int delegatePutCnt = delegate.getPutAllCount();
+
+            running.set(false);
+
+            fut.get();
+
+            log().info(">>> [putCnt = " + actualPutCnt.get() + ", delegatePutCnt=" + delegatePutCnt + "]");
+
+            assertTrue("No puts were made to the underlying store", delegatePutCnt > 0);
+            assertTrue("Too many puts were made to the underlying store", delegatePutCnt < actualPutCnt.get() / 10);
+        }
+        finally {
+            shutdownStore();
+        }
+
+        // These checks must be done after the store shut down
+        assertEquals("Invalid store size", CACHE_SIZE, delegate.getMap().size());
+
+        for (int i = 0; i < CACHE_SIZE; i++)
+            assertEquals("Invalid value stored", "val" + i, delegate.getMap().get(i));
+    }
+
+    /**
+     * Tests that all values were put into the store will be written to the underlying store
+     * after shutdown is called.
+     *
+     * @throws Exception If failed.
+     */
+    public void testShutdown() throws Exception {
+        initStore(2);
+
+        try {
+            final AtomicBoolean running = new AtomicBoolean(true);
+
+            IgniteInternalFuture<?> fut = multithreadedAsync(new Runnable() {
+                @SuppressWarnings({"NullableProblems"})
+                @Override public void run() {
+                    try {
+                        while (running.get()) {
+                            for (int i = 0; i < CACHE_SIZE; i++) {
+                                store.write(new CacheEntryImpl<>(i, "val-0"));
+
+                                store.write(new CacheEntryImpl<>(i, "val" + i));
+                            }
+                        }
+                    }
+                    catch (Exception e) {
+                        error("Unexpected exception in put thread", e);
+
+                        assert false;
+                    }
+                }
+            }, 1, "put");
+
+            U.sleep(300);
+
+            running.set(false);
+
+            fut.get();
+        }
+        finally {
+            shutdownStore();
+        }
+
+        // These checks must be done after the store shut down
+        assertEquals("Invalid store size", CACHE_SIZE, delegate.getMap().size());
+
+        for (int i = 0; i < CACHE_SIZE; i++)
+            assertEquals("Invalid value stored", "val" + i, delegate.getMap().get(i));
+    }
+
+    /**
+     * Tests that all values will be written to the underlying store
+     * right in the same order as they were put into the store.
+     *
+     * @throws Exception If failed.
+     */
+    public void testBatchApply() throws Exception {
+        delegate = new GridCacheTestStore(new ConcurrentLinkedHashMap<Integer, String>());
+
+        initStore(1);
+
+        List<Integer> intList = new ArrayList<>(CACHE_SIZE);
+
+        try {
+            for (int i = 0; i < CACHE_SIZE; i++) {
+                store.write(new CacheEntryImpl<>(i, "val" + i));
+
+                intList.add(i);
+            }
+        }
+        finally {
+            shutdownStore();
+        }
+
+        Map<Integer, String> underlyingMap = delegate.getMap();
+
+        assertTrue("Store map key set: " + underlyingMap.keySet(), F.eqOrdered(underlyingMap.keySet(), intList));
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c6629012/modules/core/src/test/java/org/apache/ignite/loadtests/hashmap/GridCacheTestContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/loadtests/hashmap/GridCacheTestContext.java b/modules/core/src/test/java/org/apache/ignite/loadtests/hashmap/GridCacheTestContext.java
index 20a9caf..b277d48 100644
--- a/modules/core/src/test/java/org/apache/ignite/loadtests/hashmap/GridCacheTestContext.java
+++ b/modules/core/src/test/java/org/apache/ignite/loadtests/hashmap/GridCacheTestContext.java
@@ -25,6 +25,7 @@ import org.apache.ignite.internal.processors.cache.dr.*;
 import org.apache.ignite.internal.processors.cache.jta.*;
 import org.apache.ignite.internal.processors.cache.query.*;
 import org.apache.ignite.internal.processors.cache.query.continuous.*;
+import org.apache.ignite.internal.processors.cache.store.*;
 import org.apache.ignite.internal.processors.cache.transactions.*;
 import org.apache.ignite.internal.processors.cache.version.*;
 import org.apache.ignite.internal.processors.plugin.*;
@@ -59,10 +60,7 @@ public class GridCacheTestContext<K, V> extends GridCacheContext<K, V> {
             true,
             new GridCacheEventManager(),
             new GridCacheSwapManager(false),
-            new GridCacheStoreManager(null,
-                new IdentityHashMap<CacheStore, ThreadLocal>(),
-                null,
-                new CacheConfiguration()),
+            new CacheOsStoreManager(null, new CacheConfiguration()),
             new GridCacheEvictionManager(),
             new GridCacheLocalQueryManager<K, V>(),
             new CacheContinuousQueryManager(),
@@ -74,5 +72,7 @@ public class GridCacheTestContext<K, V> extends GridCacheContext<K, V> {
             new CacheOsConflictResolutionManager<K, V>(),
             new CachePluginManager(ctx, new CacheConfiguration())
         );
+
+        store().initialize(null, new IdentityHashMap<CacheStore, ThreadLocal>());
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c6629012/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheWriteBehindTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheWriteBehindTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheWriteBehindTestSuite.java
index 452dbf1..529b227 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheWriteBehindTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheWriteBehindTestSuite.java
@@ -19,9 +19,10 @@ package org.apache.ignite.testsuites;
 
 import junit.framework.*;
 import org.apache.ignite.internal.processors.cache.*;
+import org.apache.ignite.internal.processors.cache.store.*;
 
 /**
- * Test suite that contains all tests for {@link GridCacheWriteBehindStore}.
+ * Test suite that contains all tests for {@link org.apache.ignite.internal.processors.cache.store.GridCacheWriteBehindStore}.
  */
 public class IgniteCacheWriteBehindTestSuite extends TestSuite {
     /**


[26/37] incubator-ignite git commit: # GG-9973: Fixed.

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c6629012/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheWriteBehindStore.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheWriteBehindStore.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheWriteBehindStore.java
deleted file mode 100644
index c26c34e..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheWriteBehindStore.java
+++ /dev/null
@@ -1,1015 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache;
-
-import org.apache.ignite.*;
-import org.apache.ignite.cache.store.*;
-import org.apache.ignite.configuration.*;
-import org.apache.ignite.internal.*;
-import org.apache.ignite.internal.util.tostring.*;
-import org.apache.ignite.internal.util.typedef.*;
-import org.apache.ignite.internal.util.typedef.internal.*;
-import org.apache.ignite.internal.util.worker.*;
-import org.apache.ignite.lang.*;
-import org.apache.ignite.lifecycle.*;
-import org.apache.ignite.thread.*;
-import org.jetbrains.annotations.*;
-import org.jsr166.*;
-
-import javax.cache.integration.*;
-import java.util.*;
-import java.util.concurrent.*;
-import java.util.concurrent.atomic.*;
-import java.util.concurrent.locks.*;
-
-import static javax.cache.Cache.*;
-
-/**
- * Internal wrapper for a {@link CacheStore} that enables write-behind logic.
- * <p/>
- * The general purpose of this approach is to reduce cache store load under high
- * store update rate. The idea is to cache all write and remove operations in a pending
- * map and delegate these changes to the underlying store either after timeout or
- * if size of a pending map exceeded some pre-configured value. Another performance gain
- * is achieved due to combining a group of similar operations to a single batch update.
- * <p/>
- * The essential flush size for the write-behind cache should be at least the estimated
- * count of simultaneously written keys. In case of significantly smaller value there would
- * be triggered a lot of flush events that will result in a high cache store load.
- * <p/>
- * Since write operations to the cache store are deferred, transaction support is lost; no
- * transaction objects are passed to the underlying store.
- */
-public class GridCacheWriteBehindStore<K, V> implements CacheStore<K, V>, LifecycleAware {
-    /** Default write cache initial capacity. */
-    public static final int DFLT_INITIAL_CAPACITY = 1024;
-
-    /** Overflow ratio for critical cache size calculation. */
-    public static final float CACHE_OVERFLOW_RATIO = 1.5f;
-
-    /** Default concurrency level of write cache. */
-    public static final int DFLT_CONCUR_LVL = 64;
-
-    /** Write cache initial capacity. */
-    private int initCap = DFLT_INITIAL_CAPACITY;
-
-    /** Concurrency level for write cache access. */
-    private int concurLvl = DFLT_CONCUR_LVL;
-
-    /** When cache size exceeds this value eldest entry will be stored to the underlying store. */
-    private int cacheMaxSize = CacheConfiguration.DFLT_WRITE_BEHIND_FLUSH_SIZE;
-
-    /** Critical cache size. If cache size exceeds this value, data flush performed synchronously. */
-    private int cacheCriticalSize;
-
-    /** Count of worker threads performing underlying store updates. */
-    private int flushThreadCnt = CacheConfiguration.DFLT_WRITE_FROM_BEHIND_FLUSH_THREAD_CNT;
-
-    /** Cache flush frequency. All pending operations will be performed in not less then this value ms. */
-    private long cacheFlushFreq = CacheConfiguration.DFLT_WRITE_BEHIND_FLUSH_FREQUENCY;
-
-    /** Maximum batch size for put and remove operations */
-    private int batchSize = CacheConfiguration.DFLT_WRITE_BEHIND_BATCH_SIZE;
-
-    /** Grid name. */
-    private String gridName;
-
-    /** Cache name. */
-    private String cacheName;
-
-    /** Underlying store. */
-    private CacheStore<K, V> store;
-
-    /** Write cache. */
-    private ConcurrentLinkedHashMap<K, StatefulValue<K, V>> writeCache;
-
-    /** Flusher threads. */
-    private GridWorker[] flushThreads;
-
-    /** Atomic flag indicating store shutdown. */
-    private AtomicBoolean stopping = new AtomicBoolean(true);
-
-    /** Flush lock. */
-    private Lock flushLock = new ReentrantLock();
-
-    /** Condition to determine records available for flush. */
-    private Condition canFlush = flushLock.newCondition();
-
-    /** Variable for counting total cache overflows. */
-    private AtomicInteger cacheTotalOverflowCntr = new AtomicInteger();
-
-    /** Variable contains current number of overflow events. */
-    private AtomicInteger cacheOverflowCntr = new AtomicInteger();
-
-    /** Variable for counting key-value pairs that are in {@link ValueStatus#RETRY} state. */
-    private AtomicInteger retryEntriesCnt = new AtomicInteger();
-
-    /** Log. */
-    private IgniteLogger log;
-
-    /** Store manager. */
-    private GridCacheStoreManager storeMgr;
-
-    /**
-     * Creates a write-behind cache store for the given store.
-     *
-     * @param storeMgr Store manager.
-     * @param gridName Grid name.
-     * @param cacheName Cache name.
-     * @param log Grid logger.
-     * @param store {@code GridCacheStore} that need to be wrapped.
-     */
-    public GridCacheWriteBehindStore(
-        GridCacheStoreManager storeMgr,
-        String gridName,
-        String cacheName,
-        IgniteLogger log,
-        CacheStore<K, V> store) {
-        this.storeMgr = storeMgr;
-        this.gridName = gridName;
-        this.cacheName = cacheName;
-        this.log = log;
-        this.store = store;
-    }
-
-    /**
-     * Sets initial capacity for the write cache.
-     *
-     * @param initCap Initial capacity.
-     */
-    public void setInitialCapacity(int initCap) {
-        this.initCap = initCap;
-    }
-
-    /**
-     * Sets concurrency level for the write cache. Concurrency level is expected count of concurrent threads
-     * attempting to update cache.
-     *
-     * @param concurLvl Concurrency level.
-     */
-    public void setConcurrencyLevel(int concurLvl) {
-        this.concurLvl = concurLvl;
-    }
-
-    /**
-     * Sets the maximum size of the write cache. When the count of unique keys in write cache exceeds this value,
-     * the eldest entry in the cache is immediately scheduled for write to the underlying store.
-     *
-     * @param cacheMaxSize Max cache size.
-     */
-    public void setFlushSize(int cacheMaxSize) {
-        this.cacheMaxSize = cacheMaxSize;
-    }
-
-    /**
-     * Gets the maximum size of the write-behind buffer. When the count of unique keys
-     * in write buffer exceeds this value, the buffer is scheduled for write to the underlying store.
-     * <p/>
-     * If this value is {@code 0}, then flush is performed only on time-elapsing basis. However,
-     * when this value is {@code 0}, the cache critical size is set to
-     * {@link CacheConfiguration#DFLT_WRITE_BEHIND_CRITICAL_SIZE}
-     *
-     * @return Buffer size that triggers flush procedure.
-     */
-    public int getWriteBehindFlushSize() {
-        return cacheMaxSize;
-    }
-
-    /**
-     * Sets the number of threads that will perform store update operations.
-     *
-     * @param flushThreadCnt Count of worker threads.
-     */
-    public void setFlushThreadCount(int flushThreadCnt) {
-        this.flushThreadCnt = flushThreadCnt;
-    }
-
-    /**
-     * Gets the number of flush threads that will perform store update operations.
-     *
-     * @return Count of worker threads.
-     */
-    public int getWriteBehindFlushThreadCount() {
-        return flushThreadCnt;
-    }
-
-    /**
-     * Sets the cache flush frequency. All pending operations on the underlying store will be performed
-     * within time interval not less then this value.
-     *
-     * @param cacheFlushFreq Time interval value in milliseconds.
-     */
-    public void setFlushFrequency(long cacheFlushFreq) {
-        this.cacheFlushFreq = cacheFlushFreq;
-    }
-
-    /**
-     * Gets the cache flush frequency. All pending operations on the underlying store will be performed
-     * within time interval not less then this value.
-     * <p/>
-     * If this value is {@code 0}, then flush is performed only when buffer size exceeds flush size.
-     *
-     * @return Flush frequency in milliseconds.
-     */
-    public long getWriteBehindFlushFrequency() {
-        return cacheFlushFreq;
-    }
-
-    /**
-     * Sets the maximum count of similar operations that can be grouped to a single batch.
-     *
-     * @param batchSize Maximum count of batch.
-     */
-    public void setBatchSize(int batchSize) {
-        this.batchSize = batchSize;
-    }
-
-    /**
-     * Gets the maximum count of similar (put or remove) operations that can be grouped to a single batch.
-     *
-     * @return Maximum size of batch.
-     */
-    public int getWriteBehindStoreBatchSize() {
-        return batchSize;
-    }
-
-    /**
-     * Gets count of entries that were processed by the write-behind store and have not been
-     * flushed to the underlying store yet.
-     *
-     * @return Total count of entries in cache store internal buffer.
-     */
-    public int getWriteBehindBufferSize() {
-        return writeCache.sizex();
-    }
-
-    /**
-     * @return Underlying store.
-     */
-    public CacheStore<K, V> store() {
-        return store;
-    }
-
-    /**
-     * Performs all the initialization logic for write-behind cache store.
-     * This class must not be used until this method returns.
-     */
-    @Override public void start() {
-        assert cacheFlushFreq != 0 || cacheMaxSize != 0;
-
-        if (stopping.compareAndSet(true, false)) {
-            if (log.isDebugEnabled())
-                log.debug("Starting write-behind store for cache '" + cacheName + '\'');
-
-            cacheCriticalSize = (int)(cacheMaxSize * CACHE_OVERFLOW_RATIO);
-
-            if (cacheCriticalSize == 0)
-                cacheCriticalSize = CacheConfiguration.DFLT_WRITE_BEHIND_CRITICAL_SIZE;
-
-            flushThreads = new GridWorker[flushThreadCnt];
-
-            writeCache = new ConcurrentLinkedHashMap<>(initCap, 0.75f, concurLvl);
-
-            for (int i = 0; i < flushThreads.length; i++) {
-                flushThreads[i] = new Flusher(gridName, "flusher-" + i, log);
-
-                new IgniteThread(flushThreads[i]).start();
-            }
-        }
-    }
-
-    /**
-     * Gets count of write buffer overflow events since initialization. Each overflow event causes
-     * the ongoing flush operation to be performed synchronously.
-     *
-     * @return Count of cache overflow events since start.
-     */
-    public int getWriteBehindTotalCriticalOverflowCount() {
-        return cacheTotalOverflowCntr.get();
-    }
-
-    /**
-     * Gets count of write buffer overflow events in progress at the moment. Each overflow event causes
-     * the ongoing flush operation to be performed synchronously.
-     *
-     * @return Count of cache overflow events since start.
-     */
-    public int getWriteBehindCriticalOverflowCount() {
-        return cacheOverflowCntr.get();
-    }
-
-    /**
-     * Gets count of cache entries that are in a store-retry state. An entry is assigned a store-retry state
-     * when underlying store failed due some reason and cache has enough space to retain this entry till
-     * the next try.
-     *
-     * @return Count of entries in store-retry state.
-     */
-    public int getWriteBehindErrorRetryCount() {
-        return retryEntriesCnt.get();
-    }
-
-    /**
-     * Performs shutdown logic for store. No put, get and remove requests will be processed after
-     * this method is called.
-     */
-    @Override public void stop() {
-        if (stopping.compareAndSet(false, true)) {
-            if (log.isDebugEnabled())
-                log.debug("Stopping write-behind store for cache '" + cacheName + '\'');
-
-            wakeUp();
-
-            boolean graceful = true;
-
-            for (GridWorker worker : flushThreads)
-                graceful &= U.join(worker, log);
-
-            if (!graceful)
-                log.warning("Shutdown was aborted");
-        }
-    }
-
-    /**
-     * Forces all entries collected to be flushed to the underlying store.
-     * @throws IgniteCheckedException If failed.
-     */
-    public void forceFlush() throws IgniteCheckedException {
-        wakeUp();
-    }
-
-    /** {@inheritDoc} */
-    @Override public void loadCache(IgniteBiInClosure<K, V> clo, @Nullable Object... args) {
-        store.loadCache(clo, args);
-    }
-
-    /** {@inheritDoc} */
-    @Override public Map<K, V> loadAll(Iterable<? extends K> keys) {
-        if (log.isDebugEnabled())
-            log.debug("Store load all [keys=" + keys + ']');
-
-        Map<K, V> loaded = new HashMap<>();
-
-        Collection<K> remaining = new LinkedList<>();
-
-        for (K key : keys) {
-            StatefulValue<K, V> val = writeCache.get(key);
-
-            if (val != null) {
-                val.readLock().lock();
-
-                try {
-                    if (val.operation() == StoreOperation.PUT)
-                        loaded.put(key, val.entry().getValue());
-                    else
-                        assert val.operation() == StoreOperation.RMV : val.operation();
-                }
-                finally {
-                    val.readLock().unlock();
-                }
-            }
-            else
-                remaining.add(key);
-        }
-
-        // For items that were not found in queue.
-        if (!remaining.isEmpty()) {
-            Map<K, V> loaded0 = store.loadAll(remaining);
-
-            if (loaded0 != null)
-                loaded.putAll(loaded0);
-        }
-
-        return loaded;
-    }
-
-    /** {@inheritDoc} */
-    @Override public V load(K key) {
-        if (log.isDebugEnabled())
-            log.debug("Store load [key=" + key + ']');
-
-        StatefulValue<K, V> val = writeCache.get(key);
-
-        if (val != null) {
-            val.readLock().lock();
-
-            try {
-                switch (val.operation()) {
-                    case PUT:
-                        return val.entry().getValue();
-
-                    case RMV:
-                        return null;
-
-                    default:
-                        assert false : "Unexpected operation: " + val.status();
-                }
-            }
-            finally {
-                val.readLock().unlock();
-            }
-        }
-
-        return store.load(key);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void writeAll(Collection<Entry<? extends K, ? extends V>> entries) {
-        for (Entry<? extends K, ? extends V> e : entries)
-            write(e);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void write(Entry<? extends K, ? extends V> entry) {
-        try {
-            if (log.isDebugEnabled())
-                log.debug("Store put [key=" + entry.getKey() + ", val=" + entry.getValue() + ']');
-
-            updateCache(entry.getKey(), entry, StoreOperation.PUT);
-        }
-        catch (IgniteInterruptedCheckedException e) {
-            throw new CacheWriterException(U.convertExceptionNoWrap(e));
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public void deleteAll(Collection<?> keys) {
-        for (Object key : keys)
-            delete(key);
-    }
-
-    /** {@inheritDoc} */
-    @SuppressWarnings("unchecked")
-    @Override public void delete(Object key) {
-        try {
-            if (log.isDebugEnabled())
-                log.debug("Store remove [key=" + key + ']');
-
-            updateCache((K)key, null, StoreOperation.RMV);
-        }
-        catch (IgniteInterruptedCheckedException e) {
-            throw new CacheWriterException(U.convertExceptionNoWrap(e));
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public void sessionEnd(boolean commit) {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(GridCacheWriteBehindStore.class, this);
-    }
-
-    /**
-     * Performs flush-consistent cache update for the given key.
-     *
-     * @param key Key for which update is performed.
-     * @param val New value, may be null for remove operation.
-     * @param operation Updated value status
-     * @throws IgniteInterruptedCheckedException If interrupted while waiting for value to be flushed.
-     */
-    private void updateCache(K key,
-        @Nullable Entry<? extends K, ? extends V> val,
-        StoreOperation operation)
-        throws IgniteInterruptedCheckedException {
-        StatefulValue<K, V> newVal = new StatefulValue<>(val, operation);
-
-        StatefulValue<K, V> prev;
-
-        while ((prev = writeCache.putIfAbsent(key, newVal)) != null) {
-            prev.writeLock().lock();
-
-            try {
-                if (prev.status() == ValueStatus.PENDING) {
-                    // Flush process in progress, try again.
-                    prev.waitForFlush();
-
-                    continue;
-                }
-                else if (prev.status() == ValueStatus.FLUSHED)
-                    // This entry was deleted from map before we acquired the lock.
-                    continue;
-                else if (prev.status() == ValueStatus.RETRY)
-                    // New value has come, old value is no longer in RETRY state,
-                    retryEntriesCnt.decrementAndGet();
-
-                assert prev.status() == ValueStatus.NEW || prev.status() == ValueStatus.RETRY;
-
-                prev.update(val, operation, ValueStatus.NEW);
-
-                break;
-            }
-            finally {
-                prev.writeLock().unlock();
-            }
-        }
-
-        // Now check the map size
-        if (writeCache.sizex() > cacheCriticalSize)
-            // Perform single store update in the same thread.
-            flushSingleValue();
-        else if (cacheMaxSize > 0 && writeCache.sizex() > cacheMaxSize)
-            wakeUp();
-    }
-
-    /**
-     * Flushes one upcoming value to the underlying store. Called from
-     * {@link #updateCache(Object, Entry, StoreOperation)} method in case when current map size exceeds
-     * critical size.
-     */
-    private void flushSingleValue() {
-        cacheOverflowCntr.incrementAndGet();
-
-        try {
-            Map<K, StatefulValue<K, V>> batch = null;
-
-            for (Map.Entry<K, StatefulValue<K, V>> e : writeCache.entrySet()) {
-                StatefulValue<K, V> val = e.getValue();
-
-                val.writeLock().lock();
-
-                try {
-                    ValueStatus status = val.status();
-
-                    if (acquired(status))
-                        // Another thread is helping us, continue to the next entry.
-                        continue;
-
-                    if (val.status() == ValueStatus.RETRY)
-                        retryEntriesCnt.decrementAndGet();
-
-                    assert retryEntriesCnt.get() >= 0;
-
-                    val.status(ValueStatus.PENDING);
-
-                    batch = Collections.singletonMap(e.getKey(), val);
-                }
-                finally {
-                    val.writeLock().unlock();
-                }
-
-                if (!batch.isEmpty()) {
-                    applyBatch(batch, false);
-
-                    cacheTotalOverflowCntr.incrementAndGet();
-
-                    return;
-                }
-            }
-        }
-        finally {
-            cacheOverflowCntr.decrementAndGet();
-        }
-    }
-
-    /**
-     * Performs batch operation on underlying store.
-     *
-     * @param valMap Batch map.
-     * @param initSes {@code True} if need to initialize session.
-     */
-    private void applyBatch(Map<K, StatefulValue<K, V>> valMap, boolean initSes) {
-        assert valMap.size() <= batchSize;
-
-        StoreOperation operation = null;
-
-        // Construct a map for underlying store
-        Map<K, Entry<? extends K, ? extends V>> batch = U.newLinkedHashMap(valMap.size());
-
-        for (Map.Entry<K, StatefulValue<K, V>> e : valMap.entrySet()) {
-            if (operation == null)
-                operation = e.getValue().operation();
-
-            assert operation == e.getValue().operation();
-
-            assert e.getValue().status() == ValueStatus.PENDING;
-
-            batch.put(e.getKey(), e.getValue().entry());
-        }
-
-        if (updateStore(operation, batch, initSes)) {
-            for (Map.Entry<K, StatefulValue<K, V>> e : valMap.entrySet()) {
-                StatefulValue<K, V> val = e.getValue();
-
-                val.writeLock().lock();
-
-                try {
-                    val.status(ValueStatus.FLUSHED);
-
-                    StatefulValue<K, V> prev = writeCache.remove(e.getKey());
-
-                    // Additional check to ensure consistency.
-                    assert prev == val : "Map value for key " + e.getKey() + " was updated during flush";
-
-                    val.signalFlushed();
-                }
-                finally {
-                    val.writeLock().unlock();
-                }
-            }
-        }
-        else {
-            // Exception occurred, we must set RETRY status
-            for (StatefulValue<K, V> val : valMap.values()) {
-                val.writeLock().lock();
-
-                try {
-                    val.status(ValueStatus.RETRY);
-
-                    retryEntriesCnt.incrementAndGet();
-
-                    val.signalFlushed();
-                }
-                finally {
-                    val.writeLock().unlock();
-                }
-            }
-        }
-    }
-
-    /**
-     * Tries to update store with the given values and returns {@code true} in case of success.
-     *
-     * <p/> If any exception in underlying store is occurred, this method checks the map size.
-     * If map size exceeds some critical value, then it returns {@code true} and this value will
-     * be lost. If map size does not exceed critical value, it will return false and value will
-     * be retained in write cache.
-     *
-     * @param operation Status indicating operation that should be performed.
-     * @param vals Key-Value map.
-     * @param initSes {@code True} if need to initialize session.
-     * @return {@code true} if value may be deleted from the write cache,
-     *         {@code false} otherwise
-     */
-    private boolean updateStore(StoreOperation operation,
-        Map<K, Entry<? extends K, ? extends  V>> vals,
-        boolean initSes) {
-
-        if (initSes && storeMgr != null)
-            storeMgr.initSession(null);
-
-        try {
-            boolean threwEx = true;
-
-            try {
-                switch (operation) {
-                    case PUT:
-                        store.writeAll(vals.values());
-
-                        break;
-
-                    case RMV:
-                        store.deleteAll(vals.keySet());
-
-                        break;
-
-                    default:
-                        assert false : "Unexpected operation: " + operation;
-                }
-
-                threwEx = false;
-
-                return true;
-            }
-            finally {
-                if (initSes && storeMgr != null)
-                    storeMgr.endSession(null, threwEx);
-            }
-        }
-        catch (Exception e) {
-            LT.warn(log, e, "Unable to update underlying store: " + store);
-
-            if (writeCache.sizex() > cacheCriticalSize || stopping.get()) {
-                for (Map.Entry<K, Entry<? extends K, ? extends  V>> entry : vals.entrySet()) {
-                    Object val = entry.getValue() != null ? entry.getValue().getValue() : null;
-
-                    log.warning("Failed to update store (value will be lost as current buffer size is greater " +
-                        "than 'cacheCriticalSize' or node has been stopped before store was repaired) [key=" +
-                        entry.getKey() + ", val=" + val + ", op=" + operation + "]");
-                }
-
-                return true;
-            }
-
-            return false;
-        }
-    }
-
-    /**
-     * Wakes up flushing threads if map size exceeded maximum value or in case of shutdown.
-     */
-    private void wakeUp() {
-        flushLock.lock();
-
-        try {
-            canFlush.signalAll();
-        }
-        finally {
-            flushLock.unlock();
-        }
-    }
-
-    /**
-     * Thread that performs time-based flushing of written values to the underlying storage.
-     */
-    private class Flusher extends GridWorker {
-        /** {@inheritDoc */
-        protected Flusher(String gridName, String name, IgniteLogger log) {
-            super(gridName, name, log);
-        }
-
-        /** {@inheritDoc} */
-        @Override protected void body() throws InterruptedException, IgniteInterruptedCheckedException {
-            while (!stopping.get() || writeCache.sizex() > 0) {
-                awaitOperationsAvailable();
-
-                flushCache(writeCache.entrySet().iterator());
-            }
-        }
-
-        /**
-         * This method awaits until enough elements in map are available or given timeout is over.
-         *
-         * @throws InterruptedException If awaiting was interrupted.
-         */
-        private void awaitOperationsAvailable() throws InterruptedException {
-            flushLock.lock();
-
-            try {
-                do {
-                    if (writeCache.sizex() <= cacheMaxSize || cacheMaxSize == 0) {
-                        if (cacheFlushFreq > 0)
-                            canFlush.await(cacheFlushFreq, TimeUnit.MILLISECONDS);
-                        else
-                            canFlush.await();
-                    }
-                }
-                while (writeCache.sizex() == 0 && !stopping.get());
-            }
-            finally {
-                flushLock.unlock();
-            }
-        }
-
-        /**
-         * Removes values from the write cache and performs corresponding operation
-         * on the underlying store.
-         *
-         * @param it Iterator for write cache.
-         */
-        private void flushCache(Iterator<Map.Entry<K,StatefulValue<K, V>>> it) {
-            StoreOperation operation = null;
-
-            Map<K, StatefulValue<K, V>> batch = null;
-            Map<K, StatefulValue<K, V>> pending  = U.newLinkedHashMap(batchSize);
-
-            while (it.hasNext()) {
-                Map.Entry<K, StatefulValue<K, V>> e = it.next();
-
-                StatefulValue<K, V> val = e.getValue();
-
-                val.writeLock().lock();
-
-                try {
-                    ValueStatus status = val.status();
-
-                    if (acquired(status))
-                        // Another thread is helping us, continue to the next entry.
-                        continue;
-
-                    if (status == ValueStatus.RETRY)
-                        retryEntriesCnt.decrementAndGet();
-
-                    assert retryEntriesCnt.get() >= 0;
-
-                    val.status(ValueStatus.PENDING);
-
-                    // We scan for the next operation and apply batch on operation change. Null means new batch.
-                    if (operation == null)
-                        operation = val.operation();
-
-                    if (operation != val.operation()) {
-                        // Operation is changed, so we need to perform a batch.
-                        batch = pending;
-                        pending = U.newLinkedHashMap(batchSize);
-
-                        operation = val.operation();
-
-                        pending.put(e.getKey(), val);
-                    }
-                    else
-                        pending.put(e.getKey(), val);
-
-                    if (pending.size() == batchSize) {
-                        batch = pending;
-                        pending = U.newLinkedHashMap(batchSize);
-
-                        operation = null;
-                    }
-                }
-                finally {
-                    val.writeLock().unlock();
-                }
-
-                if (batch != null && !batch.isEmpty()) {
-                    applyBatch(batch, true);
-                    batch = null;
-                }
-            }
-
-            // Process the remainder.
-            if (!pending.isEmpty())
-                applyBatch(pending, true);
-        }
-    }
-
-    /**
-     * For test purposes only.
-     *
-     * @return Write cache for the underlying store operations.
-     */
-    Map<K, StatefulValue<K, V>> writeCache() {
-        return writeCache;
-    }
-
-    /**
-     * Enumeration that represents possible operations on the underlying store.
-     */
-    private enum StoreOperation {
-        /** Put key-value pair to the underlying store. */
-        PUT,
-
-        /** Remove key from the underlying store. */
-        RMV
-    }
-
-    /**
-     * Enumeration that represents possible states of value in the map.
-     */
-    private enum ValueStatus {
-        /** Value is scheduled for write or delete from the underlying cache but has not been captured by flusher. */
-        NEW,
-
-        /** Value is captured by flusher and store operation is performed at the moment. */
-        PENDING,
-
-        /** Store operation has failed and it will be re-tried at the next flush. */
-        RETRY,
-
-        /** Store operation succeeded and this value will be removed by flusher. */
-        FLUSHED,
-    }
-
-    /**
-     * Checks if given status indicates pending or complete flush operation.
-     *
-     * @param status Status to check.
-     * @return {@code true} if status indicates any pending or complete store update operation.
-     */
-    private boolean acquired(ValueStatus status) {
-        return status == ValueStatus.PENDING || status == ValueStatus.FLUSHED;
-    }
-
-    /**
-     * A state-value-operation trio.
-     *
-     * @param <V> Value type.
-     */
-    private static class StatefulValue<K, V> extends ReentrantReadWriteLock {
-        /** */
-        private static final long serialVersionUID = 0L;
-
-        /** Value. */
-        @GridToStringInclude
-        private Entry<? extends K, ? extends V> val;
-
-        /** Store operation. */
-        private StoreOperation storeOperation;
-
-        /** Value status. */
-        private ValueStatus valStatus;
-
-        /** Condition to wait for flush event */
-        private Condition flushCond = writeLock().newCondition();
-
-        /**
-         * Creates a state-value pair with {@link ValueStatus#NEW} status.
-         *
-         * @param val Value.
-         * @param storeOperation Store operation.
-         */
-        private StatefulValue(Entry<? extends K, ? extends V> val, StoreOperation storeOperation) {
-            assert storeOperation == StoreOperation.PUT || storeOperation == StoreOperation.RMV;
-
-            this.val = val;
-            this.storeOperation = storeOperation;
-            valStatus = ValueStatus.NEW;
-        }
-
-        /**
-         * @return Stored value.
-         */
-        private Entry<? extends K, ? extends V> entry() {
-            return val;
-        }
-
-        /**
-         * @return Store operation.
-         */
-        private StoreOperation operation() {
-            return storeOperation;
-        }
-
-        /**
-         * @return Value status
-         */
-        private ValueStatus status() {
-            return valStatus;
-        }
-
-        /**
-         * Updates value status.
-         *
-         * @param valStatus Value status.
-         */
-        private void status(ValueStatus valStatus) {
-            this.valStatus = valStatus;
-        }
-
-        /**
-         * Updates both value and value status.
-         *
-         * @param val Value.
-         * @param storeOperation Store operation.
-         * @param valStatus Value status.
-         */
-        private void update(@Nullable Entry<? extends K, ? extends V> val,
-            StoreOperation storeOperation,
-            ValueStatus valStatus) {
-            this.val = val;
-            this.storeOperation = storeOperation;
-            this.valStatus = valStatus;
-        }
-
-        /**
-         * Awaits a signal on flush condition
-         *
-         * @throws IgniteInterruptedCheckedException If thread was interrupted.
-         */
-        private void waitForFlush() throws IgniteInterruptedCheckedException {
-            U.await(flushCond);
-        }
-
-        /**
-         * Signals flush condition.
-         */
-        @SuppressWarnings({"SignalWithoutCorrespondingAwait"})
-        private void signalFlushed() {
-            flushCond.signalAll();
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean equals(Object o) {
-            if (this == o)
-                return true;
-
-            if (!(o instanceof StatefulValue))
-                return false;
-
-            StatefulValue other = (StatefulValue)o;
-
-            return F.eq(val, other.val) && F.eq(valStatus, other.valStatus);
-        }
-
-        /** {@inheritDoc} */
-        @Override public int hashCode() {
-            int res = val != null ? val.hashCode() : 0;
-
-            res = 31 * res + valStatus.hashCode();
-
-            return res;
-        }
-
-        /** {@inheritDoc} */
-        @Override public String toString() {
-            return S.toString(StatefulValue.class, this);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c6629012/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
index 6c27566..f2dd0c4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
@@ -360,7 +360,7 @@ public abstract class GridDhtCacheAdapter<K, V> extends GridDistributedCacheAdap
     /** {@inheritDoc} */
     @Override public void localLoad(Collection<? extends K> keys, final ExpiryPolicy plc)
         throws IgniteCheckedException {
-        if (ctx.store().isLocalStore()) {
+        if (ctx.store().isLocal()) {
             super.localLoad(keys, plc);
 
             return;
@@ -377,7 +377,7 @@ public abstract class GridDhtCacheAdapter<K, V> extends GridDistributedCacheAdap
 
         Collection<KeyCacheObject> keys0 = ctx.cacheKeysView(keys);
 
-        ctx.store().loadAllFromStore(null, keys0, new CI2<KeyCacheObject, Object>() {
+        ctx.store().loadAll(null, keys0, new CI2<KeyCacheObject, Object>() {
             @Override public void apply(KeyCacheObject key, Object val) {
                 loadEntry(key, val, ver0, null, topVer, replicate, plc0);
             }
@@ -386,7 +386,7 @@ public abstract class GridDhtCacheAdapter<K, V> extends GridDistributedCacheAdap
 
     /** {@inheritDoc} */
     @Override public void localLoadCache(final IgniteBiPredicate<K, V> p, Object[] args) throws IgniteCheckedException {
-        if (ctx.store().isLocalStore()) {
+        if (ctx.store().isLocal()) {
             super.localLoadCache(p, args);
 
             return;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c6629012/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheEntry.java
index 7195d1c..e6d5173 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheEntry.java
@@ -564,8 +564,8 @@ public class GridDhtCacheEntry extends GridDistributedCacheEntry {
                         log.debug("Entry has been cleared from swap storage: " + this);
                 }
 
-                if (cctx.store().isLocalStore())
-                    cctx.store().removeFromStore(null, keyValue(false));
+                if (cctx.store().isLocal())
+                    cctx.store().remove(null, keyValue(false));
 
                 rmv = true;
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c6629012/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
index 4e72bd1..c433698 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
@@ -494,7 +494,7 @@ public class GridDhtLocalPartition implements Comparable<GridDhtLocalPartition>
         try {
             GridCloseableIterator<Map.Entry<byte[], GridCacheSwapEntry>> it = cctx.swap().iterator(id);
 
-            boolean isLocStore = cctx.store().isLocalStore();
+            boolean isLocStore = cctx.store().isLocal();
 
             if (it != null) {
                 // We can safely remove these values because no entries will be created for evicted partition.
@@ -508,7 +508,7 @@ public class GridDhtLocalPartition implements Comparable<GridDhtLocalPartition>
                     cctx.swap().remove(key);
 
                     if (isLocStore)
-                        cctx.store().removeFromStore(null, key.value(cctx.cacheObjectContext(), false));
+                        cctx.store().remove(null, key.value(cctx.cacheObjectContext(), false));
                 }
             }
         }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c6629012/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java
index 99fb724..7e93946 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java
@@ -945,7 +945,7 @@ public final class GridDhtLockFuture<K, V> extends GridCompoundIdentityFuture<Bo
             }
 
             try {
-                cctx.store().loadAllFromStore(
+                cctx.store().loadAll(
                     null,
                     loadMap.keySet(),
                     new CI2<KeyCacheObject, Object>() {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c6629012/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
index c376fa0..5e8a1f5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
@@ -1135,7 +1135,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
 
                         if (keys.size() > 1 &&                             // Several keys ...
                             writeThrough() &&                              // and store is enabled ...
-                            !ctx.store().isLocalStore() &&                 // and this is not local store ...
+                            !ctx.store().isLocal() &&                 // and this is not local store ...
                             !ctx.dr().receiveEnabled()                     // and no DR.
                         ) {
                             // This method can only be used when there are no replicated entries in the batch.
@@ -1614,7 +1614,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
         if (needReload != null) {
             final Map<KeyCacheObject, Integer> idxMap = needReload;
 
-            ctx.store().loadAllFromStore(null, needReload.keySet(), new CI2<KeyCacheObject, Object>() {
+            ctx.store().loadAll(null, needReload.keySet(), new CI2<KeyCacheObject, Object>() {
                 @Override public void apply(KeyCacheObject k, Object v) {
                     Integer idx = idxMap.get(k);
 
@@ -1917,7 +1917,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
                     putMap;
 
                 try {
-                    ctx.store().putAllToStore(null, F.viewReadOnly(storeMap, new C1<Object, IgniteBiTuple<Object, GridCacheVersion>>() {
+                    ctx.store().putAll(null, F.viewReadOnly(storeMap, new C1<Object, IgniteBiTuple<Object, GridCacheVersion>>() {
                         @Override public IgniteBiTuple<Object, GridCacheVersion> apply(Object v) {
                             return F.t(v, ver);
                         }
@@ -1940,7 +1940,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
                     rmvKeys;
 
                 try {
-                    ctx.store().removeAllFromStore(null, storeKeys);
+                    ctx.store().removeAll(null, storeKeys);
                 }
                 catch (CacheStorePartialUpdateException e) {
                     storeErr = e;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c6629012/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
index a9a6f23..98d9283 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
@@ -1306,7 +1306,7 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
         try {
             if (putMap != null) {
                 try {
-                    ctx.store().putAllToStore(null, F.viewReadOnly(putMap, new C1<Object, IgniteBiTuple<Object, GridCacheVersion>>() {
+                    ctx.store().putAll(null, F.viewReadOnly(putMap, new C1<Object, IgniteBiTuple<Object, GridCacheVersion>>() {
                         @Override public IgniteBiTuple<Object, GridCacheVersion> apply(Object v) {
                             return F.t(v, ver);
                         }
@@ -1320,7 +1320,7 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
             }
             else {
                 try {
-                    ctx.store().removeAllFromStore(null, rmvKeys);
+                    ctx.store().removeAll(null, rmvKeys);
                 }
                 catch (CacheStorePartialUpdateException e) {
                     storeErr = e;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c6629012/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/CacheOsStoreManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/CacheOsStoreManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/CacheOsStoreManager.java
new file mode 100644
index 0000000..5fde622
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/CacheOsStoreManager.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.store;
+
+import org.apache.ignite.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.internal.*;
+
+/**
+ * Default store manager implementation.
+ */
+public class CacheOsStoreManager extends GridCacheStoreManagerAdapter {
+    /** Ignite context. */
+    private final GridKernalContext ctx;
+
+    /** Cache configuration. */
+    private final CacheConfiguration cfg;
+
+    /**
+     * Constructor.
+     *
+     * @param ctx Ignite context.
+     * @param cfg Cache configuration.
+     */
+    public CacheOsStoreManager(GridKernalContext ctx, CacheConfiguration cfg) {
+        this.ctx = ctx;
+        this.cfg = cfg;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected GridKernalContext igniteContext() {
+        return ctx;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected CacheConfiguration cacheConfiguration() {
+        return cfg;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected boolean convertPortable() {
+        return true;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c6629012/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/CacheStoreManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/CacheStoreManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/CacheStoreManager.java
new file mode 100644
index 0000000..d9f50ac
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/CacheStoreManager.java
@@ -0,0 +1,182 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.store;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.store.*;
+import org.apache.ignite.internal.processors.cache.*;
+import org.apache.ignite.internal.processors.cache.transactions.*;
+import org.apache.ignite.internal.processors.cache.version.*;
+import org.apache.ignite.internal.util.lang.*;
+import org.apache.ignite.lang.*;
+import org.jetbrains.annotations.*;
+
+import java.util.*;
+
+/**
+ * Cache store manager interface.
+ */
+public interface CacheStoreManager<K, V> extends GridCacheManager<K, V> {
+    /**
+     * Initialize store manager.
+     *
+     * @param cfgStore   Actual store.
+     * @param sesHolders Session holders.
+     * @throws org.apache.ignite.IgniteCheckedException If failed.
+     */
+    public void initialize(@Nullable CacheStore<?, ?> cfgStore, Map<CacheStore, ThreadLocal> sesHolders)
+        throws IgniteCheckedException;
+
+    /**
+     * @return {@code true} If store configured.
+     */
+    public boolean configured();
+
+    /**
+     * @return Wrapped store.
+     */
+    public CacheStore<Object, Object> store();
+
+    /**
+     * @return Unwrapped store provided in configuration.
+     */
+    public CacheStore<?, ?> configuredStore();
+
+    /**
+     * @return {@code true} If local store is configured.
+     */
+    public boolean isLocal();
+
+    /**
+     * @return {@code True} is write-through is enabled.
+     */
+    public boolean isWriteThrough();
+
+    /**
+     * @return Whether DHT transaction can write to store from DHT.
+     */
+    public boolean isWriteToStoreFromDht();
+
+    /**
+     * Loads data from persistent store.
+     *
+     * @param tx Cache transaction.
+     * @param key Cache key.
+     * @return Loaded value, possibly <tt>null</tt>.
+     * @throws IgniteCheckedException If data loading failed.
+     */
+    @Nullable public Object load(@Nullable IgniteInternalTx tx, KeyCacheObject key) throws IgniteCheckedException;
+
+    /**
+     * Loads data from persistent store.
+     *
+     * @param tx Cache transaction.
+     * @param keys Cache keys.
+     * @param vis Closure.
+     * @return {@code True} if there is a persistent storage.
+     * @throws IgniteCheckedException If data loading failed.
+     */
+    public boolean loadAll(@Nullable IgniteInternalTx tx, Collection<? extends KeyCacheObject> keys,
+        IgniteBiInClosure<KeyCacheObject, Object> vis) throws IgniteCheckedException;
+
+    /**
+     * @param tx Cache transaction.
+     * @param keys Cache keys.
+     * @param vis Closure to apply for loaded elements.
+     * @throws IgniteCheckedException If data loading failed.
+     */
+    public void localStoreLoadAll(@Nullable IgniteInternalTx tx, Collection<? extends KeyCacheObject> keys,
+        final GridInClosure3<KeyCacheObject, Object, GridCacheVersion> vis) throws IgniteCheckedException;
+
+    /**
+     * Loads data from persistent store.
+     *
+     * @param vis Closer to cache loaded elements.
+     * @param args User arguments.
+     * @return {@code True} if there is a persistent storage.
+     * @throws IgniteCheckedException If data loading failed.
+     */
+    public boolean loadCache(final GridInClosure3<KeyCacheObject, Object, GridCacheVersion> vis, Object[] args)
+        throws IgniteCheckedException;
+
+    /**
+     * Puts key-value pair into storage.
+     *
+     * @param tx Cache transaction.
+     * @param key Key.
+     * @param val Value.
+     * @param ver Version.
+     * @return {@code true} If there is a persistent storage.
+     * @throws IgniteCheckedException If storage failed.
+     */
+    public boolean put(@Nullable IgniteInternalTx tx, Object key, Object val, GridCacheVersion ver)
+        throws IgniteCheckedException;
+
+    /**
+     * Puts key-value pair into storage.
+     *
+     * @param tx Cache transaction.
+     * @param map Map.
+     * @return {@code True} if there is a persistent storage.
+     * @throws IgniteCheckedException If storage failed.
+     */
+    public boolean putAll(@Nullable IgniteInternalTx tx, Map<Object, IgniteBiTuple<Object, GridCacheVersion>> map)
+        throws IgniteCheckedException;
+
+    /**
+     * @param tx Cache transaction.
+     * @param key Key.
+     * @return {@code True} if there is a persistent storage.
+     * @throws IgniteCheckedException If storage failed.
+     */
+    public boolean remove(@Nullable IgniteInternalTx tx, Object key) throws IgniteCheckedException;
+
+    /**
+     * @param tx Cache transaction.
+     * @param keys Key.
+     * @return {@code True} if there is a persistent storage.
+     * @throws IgniteCheckedException If storage failed.
+     */
+    public boolean removeAll(@Nullable IgniteInternalTx tx, Collection<Object> keys)
+        throws IgniteCheckedException;
+
+    /**
+     * @param tx Transaction.
+     * @param commit Commit.
+     * @throws IgniteCheckedException If failed.
+     */
+    public void sessionEnd(IgniteInternalTx tx, boolean commit) throws IgniteCheckedException;
+
+    /**
+     * End session initiated by write-behind store.
+     */
+    public void writeBehindSessionInit();
+
+    /**
+     * End session initiated by write-behind store.
+     *
+     * @param threwEx If exception was thrown.
+     * @throws IgniteCheckedException If failed.
+     */
+    public void writeBehindSessionEnd(boolean threwEx) throws IgniteCheckedException;
+
+    /**
+     * @throws IgniteCheckedException If failed.
+     */
+    public void forceFlush() throws IgniteCheckedException;
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c6629012/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheStoreManagerAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheStoreManagerAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheStoreManagerAdapter.java
new file mode 100644
index 0000000..f9a966c
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheStoreManagerAdapter.java
@@ -0,0 +1,1111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.store;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.store.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.internal.*;
+import org.apache.ignite.internal.processors.cache.*;
+import org.apache.ignite.internal.processors.cache.transactions.*;
+import org.apache.ignite.internal.processors.cache.version.*;
+import org.apache.ignite.internal.util.*;
+import org.apache.ignite.internal.util.lang.*;
+import org.apache.ignite.internal.util.tostring.*;
+import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.lang.*;
+import org.apache.ignite.lifecycle.*;
+import org.apache.ignite.transactions.*;
+import org.jetbrains.annotations.*;
+
+import javax.cache.*;
+import javax.cache.integration.*;
+import java.util.*;
+
+/**
+ * Store manager.
+ */
+@SuppressWarnings({"AssignmentToCatchBlockParameter", "unchecked"})
+public abstract class GridCacheStoreManagerAdapter extends GridCacheManagerAdapter implements CacheStoreManager {
+    /** */
+    private static final UUID SES_ATTR = UUID.randomUUID();
+
+    /** */
+    protected CacheStore<Object, Object> store;
+
+    /** */
+    protected CacheStore<?, ?> cfgStore;
+
+    /** */
+    private CacheStoreBalancingWrapper<Object, Object> singleThreadGate;
+
+    /** */
+    private ThreadLocal<SessionData> sesHolder;
+
+    /** */
+    private boolean locStore;
+
+    /** */
+    private boolean writeThrough;
+
+    /** {@inheritDoc} */
+    @SuppressWarnings("unchecked")
+    @Override public void initialize(@Nullable CacheStore cfgStore, Map sesHolders) throws IgniteCheckedException {
+        GridKernalContext ctx = igniteContext();
+        CacheConfiguration cfg = cacheConfiguration();
+
+        writeThrough = cfg.isWriteThrough();
+
+        this.cfgStore = cfgStore;
+
+        store = cacheStoreWrapper(ctx, cfgStore, cfg);
+
+        singleThreadGate = store == null ? null : new CacheStoreBalancingWrapper<>(store);
+
+        ThreadLocal<SessionData> sesHolder0 = null;
+
+        if (cfgStore != null) {
+            sesHolder0 = ((Map<CacheStore, ThreadLocal>)sesHolders).get(cfgStore);
+
+            if (sesHolder0 == null) {
+                ThreadLocalSession locSes = new ThreadLocalSession();
+
+                if (ctx.resource().injectStoreSession(cfgStore, locSes)) {
+                    sesHolder0 = locSes.sesHolder;
+
+                    sesHolders.put(cfgStore, sesHolder0);
+                }
+            }
+        }
+
+        sesHolder = sesHolder0;
+
+        locStore = U.hasAnnotation(cfgStore, CacheLocalStore.class);
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isWriteThrough() {
+        return writeThrough;
+    }
+
+    /**
+     * Creates a wrapped cache store if write-behind cache is configured.
+     *
+     * @param ctx Kernal context.
+     * @param cfgStore Store provided in configuration.
+     * @param cfg Cache configuration.
+     * @return Instance if {@link GridCacheWriteBehindStore} if write-behind store is configured,
+     *         or user-defined cache store.
+     */
+    @SuppressWarnings({"unchecked"})
+    private CacheStore cacheStoreWrapper(GridKernalContext ctx,
+        @Nullable CacheStore cfgStore,
+        CacheConfiguration cfg) {
+        if (cfgStore == null || !cfg.isWriteBehindEnabled())
+            return cfgStore;
+
+        GridCacheWriteBehindStore store = new GridCacheWriteBehindStore(this,
+            ctx.gridName(),
+            cfg.getName(),
+            ctx.log(GridCacheWriteBehindStore.class),
+            cfgStore);
+
+        store.setFlushSize(cfg.getWriteBehindFlushSize());
+        store.setFlushThreadCount(cfg.getWriteBehindFlushThreadCount());
+        store.setFlushFrequency(cfg.getWriteBehindFlushFrequency());
+        store.setBatchSize(cfg.getWriteBehindBatchSize());
+
+        return store;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void start0() throws IgniteCheckedException {
+        if (store instanceof LifecycleAware) {
+            try {
+                // Avoid second start() call on store in case when near cache is enabled.
+                if (cctx.config().isWriteBehindEnabled()) {
+                    if (!cctx.isNear())
+                        ((LifecycleAware)store).start();
+                }
+            }
+            catch (Exception e) {
+                throw new IgniteCheckedException("Failed to start cache store: " + e, e);
+            }
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void stop0(boolean cancel) {
+        if (store instanceof LifecycleAware) {
+            try {
+                // Avoid second start() call on store in case when near cache is enabled.
+                if (cctx.config().isWriteBehindEnabled()) {
+                    if (!cctx.isNear())
+                        ((LifecycleAware)store).stop();
+                }
+            }
+            catch (Exception e) {
+                U.error(log(), "Failed to stop cache store.", e);
+            }
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isLocal() {
+        return locStore;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean configured() {
+        return store != null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public CacheStore<?, ?> configuredStore() {
+        return cfgStore;
+    }
+
+    /** {@inheritDoc} */
+    @Override @Nullable public Object load(@Nullable IgniteInternalTx tx, KeyCacheObject key)
+        throws IgniteCheckedException {
+        return loadFromStore(tx, key, true);
+    }
+
+    /**
+     * Loads data from persistent store.
+     *
+     * @param tx Cache transaction.
+     * @param key Cache key.
+     * @param convert Convert flag.
+     * @return Loaded value, possibly <tt>null</tt>.
+     * @throws IgniteCheckedException If data loading failed.
+     */
+    @Nullable private Object loadFromStore(@Nullable IgniteInternalTx tx,
+        KeyCacheObject key,
+        boolean convert)
+        throws IgniteCheckedException {
+        if (store != null) {
+            if (key.internal())
+                // Never load internal keys from store as they are never persisted.
+                return null;
+
+            Object storeKey = key.value(cctx.cacheObjectContext(), false);
+
+            if (convertPortable())
+                storeKey = cctx.unwrapPortableIfNeeded(storeKey, false);
+
+            if (log.isDebugEnabled())
+                log.debug("Loading value from store for key: " + storeKey);
+
+            sessionInit0(tx);
+
+            boolean thewEx = true;
+
+            Object val = null;
+
+            try {
+                val = singleThreadGate.load(storeKey);
+
+                thewEx = false;
+            }
+            catch (ClassCastException e) {
+                handleClassCastException(e);
+            }
+            catch (CacheLoaderException e) {
+                throw new IgniteCheckedException(e);
+            }
+            catch (Exception e) {
+                throw new IgniteCheckedException(new CacheLoaderException(e));
+            }
+            finally {
+                sessionEnd0(tx, thewEx);
+            }
+
+            if (log.isDebugEnabled())
+                log.debug("Loaded value from store [key=" + key + ", val=" + val + ']');
+
+            if (convert) {
+                val = convert(val);
+
+                return val;
+            }
+            else
+                return val;
+        }
+
+        return null;
+    }
+
+    /**
+     * @param val Internal value.
+     * @return User value.
+     */
+    private Object convert(Object val) {
+        if (val == null)
+            return null;
+
+        return locStore ? ((IgniteBiTuple<Object, GridCacheVersion>)val).get1() : val;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isWriteToStoreFromDht() {
+        return cctx.config().isWriteBehindEnabled() || locStore;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void localStoreLoadAll(@Nullable IgniteInternalTx tx, Collection keys, GridInClosure3 vis)
+        throws IgniteCheckedException {
+        assert store != null;
+        assert locStore;
+
+        loadAllFromStore(tx, keys, null, vis);
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean loadAll(@Nullable IgniteInternalTx tx, Collection keys, IgniteBiInClosure vis)
+        throws IgniteCheckedException {
+        if (store != null) {
+            loadAllFromStore(tx, keys, vis, null);
+
+            return true;
+        }
+        else {
+            for (Object key : keys)
+                vis.apply(key, null);
+        }
+
+        return false;
+    }
+
+    /**
+     * @param tx Cache transaction.
+     * @param keys Keys to load.
+     * @param vis Key/value closure (only one of vis or verVis can be specified).
+     * @param verVis Key/value/version closure (only one of vis or verVis can be specified).
+     * @throws IgniteCheckedException If failed.
+     */
+    private void loadAllFromStore(@Nullable IgniteInternalTx tx,
+        Collection<? extends KeyCacheObject> keys,
+        @Nullable final IgniteBiInClosure<KeyCacheObject, Object> vis,
+        @Nullable final GridInClosure3<KeyCacheObject, Object, GridCacheVersion> verVis)
+        throws IgniteCheckedException {
+        assert vis != null ^ verVis != null;
+        assert verVis == null || locStore;
+
+        final boolean convert = verVis == null;
+
+        if (!keys.isEmpty()) {
+            if (keys.size() == 1) {
+                KeyCacheObject key = F.first(keys);
+
+                if (convert)
+                    vis.apply(key, load(tx, key));
+                else {
+                    IgniteBiTuple<Object, GridCacheVersion> t =
+                        (IgniteBiTuple<Object, GridCacheVersion>)loadFromStore(tx, key, false);
+
+                    if (t != null)
+                        verVis.apply(key, t.get1(), t.get2());
+                }
+
+                return;
+            }
+
+            Collection<Object> keys0;
+
+            if (convertPortable()) {
+                keys0 = F.viewReadOnly(keys, new C1<KeyCacheObject, Object>() {
+                    @Override public Object apply(KeyCacheObject key) {
+                        return cctx.unwrapPortableIfNeeded(key.value(cctx.cacheObjectContext(), false), false);
+                    }
+                });
+            }
+            else {
+                keys0 = F.viewReadOnly(keys, new C1<KeyCacheObject, Object>() {
+                    @Override public Object apply(KeyCacheObject key) {
+                        return key.value(cctx.cacheObjectContext(), false);
+                    }
+                });
+            }
+
+            if (log.isDebugEnabled())
+                log.debug("Loading values from store for keys: " + keys0);
+
+            sessionInit0(tx);
+
+            boolean thewEx = true;
+
+            try {
+                IgniteBiInClosure<Object, Object> c = new CI2<Object, Object>() {
+                    @SuppressWarnings("ConstantConditions")
+                    @Override public void apply(Object k, Object val) {
+                        if (convert) {
+                            Object v = convert(val);
+
+                            vis.apply(cctx.toCacheKeyObject(k), v);
+                        }
+                        else {
+                            IgniteBiTuple<Object, GridCacheVersion> v = (IgniteBiTuple<Object, GridCacheVersion>)val;
+
+                            if (v != null)
+                                verVis.apply(cctx.toCacheKeyObject(k), v.get1(), v.get2());
+                        }
+                    }
+                };
+
+                if (keys.size() > singleThreadGate.loadAllThreshold()) {
+                    Map<Object, Object> map = store.loadAll(keys0);
+
+                    if (map != null) {
+                        for (Map.Entry<Object, Object> e : map.entrySet())
+                            c.apply(cctx.toCacheKeyObject(e.getKey()), e.getValue());
+                    }
+                }
+                else
+                    singleThreadGate.loadAll(keys0, c);
+
+                thewEx = false;
+            }
+            catch (ClassCastException e) {
+                handleClassCastException(e);
+            }
+            catch (CacheLoaderException e) {
+                throw new IgniteCheckedException(e);
+            }
+            catch (Exception e) {
+                throw new IgniteCheckedException(new CacheLoaderException(e));
+            }
+            finally {
+                sessionEnd0(tx, thewEx);
+            }
+
+            if (log.isDebugEnabled())
+                log.debug("Loaded values from store for keys: " + keys0);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean loadCache(final GridInClosure3 vis, Object[] args) throws IgniteCheckedException {
+        if (store != null) {
+            if (log.isDebugEnabled())
+                log.debug("Loading all values from store.");
+
+            sessionInit0(null);
+
+            boolean thewEx = true;
+
+            try {
+                store.loadCache(new IgniteBiInClosure<Object, Object>() {
+                    @Override public void apply(Object k, Object o) {
+                        Object v;
+                        GridCacheVersion ver = null;
+
+                        if (locStore) {
+                            IgniteBiTuple<Object, GridCacheVersion> t = (IgniteBiTuple<Object, GridCacheVersion>)o;
+
+                            v = t.get1();
+                            ver = t.get2();
+                        }
+                        else
+                            v = o;
+
+                        KeyCacheObject cacheKey = cctx.toCacheKeyObject(k);
+
+                        vis.apply(cacheKey, v, ver);
+                    }
+                }, args);
+
+                thewEx = false;
+            }
+            catch (CacheLoaderException e) {
+                throw new IgniteCheckedException(e);
+            }
+            catch (Exception e) {
+                throw new IgniteCheckedException(new CacheLoaderException(e));
+            }
+            finally {
+                sessionEnd0(null, thewEx);
+            }
+
+            if (log.isDebugEnabled())
+                log.debug("Loaded all values from store.");
+
+            return true;
+        }
+
+        LT.warn(log, null, "Calling Cache.loadCache() method will have no effect, " +
+            "CacheConfiguration.getStore() is not defined for cache: " + cctx.namexx());
+
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean put(@Nullable IgniteInternalTx tx, Object key, Object val, GridCacheVersion ver)
+        throws IgniteCheckedException {
+        if (store != null) {
+            // Never persist internal keys.
+            if (key instanceof GridCacheInternal)
+                return true;
+
+            if (convertPortable()) {
+                key = cctx.unwrapPortableIfNeeded(key, false);
+                val = cctx.unwrapPortableIfNeeded(val, false);
+            }
+
+            if (log.isDebugEnabled())
+                log.debug("Storing value in cache store [key=" + key + ", val=" + val + ']');
+
+            sessionInit0(tx);
+
+            boolean thewEx = true;
+
+            try {
+                store.write(new CacheEntryImpl<>(key, locStore ? F.t(val, ver) : val));
+
+                thewEx = false;
+            }
+            catch (ClassCastException e) {
+                handleClassCastException(e);
+            }
+            catch (CacheWriterException e) {
+                throw new IgniteCheckedException(e);
+            }
+            catch (Exception e) {
+                throw new IgniteCheckedException(new CacheWriterException(e));
+            }
+            finally {
+                sessionEnd0(tx, thewEx);
+            }
+
+            if (log.isDebugEnabled())
+                log.debug("Stored value in cache store [key=" + key + ", val=" + val + ']');
+
+            return true;
+        }
+
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean putAll(@Nullable IgniteInternalTx tx, Map map) throws IgniteCheckedException {
+        if (F.isEmpty(map))
+            return true;
+
+        if (map.size() == 1) {
+            Map.Entry<Object, IgniteBiTuple<Object, GridCacheVersion>> e =
+                ((Map<Object, IgniteBiTuple<Object, GridCacheVersion>>)map).entrySet().iterator().next();
+
+            return put(tx, e.getKey(), e.getValue().get1(), e.getValue().get2());
+        }
+        else {
+            if (store != null) {
+                EntriesView entries = new EntriesView(map);
+
+                if (log.isDebugEnabled())
+                    log.debug("Storing values in cache store [entries=" + entries + ']');
+
+                sessionInit0(tx);
+
+                boolean thewEx = true;
+
+                try {
+                    store.writeAll(entries);
+
+                    thewEx = false;
+                }
+                catch (ClassCastException e) {
+                    handleClassCastException(e);
+                }
+                catch (Exception e) {
+                    if (!(e instanceof CacheWriterException))
+                        e = new CacheWriterException(e);
+
+                    if (!entries.isEmpty()) {
+                        List<Object> keys = new ArrayList<>(entries.size());
+
+                        for (Cache.Entry<?, ?> entry : entries)
+                            keys.add(entry.getKey());
+
+                        throw new CacheStorePartialUpdateException(keys, e);
+                    }
+
+                    throw new IgniteCheckedException(e);
+                }
+                finally {
+                    sessionEnd0(tx, thewEx);
+                }
+
+                if (log.isDebugEnabled())
+                    log.debug("Stored value in cache store [entries=" + entries + ']');
+
+                return true;
+            }
+
+            return false;
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean remove(@Nullable IgniteInternalTx tx, Object key) throws IgniteCheckedException {
+        if (store != null) {
+            // Never remove internal key from store as it is never persisted.
+            if (key instanceof GridCacheInternal)
+                return false;
+
+            if (convertPortable())
+                key = cctx.unwrapPortableIfNeeded(key, false);
+
+            if (log.isDebugEnabled())
+                log.debug("Removing value from cache store [key=" + key + ']');
+
+            sessionInit0(tx);
+
+            boolean thewEx = true;
+
+            try {
+                store.delete(key);
+
+                thewEx = false;
+            }
+            catch (ClassCastException e) {
+                handleClassCastException(e);
+            }
+            catch (CacheWriterException e) {
+                throw new IgniteCheckedException(e);
+            }
+            catch (Exception e) {
+                throw new IgniteCheckedException(new CacheWriterException(e));
+            }
+            finally {
+                sessionEnd0(tx, thewEx);
+            }
+
+            if (log.isDebugEnabled())
+                log.debug("Removed value from cache store [key=" + key + ']');
+
+            return true;
+        }
+
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean removeAll(@Nullable IgniteInternalTx tx, Collection keys)
+        throws IgniteCheckedException {
+        if (F.isEmpty(keys))
+            return true;
+
+        if (keys.size() == 1) {
+            Object key = keys.iterator().next();
+
+            return remove(tx, key);
+        }
+
+        if (store != null) {
+            Collection<Object> keys0 = convertPortable() ? cctx.unwrapPortablesIfNeeded(keys, false) : keys;
+
+            if (log.isDebugEnabled())
+                log.debug("Removing values from cache store [keys=" + keys0 + ']');
+
+            sessionInit0(tx);
+
+            boolean thewEx = true;
+
+            try {
+                store.deleteAll(keys0);
+
+                thewEx = false;
+            }
+            catch (ClassCastException e) {
+                handleClassCastException(e);
+            }
+            catch (Exception e) {
+                if (!(e instanceof CacheWriterException))
+                    e = new CacheWriterException(e);
+
+                if (!keys0.isEmpty())
+                    throw new CacheStorePartialUpdateException(keys0, e);
+
+                throw new IgniteCheckedException(e);
+            }
+            finally {
+                sessionEnd0(tx, thewEx);
+            }
+
+            if (log.isDebugEnabled())
+                log.debug("Removed values from cache store [keys=" + keys0 + ']');
+
+            return true;
+        }
+
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public CacheStore<Object, Object> store() {
+        return store;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void forceFlush() throws IgniteCheckedException {
+        if (store instanceof GridCacheWriteBehindStore)
+            ((GridCacheWriteBehindStore)store).forceFlush();
+    }
+
+    /** {@inheritDoc} */
+    @Override public void sessionEnd(IgniteInternalTx tx, boolean commit) throws IgniteCheckedException {
+        assert store != null;
+
+        sessionInit0(tx);
+
+        try {
+            store.sessionEnd(commit);
+        }
+        finally {
+            if (sesHolder != null) {
+                sesHolder.set(null);
+
+                tx.removeMeta(SES_ATTR);
+            }
+        }
+    }
+
+    /**
+     * @param e Class cast exception.
+     * @throws IgniteCheckedException Thrown exception.
+     */
+    private void handleClassCastException(ClassCastException e) throws IgniteCheckedException {
+        assert e != null;
+
+        if (e.getMessage() != null) {
+            throw new IgniteCheckedException("Cache store must work with portable objects if portables are " +
+                "enabled for cache [cacheName=" + cctx.namex() + ']', e);
+        }
+        else
+            throw e;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeBehindSessionInit() {
+        sessionInit0(null);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeBehindSessionEnd(boolean threwEx) throws IgniteCheckedException {
+        sessionEnd0(null, threwEx);
+    }
+
+    /**
+     * @param tx Current transaction.
+     */
+    private void sessionInit0(@Nullable IgniteInternalTx tx) {
+        if (sesHolder == null)
+            return;
+
+        assert sesHolder.get() == null;
+
+        SessionData ses;
+
+        if (tx != null) {
+            ses = tx.meta(SES_ATTR);
+
+            if (ses == null) {
+                ses = new SessionData(tx, cctx.name());
+
+                tx.addMeta(SES_ATTR, ses);
+            }
+            else
+                // Session cache name may change in cross-cache transaction.
+                ses.cacheName(cctx.name());
+        }
+        else
+            ses = new SessionData(null, cctx.name());
+
+        sesHolder.set(ses);
+    }
+
+    /**
+     * Clears session holder.
+     */
+    private void sessionEnd0(@Nullable IgniteInternalTx tx, boolean threwEx) throws IgniteCheckedException {
+        try {
+            if (tx == null)
+                store.sessionEnd(threwEx);
+        }
+        catch (Exception e) {
+            if (!threwEx)
+                throw U.cast(e);
+        }
+        finally {
+            if (sesHolder != null)
+                sesHolder.set(null);
+        }
+    }
+
+    /**
+     * @return Ignite context.
+     */
+    protected abstract GridKernalContext igniteContext();
+
+    /**
+     * @return Cache configuration.
+     */
+    protected abstract CacheConfiguration cacheConfiguration();
+
+    /**
+     * @return Convert-portable flag.
+     */
+    protected abstract boolean convertPortable();
+
+    /**
+     *
+     */
+    private static class SessionData {
+        /** */
+        @GridToStringExclude
+        private final IgniteInternalTx tx;
+
+        /** */
+        private String cacheName;
+
+        /** */
+        @GridToStringInclude
+        private Map<Object, Object> props;
+
+        /**
+         * @param tx Current transaction.
+         * @param cacheName Cache name.
+         */
+        private SessionData(@Nullable IgniteInternalTx tx, @Nullable String cacheName) {
+            this.tx = tx;
+            this.cacheName = cacheName;
+        }
+
+        /**
+         * @return Transaction.
+         */
+        @Nullable private Transaction transaction() {
+            return tx != null ? tx.proxy() : null;
+        }
+
+        /**
+         * @return Properties.
+         */
+        private Map<Object, Object> properties() {
+            if (props == null)
+                props = new GridLeanMap<>();
+
+            return props;
+        }
+
+        /**
+         * @return Cache name.
+         */
+        private String cacheName() {
+            return cacheName;
+        }
+
+        /**
+         * @param cacheName Cache name.
+         */
+        private void cacheName(String cacheName) {
+            this.cacheName = cacheName;
+        }
+
+        /** {@inheritDoc} */
+        @Override public String toString() {
+            return S.toString(SessionData.class, this, "tx", CU.txString(tx));
+        }
+    }
+
+    /**
+     *
+     */
+    private static class ThreadLocalSession implements CacheStoreSession {
+        /** */
+        private final ThreadLocal<SessionData> sesHolder = new ThreadLocal<>();
+
+        /** {@inheritDoc} */
+        @Nullable @Override public Transaction transaction() {
+            SessionData ses0 = sesHolder.get();
+
+            return ses0 != null ? ses0.transaction() : null;
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean isWithinTransaction() {
+            return transaction() != null;
+        }
+
+        /** {@inheritDoc} */
+        @Override public <K1, V1> Map<K1, V1> properties() {
+            SessionData ses0 = sesHolder.get();
+
+            return ses0 != null ? (Map<K1, V1>)ses0.properties() : null;
+        }
+
+        /** {@inheritDoc} */
+        @Nullable @Override public String cacheName() {
+            SessionData ses0 = sesHolder.get();
+
+            return ses0 != null ? ses0.cacheName() : null;
+        }
+
+        /** {@inheritDoc} */
+        @Override public String toString() {
+            return S.toString(ThreadLocalSession.class, this);
+        }
+    }
+
+    /**
+     *
+     */
+    private class EntriesView extends AbstractCollection<Cache.Entry<?, ?>> {
+        /** */
+        private final Map<?, IgniteBiTuple<?, GridCacheVersion>> map;
+
+        /** */
+        private Set<Object> rmvd;
+
+        /** */
+        private boolean cleared;
+
+        /**
+         * @param map Map.
+         */
+        private EntriesView(Map<?, IgniteBiTuple<?, GridCacheVersion>> map) {
+            assert map != null;
+
+            this.map = map;
+        }
+
+        /** {@inheritDoc} */
+        @Override public int size() {
+            return cleared ? 0 : (map.size() - (rmvd != null ? rmvd.size() : 0));
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean isEmpty() {
+            return cleared || !iterator().hasNext();
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean contains(Object o) {
+            if (cleared || !(o instanceof Cache.Entry))
+                return false;
+
+            Cache.Entry<?, ?> e = (Cache.Entry<?, ?>)o;
+
+            return map.containsKey(e.getKey());
+        }
+
+        /** {@inheritDoc} */
+        @NotNull @Override public Iterator<Cache.Entry<?, ?>> iterator() {
+            if (cleared)
+                return F.emptyIterator();
+
+            final Iterator<Map.Entry<?, IgniteBiTuple<?, GridCacheVersion>>> it0 = (Iterator)map.entrySet().iterator();
+
+            return new Iterator<Cache.Entry<?, ?>>() {
+                /** */
+                private Cache.Entry<?, ?> cur;
+
+                /** */
+                private Cache.Entry<?, ?> next;
+
+                /**
+                 *
+                 */
+                {
+                    checkNext();
+                }
+
+                /**
+                 *
+                 */
+                private void checkNext() {
+                    while (it0.hasNext()) {
+                        Map.Entry<?, IgniteBiTuple<?, GridCacheVersion>> e = it0.next();
+
+                        Object k = e.getKey();
+
+                        if (rmvd != null && rmvd.contains(k))
+                            continue;
+
+                        Object v = locStore ? e.getValue() : e.getValue().get1();
+
+                        if (convertPortable()) {
+                            k = cctx.unwrapPortableIfNeeded(k, false);
+                            v = cctx.unwrapPortableIfNeeded(v, false);
+                        }
+
+                        next = new CacheEntryImpl<>(k, v);
+
+                        break;
+                    }
+                }
+
+                @Override public boolean hasNext() {
+                    return next != null;
+                }
+
+                @Override public Cache.Entry<?, ?> next() {
+                    if (next == null)
+                        throw new NoSuchElementException();
+
+                    cur = next;
+
+                    next = null;
+
+                    checkNext();
+
+                    return cur;
+                }
+
+                @Override public void remove() {
+                    if (cur == null)
+                        throw new IllegalStateException();
+
+                    addRemoved(cur);
+
+                    cur = null;
+                }
+            };
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean add(Cache.Entry<?, ?> entry) {
+            throw new UnsupportedOperationException();
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean addAll(Collection<? extends Cache.Entry<?, ?>> col) {
+            throw new UnsupportedOperationException();
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean remove(Object o) {
+            if (cleared || !(o instanceof Cache.Entry))
+                return false;
+
+            Cache.Entry<?, ?> e = (Cache.Entry<?, ?>)o;
+
+            if (rmvd != null && rmvd.contains(e.getKey()))
+                return false;
+
+            if (mapContains(e)) {
+                addRemoved(e);
+
+                return true;
+            }
+
+            return false;
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean containsAll(Collection<?> col) {
+            if (cleared)
+                return false;
+
+            for (Object o : col) {
+                if (contains(o))
+                    return false;
+            }
+
+            return true;
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean removeAll(Collection<?> col) {
+            if (cleared)
+                return false;
+
+            boolean modified = false;
+
+            for (Object o : col) {
+                if (remove(o))
+                    modified = true;
+            }
+
+            return modified;
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean retainAll(Collection<?> col) {
+            if (cleared)
+                return false;
+
+            boolean modified = false;
+
+            for (Cache.Entry<?, ?> e : this) {
+                if (!col.contains(e)) {
+                    addRemoved(e);
+
+                    modified = true;
+                }
+            }
+
+            return modified;
+        }
+
+        /** {@inheritDoc} */
+        @Override public void clear() {
+            cleared = true;
+        }
+
+        /**
+         * @param e Entry.
+         */
+        private void addRemoved(Cache.Entry<?, ?> e) {
+            if (rmvd == null)
+                rmvd = new HashSet<>();
+
+            rmvd.add(e.getKey());
+        }
+
+        /**
+         * @param e Entry.
+         * @return {@code True} if original map contains entry.
+         */
+        private boolean mapContains(Cache.Entry<?, ?> e) {
+            return map.containsKey(e.getKey());
+        }
+
+        /** {@inheritDoc} */
+        public String toString() {
+            Iterator<Cache.Entry<?, ?>> it = iterator();
+
+            if (!it.hasNext())
+                return "[]";
+
+            SB sb = new SB("[");
+
+            while (true) {
+                Cache.Entry<?, ?> e = it.next();
+
+                sb.a(e.toString());
+
+                if (!it.hasNext())
+                    return sb.a(']').toString();
+
+                sb.a(", ");
+            }
+        }
+    }
+}


[34/37] incubator-ignite git commit: # ignite-sprint-3 Removed queryTimeout

Posted by sb...@apache.org.
# ignite-sprint-3 Removed queryTimeout


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/d33191c5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/d33191c5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/d33191c5

Branch: refs/heads/ignite-cacheplug-rmtvalid
Commit: d33191c5c1965c97a093d49017ae691c7f5289a5
Parents: 6c3f101
Author: anovikov <an...@gridgain.com>
Authored: Fri Apr 3 14:34:49 2015 +0700
Committer: anovikov <an...@gridgain.com>
Committed: Fri Apr 3 14:34:49 2015 +0700

----------------------------------------------------------------------
 .../visor/cache/VisorCacheDefaultConfiguration.java       | 10 ----------
 .../ignite/visor/commands/cache/VisorCacheCommand.scala   |  3 +--
 2 files changed, 1 insertion(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d33191c5/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheDefaultConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheDefaultConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheDefaultConfiguration.java
index a0d9990..998b921 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheDefaultConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheDefaultConfiguration.java
@@ -32,9 +32,6 @@ public class VisorCacheDefaultConfiguration implements Serializable {
     /** Default transaction timeout. */
     private long txLockTimeout;
 
-    /** Default query timeout. */
-    private long qryTimeout;
-
     /**
      * @param ccfg Cache configuration.
      * @return Data transfer object for default cache configuration properties.
@@ -54,13 +51,6 @@ public class VisorCacheDefaultConfiguration implements Serializable {
         return txLockTimeout;
     }
 
-    /**
-     * @return Default query timeout.
-     */
-    public long queryTimeout() {
-        return qryTimeout;
-    }
-
     /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(VisorCacheDefaultConfiguration.class, this);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d33191c5/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
index 4365364..539d3d2 100644
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
@@ -722,7 +722,7 @@ object VisorCacheCommand {
 
     /** Default cache name to show on screen. */
     private final val DFLT_CACHE_NAME = escapeName(null)
-    
+
     /** Default cache key. */
     protected val DFLT_CACHE_KEY = DFLT_CACHE_NAME + "-" + UUID.randomUUID().toString
 
@@ -804,7 +804,6 @@ object VisorCacheCommand {
         cacheT += ("Near Eviction Policy Max Size", safe(nearCfg.nearEvictMaxSize()))
 
         cacheT += ("Default Lock Timeout", defaultCfg.txLockTimeout())
-        cacheT += ("Default Query Timeout", defaultCfg.queryTimeout())
         cacheT += ("Metadata type count", cfg.typeMeta().size())
         cacheT += ("Cache Interceptor", safe(cfg.interceptor()))
 


[09/37] incubator-ignite git commit: Merge branches 'ignite-gg-9942' and 'ignite-sprint-3' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-gg-9942

Posted by sb...@apache.org.
Merge branches 'ignite-gg-9942' and 'ignite-sprint-3' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-gg-9942


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/d47b66a2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/d47b66a2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/d47b66a2

Branch: refs/heads/ignite-cacheplug-rmtvalid
Commit: d47b66a2177367e3e86e1ffba9217589783d27d1
Parents: c8428a4 ed6632a
Author: AKuznetsov <ak...@gridgain.com>
Authored: Thu Apr 2 08:51:46 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Thu Apr 2 08:51:46 2015 +0700

----------------------------------------------------------------------
 examples/pom.xml                                |  19 +-
 examples/schema-import/pom.xml                  |  10 +-
 modules/aop/pom.xml                             |   6 +-
 modules/aws/pom.xml                             |   4 +-
 modules/clients/pom.xml                         |  10 +-
 modules/codegen/pom.xml                         |   4 +-
 modules/core/pom.xml                            |   8 +-
 .../apache/ignite/cache/CachingProvider.java    |   2 +-
 .../configuration/FileSystemConfiguration.java  |   6 +
 .../processors/cache/CacheObjectContext.java    |  14 +-
 .../processors/cache/CacheObjectImpl.java       |  10 +-
 .../processors/cache/GridCacheMapEntry.java     |   2 +-
 .../cache/query/GridCacheQueryManager.java      |  16 +-
 .../continuous/CacheContinuousQueryManager.java |  28 ++
 .../IgniteCacheObjectProcessorImpl.java         | 173 +++++++----
 .../processors/igfs/IgfsDataManager.java        |  11 +-
 .../processors/igfs/IgfsFileAffinityRange.java  |  23 +-
 .../spi/discovery/tcp/TcpDiscoverySpi.java      |   9 +-
 .../IgniteCacheAtomicLocalStoreValueTest.java   |  49 +++
 ...iteCacheAtomicNearEnabledStoreValueTest.java |  30 ++
 ...maryWriteOrderNearEnabledStoreValueTest.java |  31 ++
 ...heAtomicPrimaryWriteOrderStoreValueTest.java |  32 ++
 .../cache/IgniteCacheAtomicStoreValueTest.java  |  55 ++++
 .../IgniteCacheStoreValueAbstractTest.java      | 311 +++++++++++++++++++
 .../cache/IgniteCacheTxLocalStoreValueTest.java |  49 +++
 .../IgniteCacheTxNearEnabledStoreValueTest.java |  30 ++
 .../cache/IgniteCacheTxStoreValueTest.java      |  49 +++
 .../junits/common/GridCommonAbstractTest.java   |   2 +-
 .../ignite/testsuites/IgniteCacheTestSuite.java |   9 +
 modules/extdata/p2p/pom.xml                     |   4 +-
 modules/extdata/uri/pom.xml                     |   4 +-
 modules/geospatial/pom.xml                      |   4 +-
 modules/hadoop/pom.xml                          |   8 +-
 modules/hibernate/pom.xml                       |   6 +-
 modules/indexing/pom.xml                        |   4 +-
 modules/jcl/pom.xml                             |   4 +-
 modules/jta/pom.xml                             |   4 +-
 modules/log4j/pom.xml                           |   4 +-
 modules/rest-http/pom.xml                       |   2 +-
 modules/scalar/pom.xml                          |  10 +-
 modules/schedule/pom.xml                        |   4 +-
 modules/schema-import/pom.xml                   |   2 +-
 modules/slf4j/pom.xml                           |   2 +-
 modules/spring/pom.xml                          |   8 +-
 modules/ssh/pom.xml                             |   8 +-
 modules/urideploy/pom.xml                       |   6 +-
 modules/visor-console/pom.xml                   |   8 +-
 .../scala/org/apache/ignite/visor/visor.scala   |   2 +-
 modules/visor-plugins/pom.xml                   |   2 +-
 modules/web/pom.xml                             |   8 +-
 modules/yardstick/pom.xml                       |   6 +-
 pom.xml                                         |  56 ++--
 52 files changed, 947 insertions(+), 221 deletions(-)
----------------------------------------------------------------------



[32/37] incubator-ignite git commit: # ignite-670

Posted by sb...@apache.org.
# ignite-670


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/f19a6119
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/f19a6119
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/f19a6119

Branch: refs/heads/ignite-cacheplug-rmtvalid
Commit: f19a61191eaf41ef66870bfb3d7d90fe6f4aeda0
Parents: 34c29ed
Author: sboikov <se...@inria.fr>
Authored: Thu Apr 2 23:33:16 2015 +0300
Committer: sboikov <se...@inria.fr>
Committed: Thu Apr 2 23:40:25 2015 +0300

----------------------------------------------------------------------
 .../cache/ttl/CacheTtlAbstractSelfTest.java     | 83 +++++++++++++++++---
 1 file changed, 70 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f19a6119/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlAbstractSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlAbstractSelfTest.java
index 0e2e738..c56dfd4 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlAbstractSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlAbstractSelfTest.java
@@ -36,7 +36,10 @@ import javax.cache.integration.*;
 import java.util.*;
 
 import static java.util.concurrent.TimeUnit.*;
+import static org.apache.ignite.cache.CacheMode.*;
 import static org.apache.ignite.cache.CachePeekMode.*;
+import static org.apache.ignite.cache.CacheRebalanceMode.*;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.*;
 
 /**
  * TTL test.
@@ -58,17 +61,19 @@ public abstract class CacheTtlAbstractSelfTest extends GridCommonAbstractTest {
     @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(gridName);
 
-        CacheConfiguration cache = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration();
 
-        cache.setCacheMode(cacheMode());
-        cache.setAtomicityMode(atomicityMode());
-        cache.setMemoryMode(memoryMode());
-        cache.setOffHeapMaxMemory(0);
-        cache.setEvictionPolicy(new LruEvictionPolicy(MAX_CACHE_SIZE));
-        cache.setIndexedTypes(Integer.class, Integer.class);
-        cache.setBackups(2);
+        ccfg.setCacheMode(cacheMode());
+        ccfg.setAtomicityMode(atomicityMode());
+        ccfg.setMemoryMode(memoryMode());
+        ccfg.setOffHeapMaxMemory(0);
+        ccfg.setEvictionPolicy(new LruEvictionPolicy(MAX_CACHE_SIZE));
+        ccfg.setIndexedTypes(Integer.class, Integer.class);
+        ccfg.setBackups(2);
+        ccfg.setWriteSynchronizationMode(FULL_SYNC);
+        ccfg.setRebalanceMode(SYNC);
 
-        cache.setCacheStoreFactory(singletonFactory(new CacheStoreAdapter() {
+        ccfg.setCacheStoreFactory(singletonFactory(new CacheStoreAdapter() {
             @Override public void loadCache(IgniteBiInClosure clo, Object... args) {
                 for (int i = 0; i < SIZE; i++)
                     clo.apply(i, i);
@@ -87,10 +92,10 @@ public abstract class CacheTtlAbstractSelfTest extends GridCommonAbstractTest {
             }
         }));
 
-        cache.setExpiryPolicyFactory(
-            FactoryBuilder.factoryOf(new TouchedExpiryPolicy(new Duration(MILLISECONDS, DEFAULT_TIME_TO_LIVE))));
+        ccfg.setExpiryPolicyFactory(
+                FactoryBuilder.factoryOf(new TouchedExpiryPolicy(new Duration(MILLISECONDS, DEFAULT_TIME_TO_LIVE))));
 
-        cfg.setCacheConfiguration(cache);
+        cfg.setCacheConfiguration(ccfg);
 
         ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);
 
@@ -146,6 +151,16 @@ public abstract class CacheTtlAbstractSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testDefaultTimeToLiveLoadAll() throws Exception {
+        defaultTimeToLiveLoadAll(false);
+
+        defaultTimeToLiveLoadAll(true);
+    }
+
+    /**
+     * @param replaceExisting Replace existing value flag.
+     * @throws Exception If failed.
+     */
+    private void defaultTimeToLiveLoadAll(boolean replaceExisting) throws Exception {
         IgniteCache<Integer, Integer> cache = jcache(0);
 
         CompletionListenerFuture fut = new CompletionListenerFuture();
@@ -155,7 +170,7 @@ public abstract class CacheTtlAbstractSelfTest extends GridCommonAbstractTest {
         for (int i = 0; i < SIZE; ++i)
             keys.add(i);
 
-        cache.loadAll(keys, false, fut);
+        cache.loadAll(keys, replaceExisting, fut);
 
         fut.get();
 
@@ -235,6 +250,31 @@ public abstract class CacheTtlAbstractSelfTest extends GridCommonAbstractTest {
     /**
      * @throws Exception If failed.
      */
+    public void testDefaultTimeToLivePreload() throws Exception {
+        if (cacheMode() == LOCAL)
+            return;
+
+        IgniteCache<Integer, Integer> cache = jcache(0);
+
+        Map<Integer, Integer> entries = new HashMap<>();
+
+        for (int i = 0; i < SIZE; ++i)
+            entries.put(i, i);
+
+        cache.putAll(entries);
+
+        startGrid(gridCount());
+
+        checkSizeBeforeLive(SIZE, gridCount() + 1);
+
+        Thread.sleep(DEFAULT_TIME_TO_LIVE + 500);
+
+        checkSizeAfterLive(gridCount() + 1);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
     public void testTimeToLiveTtl() throws Exception {
         long time = DEFAULT_TIME_TO_LIVE + 2000;
 
@@ -255,6 +295,10 @@ public abstract class CacheTtlAbstractSelfTest extends GridCommonAbstractTest {
         checkSizeAfterLive();
     }
 
+    /**
+     * @param size Expected size.
+     * @throws Exception If failed.
+     */
     private void checkSizeBeforeLive(int size) throws Exception {
         checkSizeBeforeLive(size, gridCount());
     }
@@ -268,6 +312,11 @@ public abstract class CacheTtlAbstractSelfTest extends GridCommonAbstractTest {
         for (int i = 0; i < gridCnt; ++i) {
             IgniteCache<Integer, Integer> cache = jcache(i);
 
+            log.info("Size [node=" + i +
+                ", heap=" + cache.localSize(ONHEAP) +
+                ", offheap=" + cache.localSize(OFFHEAP) +
+                ", swap=" + cache.localSize(SWAP) + ']');
+
             if (memoryMode() == CacheMemoryMode.OFFHEAP_TIERED) {
                 assertEquals("Unexpected size, node: " + i, 0, cache.localSize(ONHEAP));
                 assertEquals("Unexpected size, node: " + i, size, cache.localSize(OFFHEAP));
@@ -280,6 +329,9 @@ public abstract class CacheTtlAbstractSelfTest extends GridCommonAbstractTest {
                     size > MAX_CACHE_SIZE ? size - MAX_CACHE_SIZE : 0, cache.localSize(OFFHEAP));
             }
 
+            for (int key = 0; key < size; key++)
+                assertNotNull(cache.localPeek(key));
+
             assertFalse(cache.query(new SqlQuery<>(Integer.class, "_val >= 0")).getAll().isEmpty());
         }
     }
@@ -299,6 +351,11 @@ public abstract class CacheTtlAbstractSelfTest extends GridCommonAbstractTest {
         for (int i = 0; i < gridCnt; ++i) {
             IgniteCache<Integer, Integer> cache = jcache(i);
 
+            log.info("Size [node=" + i +
+                ", heap=" + cache.localSize(ONHEAP) +
+                ", offheap=" + cache.localSize(OFFHEAP) +
+                ", swap=" + cache.localSize(SWAP) + ']');
+
             assertEquals(0, cache.localSize());
             assertEquals(0, cache.localSize(OFFHEAP));
             assertEquals(0, cache.localSize(SWAP));


[15/37] incubator-ignite git commit: # GG-8774 Review.

Posted by sb...@apache.org.
# GG-8774 Review.


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/0e297a6e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/0e297a6e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/0e297a6e

Branch: refs/heads/ignite-cacheplug-rmtvalid
Commit: 0e297a6e97af1a284a1be676763bf49922e91215
Parents: 9b23109
Author: AKuznetsov <ak...@gridgain.com>
Authored: Thu Apr 2 16:31:05 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Thu Apr 2 16:31:05 2015 +0700

----------------------------------------------------------------------
 ipc/shmem/README.txt                                             | 2 +-
 .../org/apache/ignite/internal/visor/util/VisorMimeTypes.java    | 4 ++--
 .../spi/deployment/uri/GridUriDeploymentFileResourceLoader.java  | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0e297a6e/ipc/shmem/README.txt
----------------------------------------------------------------------
diff --git a/ipc/shmem/README.txt b/ipc/shmem/README.txt
index 854e1d9..e11360b 100644
--- a/ipc/shmem/README.txt
+++ b/ipc/shmem/README.txt
@@ -26,7 +26,7 @@ Usage with Apache Ignite
 -------------------
 
 Copy compiled library to folder that already listed in 'java.library.path'
-with name in form: 'libigniteshmem-<ignite-version>.<extention>'.
+with name in form: 'libigniteshmem-<ignite-version>.<extension>'.
 Note: Ignite should be restarted.
 
 **************************************************************************************

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0e297a6e/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorMimeTypes.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorMimeTypes.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorMimeTypes.java
index acd56a9..0a76f98 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorMimeTypes.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorMimeTypes.java
@@ -1009,9 +1009,9 @@ public class VisorMimeTypes {
         int lastIdx = name.lastIndexOf('.');
 
         if (lastIdx != -1) {
-            String extention = name.substring(lastIdx + 1).toLowerCase();
+            String extension = name.substring(lastIdx + 1).toLowerCase();
 
-            return mimeTypes.get(extention);
+            return mimeTypes.get(extension);
         }
 
         return null;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0e297a6e/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentFileResourceLoader.java
----------------------------------------------------------------------
diff --git a/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentFileResourceLoader.java b/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentFileResourceLoader.java
index 0e065c8..a0102f6 100644
--- a/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentFileResourceLoader.java
+++ b/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentFileResourceLoader.java
@@ -66,7 +66,7 @@ class GridUriDeploymentFileResourceLoader {
             // Replace separators.
             str = str.replaceAll("\\/|\\\\", ".");
 
-            // Strip off '.class' extention.
+            // Strip off '.class' extension.
             str = str.substring(0, str.indexOf(".class"));
 
             try {


[25/37] incubator-ignite git commit: # GG-9973: Fixed.

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c6629012/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStore.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStore.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStore.java
new file mode 100644
index 0000000..5ce42f9
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStore.java
@@ -0,0 +1,1015 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.store;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.store.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.internal.*;
+import org.apache.ignite.internal.util.tostring.*;
+import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.internal.util.worker.*;
+import org.apache.ignite.lang.*;
+import org.apache.ignite.lifecycle.*;
+import org.apache.ignite.thread.*;
+import org.jetbrains.annotations.*;
+import org.jsr166.*;
+
+import javax.cache.integration.*;
+import java.util.*;
+import java.util.concurrent.*;
+import java.util.concurrent.atomic.*;
+import java.util.concurrent.locks.*;
+
+import static javax.cache.Cache.*;
+
+/**
+ * Internal wrapper for a {@link CacheStore} that enables write-behind logic.
+ * <p/>
+ * The general purpose of this approach is to reduce cache store load under high
+ * store update rate. The idea is to cache all write and remove operations in a pending
+ * map and delegate these changes to the underlying store either after timeout or
+ * if size of a pending map exceeded some pre-configured value. Another performance gain
+ * is achieved due to combining a group of similar operations to a single batch update.
+ * <p/>
+ * The essential flush size for the write-behind cache should be at least the estimated
+ * count of simultaneously written keys. In case of significantly smaller value there would
+ * be triggered a lot of flush events that will result in a high cache store load.
+ * <p/>
+ * Since write operations to the cache store are deferred, transaction support is lost; no
+ * transaction objects are passed to the underlying store.
+ */
+public class GridCacheWriteBehindStore<K, V> implements CacheStore<K, V>, LifecycleAware {
+    /** Default write cache initial capacity. */
+    public static final int DFLT_INITIAL_CAPACITY = 1024;
+
+    /** Overflow ratio for critical cache size calculation. */
+    public static final float CACHE_OVERFLOW_RATIO = 1.5f;
+
+    /** Default concurrency level of write cache. */
+    public static final int DFLT_CONCUR_LVL = 64;
+
+    /** Write cache initial capacity. */
+    private int initCap = DFLT_INITIAL_CAPACITY;
+
+    /** Concurrency level for write cache access. */
+    private int concurLvl = DFLT_CONCUR_LVL;
+
+    /** When cache size exceeds this value eldest entry will be stored to the underlying store. */
+    private int cacheMaxSize = CacheConfiguration.DFLT_WRITE_BEHIND_FLUSH_SIZE;
+
+    /** Critical cache size. If cache size exceeds this value, data flush performed synchronously. */
+    private int cacheCriticalSize;
+
+    /** Count of worker threads performing underlying store updates. */
+    private int flushThreadCnt = CacheConfiguration.DFLT_WRITE_FROM_BEHIND_FLUSH_THREAD_CNT;
+
+    /** Cache flush frequency. All pending operations will be performed in not less then this value ms. */
+    private long cacheFlushFreq = CacheConfiguration.DFLT_WRITE_BEHIND_FLUSH_FREQUENCY;
+
+    /** Maximum batch size for put and remove operations */
+    private int batchSize = CacheConfiguration.DFLT_WRITE_BEHIND_BATCH_SIZE;
+
+    /** Grid name. */
+    private String gridName;
+
+    /** Cache name. */
+    private String cacheName;
+
+    /** Underlying store. */
+    private CacheStore<K, V> store;
+
+    /** Write cache. */
+    private ConcurrentLinkedHashMap<K, StatefulValue<K, V>> writeCache;
+
+    /** Flusher threads. */
+    private GridWorker[] flushThreads;
+
+    /** Atomic flag indicating store shutdown. */
+    private AtomicBoolean stopping = new AtomicBoolean(true);
+
+    /** Flush lock. */
+    private Lock flushLock = new ReentrantLock();
+
+    /** Condition to determine records available for flush. */
+    private Condition canFlush = flushLock.newCondition();
+
+    /** Variable for counting total cache overflows. */
+    private AtomicInteger cacheTotalOverflowCntr = new AtomicInteger();
+
+    /** Variable contains current number of overflow events. */
+    private AtomicInteger cacheOverflowCntr = new AtomicInteger();
+
+    /** Variable for counting key-value pairs that are in {@link ValueStatus#RETRY} state. */
+    private AtomicInteger retryEntriesCnt = new AtomicInteger();
+
+    /** Log. */
+    private IgniteLogger log;
+
+    /** Store manager. */
+    private CacheStoreManager storeMgr;
+
+    /**
+     * Creates a write-behind cache store for the given store.
+     *
+     * @param storeMgr Store manager.
+     * @param gridName Grid name.
+     * @param cacheName Cache name.
+     * @param log Grid logger.
+     * @param store {@code GridCacheStore} that need to be wrapped.
+     */
+    public GridCacheWriteBehindStore(
+        CacheStoreManager storeMgr,
+        String gridName,
+        String cacheName,
+        IgniteLogger log,
+        CacheStore<K, V> store) {
+        this.storeMgr = storeMgr;
+        this.gridName = gridName;
+        this.cacheName = cacheName;
+        this.log = log;
+        this.store = store;
+    }
+
+    /**
+     * Sets initial capacity for the write cache.
+     *
+     * @param initCap Initial capacity.
+     */
+    public void setInitialCapacity(int initCap) {
+        this.initCap = initCap;
+    }
+
+    /**
+     * Sets concurrency level for the write cache. Concurrency level is expected count of concurrent threads
+     * attempting to update cache.
+     *
+     * @param concurLvl Concurrency level.
+     */
+    public void setConcurrencyLevel(int concurLvl) {
+        this.concurLvl = concurLvl;
+    }
+
+    /**
+     * Sets the maximum size of the write cache. When the count of unique keys in write cache exceeds this value,
+     * the eldest entry in the cache is immediately scheduled for write to the underlying store.
+     *
+     * @param cacheMaxSize Max cache size.
+     */
+    public void setFlushSize(int cacheMaxSize) {
+        this.cacheMaxSize = cacheMaxSize;
+    }
+
+    /**
+     * Gets the maximum size of the write-behind buffer. When the count of unique keys
+     * in write buffer exceeds this value, the buffer is scheduled for write to the underlying store.
+     * <p/>
+     * If this value is {@code 0}, then flush is performed only on time-elapsing basis. However,
+     * when this value is {@code 0}, the cache critical size is set to
+     * {@link CacheConfiguration#DFLT_WRITE_BEHIND_CRITICAL_SIZE}
+     *
+     * @return Buffer size that triggers flush procedure.
+     */
+    public int getWriteBehindFlushSize() {
+        return cacheMaxSize;
+    }
+
+    /**
+     * Sets the number of threads that will perform store update operations.
+     *
+     * @param flushThreadCnt Count of worker threads.
+     */
+    public void setFlushThreadCount(int flushThreadCnt) {
+        this.flushThreadCnt = flushThreadCnt;
+    }
+
+    /**
+     * Gets the number of flush threads that will perform store update operations.
+     *
+     * @return Count of worker threads.
+     */
+    public int getWriteBehindFlushThreadCount() {
+        return flushThreadCnt;
+    }
+
+    /**
+     * Sets the cache flush frequency. All pending operations on the underlying store will be performed
+     * within time interval not less then this value.
+     *
+     * @param cacheFlushFreq Time interval value in milliseconds.
+     */
+    public void setFlushFrequency(long cacheFlushFreq) {
+        this.cacheFlushFreq = cacheFlushFreq;
+    }
+
+    /**
+     * Gets the cache flush frequency. All pending operations on the underlying store will be performed
+     * within time interval not less then this value.
+     * <p/>
+     * If this value is {@code 0}, then flush is performed only when buffer size exceeds flush size.
+     *
+     * @return Flush frequency in milliseconds.
+     */
+    public long getWriteBehindFlushFrequency() {
+        return cacheFlushFreq;
+    }
+
+    /**
+     * Sets the maximum count of similar operations that can be grouped to a single batch.
+     *
+     * @param batchSize Maximum count of batch.
+     */
+    public void setBatchSize(int batchSize) {
+        this.batchSize = batchSize;
+    }
+
+    /**
+     * Gets the maximum count of similar (put or remove) operations that can be grouped to a single batch.
+     *
+     * @return Maximum size of batch.
+     */
+    public int getWriteBehindStoreBatchSize() {
+        return batchSize;
+    }
+
+    /**
+     * Gets count of entries that were processed by the write-behind store and have not been
+     * flushed to the underlying store yet.
+     *
+     * @return Total count of entries in cache store internal buffer.
+     */
+    public int getWriteBehindBufferSize() {
+        return writeCache.sizex();
+    }
+
+    /**
+     * @return Underlying store.
+     */
+    public CacheStore<K, V> store() {
+        return store;
+    }
+
+    /**
+     * Performs all the initialization logic for write-behind cache store.
+     * This class must not be used until this method returns.
+     */
+    @Override public void start() {
+        assert cacheFlushFreq != 0 || cacheMaxSize != 0;
+
+        if (stopping.compareAndSet(true, false)) {
+            if (log.isDebugEnabled())
+                log.debug("Starting write-behind store for cache '" + cacheName + '\'');
+
+            cacheCriticalSize = (int)(cacheMaxSize * CACHE_OVERFLOW_RATIO);
+
+            if (cacheCriticalSize == 0)
+                cacheCriticalSize = CacheConfiguration.DFLT_WRITE_BEHIND_CRITICAL_SIZE;
+
+            flushThreads = new GridWorker[flushThreadCnt];
+
+            writeCache = new ConcurrentLinkedHashMap<>(initCap, 0.75f, concurLvl);
+
+            for (int i = 0; i < flushThreads.length; i++) {
+                flushThreads[i] = new Flusher(gridName, "flusher-" + i, log);
+
+                new IgniteThread(flushThreads[i]).start();
+            }
+        }
+    }
+
+    /**
+     * Gets count of write buffer overflow events since initialization. Each overflow event causes
+     * the ongoing flush operation to be performed synchronously.
+     *
+     * @return Count of cache overflow events since start.
+     */
+    public int getWriteBehindTotalCriticalOverflowCount() {
+        return cacheTotalOverflowCntr.get();
+    }
+
+    /**
+     * Gets count of write buffer overflow events in progress at the moment. Each overflow event causes
+     * the ongoing flush operation to be performed synchronously.
+     *
+     * @return Count of cache overflow events since start.
+     */
+    public int getWriteBehindCriticalOverflowCount() {
+        return cacheOverflowCntr.get();
+    }
+
+    /**
+     * Gets count of cache entries that are in a store-retry state. An entry is assigned a store-retry state
+     * when underlying store failed due some reason and cache has enough space to retain this entry till
+     * the next try.
+     *
+     * @return Count of entries in store-retry state.
+     */
+    public int getWriteBehindErrorRetryCount() {
+        return retryEntriesCnt.get();
+    }
+
+    /**
+     * Performs shutdown logic for store. No put, get and remove requests will be processed after
+     * this method is called.
+     */
+    @Override public void stop() {
+        if (stopping.compareAndSet(false, true)) {
+            if (log.isDebugEnabled())
+                log.debug("Stopping write-behind store for cache '" + cacheName + '\'');
+
+            wakeUp();
+
+            boolean graceful = true;
+
+            for (GridWorker worker : flushThreads)
+                graceful &= U.join(worker, log);
+
+            if (!graceful)
+                log.warning("Shutdown was aborted");
+        }
+    }
+
+    /**
+     * Forces all entries collected to be flushed to the underlying store.
+     * @throws IgniteCheckedException If failed.
+     */
+    public void forceFlush() throws IgniteCheckedException {
+        wakeUp();
+    }
+
+    /** {@inheritDoc} */
+    @Override public void loadCache(IgniteBiInClosure<K, V> clo, @Nullable Object... args) {
+        store.loadCache(clo, args);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Map<K, V> loadAll(Iterable<? extends K> keys) {
+        if (log.isDebugEnabled())
+            log.debug("Store load all [keys=" + keys + ']');
+
+        Map<K, V> loaded = new HashMap<>();
+
+        Collection<K> remaining = new LinkedList<>();
+
+        for (K key : keys) {
+            StatefulValue<K, V> val = writeCache.get(key);
+
+            if (val != null) {
+                val.readLock().lock();
+
+                try {
+                    if (val.operation() == StoreOperation.PUT)
+                        loaded.put(key, val.entry().getValue());
+                    else
+                        assert val.operation() == StoreOperation.RMV : val.operation();
+                }
+                finally {
+                    val.readLock().unlock();
+                }
+            }
+            else
+                remaining.add(key);
+        }
+
+        // For items that were not found in queue.
+        if (!remaining.isEmpty()) {
+            Map<K, V> loaded0 = store.loadAll(remaining);
+
+            if (loaded0 != null)
+                loaded.putAll(loaded0);
+        }
+
+        return loaded;
+    }
+
+    /** {@inheritDoc} */
+    @Override public V load(K key) {
+        if (log.isDebugEnabled())
+            log.debug("Store load [key=" + key + ']');
+
+        StatefulValue<K, V> val = writeCache.get(key);
+
+        if (val != null) {
+            val.readLock().lock();
+
+            try {
+                switch (val.operation()) {
+                    case PUT:
+                        return val.entry().getValue();
+
+                    case RMV:
+                        return null;
+
+                    default:
+                        assert false : "Unexpected operation: " + val.status();
+                }
+            }
+            finally {
+                val.readLock().unlock();
+            }
+        }
+
+        return store.load(key);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeAll(Collection<Entry<? extends K, ? extends V>> entries) {
+        for (Entry<? extends K, ? extends V> e : entries)
+            write(e);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void write(Entry<? extends K, ? extends V> entry) {
+        try {
+            if (log.isDebugEnabled())
+                log.debug("Store put [key=" + entry.getKey() + ", val=" + entry.getValue() + ']');
+
+            updateCache(entry.getKey(), entry, StoreOperation.PUT);
+        }
+        catch (IgniteInterruptedCheckedException e) {
+            throw new CacheWriterException(U.convertExceptionNoWrap(e));
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public void deleteAll(Collection<?> keys) {
+        for (Object key : keys)
+            delete(key);
+    }
+
+    /** {@inheritDoc} */
+    @SuppressWarnings("unchecked")
+    @Override public void delete(Object key) {
+        try {
+            if (log.isDebugEnabled())
+                log.debug("Store remove [key=" + key + ']');
+
+            updateCache((K)key, null, StoreOperation.RMV);
+        }
+        catch (IgniteInterruptedCheckedException e) {
+            throw new CacheWriterException(U.convertExceptionNoWrap(e));
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public void sessionEnd(boolean commit) {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(GridCacheWriteBehindStore.class, this);
+    }
+
+    /**
+     * Performs flush-consistent cache update for the given key.
+     *
+     * @param key Key for which update is performed.
+     * @param val New value, may be null for remove operation.
+     * @param operation Updated value status
+     * @throws IgniteInterruptedCheckedException If interrupted while waiting for value to be flushed.
+     */
+    private void updateCache(K key,
+        @Nullable Entry<? extends K, ? extends V> val,
+        StoreOperation operation)
+        throws IgniteInterruptedCheckedException {
+        StatefulValue<K, V> newVal = new StatefulValue<>(val, operation);
+
+        StatefulValue<K, V> prev;
+
+        while ((prev = writeCache.putIfAbsent(key, newVal)) != null) {
+            prev.writeLock().lock();
+
+            try {
+                if (prev.status() == ValueStatus.PENDING) {
+                    // Flush process in progress, try again.
+                    prev.waitForFlush();
+
+                    continue;
+                }
+                else if (prev.status() == ValueStatus.FLUSHED)
+                    // This entry was deleted from map before we acquired the lock.
+                    continue;
+                else if (prev.status() == ValueStatus.RETRY)
+                    // New value has come, old value is no longer in RETRY state,
+                    retryEntriesCnt.decrementAndGet();
+
+                assert prev.status() == ValueStatus.NEW || prev.status() == ValueStatus.RETRY;
+
+                prev.update(val, operation, ValueStatus.NEW);
+
+                break;
+            }
+            finally {
+                prev.writeLock().unlock();
+            }
+        }
+
+        // Now check the map size
+        if (writeCache.sizex() > cacheCriticalSize)
+            // Perform single store update in the same thread.
+            flushSingleValue();
+        else if (cacheMaxSize > 0 && writeCache.sizex() > cacheMaxSize)
+            wakeUp();
+    }
+
+    /**
+     * Flushes one upcoming value to the underlying store. Called from
+     * {@link #updateCache(Object, Entry, StoreOperation)} method in case when current map size exceeds
+     * critical size.
+     */
+    private void flushSingleValue() {
+        cacheOverflowCntr.incrementAndGet();
+
+        try {
+            Map<K, StatefulValue<K, V>> batch = null;
+
+            for (Map.Entry<K, StatefulValue<K, V>> e : writeCache.entrySet()) {
+                StatefulValue<K, V> val = e.getValue();
+
+                val.writeLock().lock();
+
+                try {
+                    ValueStatus status = val.status();
+
+                    if (acquired(status))
+                        // Another thread is helping us, continue to the next entry.
+                        continue;
+
+                    if (val.status() == ValueStatus.RETRY)
+                        retryEntriesCnt.decrementAndGet();
+
+                    assert retryEntriesCnt.get() >= 0;
+
+                    val.status(ValueStatus.PENDING);
+
+                    batch = Collections.singletonMap(e.getKey(), val);
+                }
+                finally {
+                    val.writeLock().unlock();
+                }
+
+                if (!batch.isEmpty()) {
+                    applyBatch(batch, false);
+
+                    cacheTotalOverflowCntr.incrementAndGet();
+
+                    return;
+                }
+            }
+        }
+        finally {
+            cacheOverflowCntr.decrementAndGet();
+        }
+    }
+
+    /**
+     * Performs batch operation on underlying store.
+     *
+     * @param valMap Batch map.
+     * @param initSes {@code True} if need to initialize session.
+     */
+    private void applyBatch(Map<K, StatefulValue<K, V>> valMap, boolean initSes) {
+        assert valMap.size() <= batchSize;
+
+        StoreOperation operation = null;
+
+        // Construct a map for underlying store
+        Map<K, Entry<? extends K, ? extends V>> batch = U.newLinkedHashMap(valMap.size());
+
+        for (Map.Entry<K, StatefulValue<K, V>> e : valMap.entrySet()) {
+            if (operation == null)
+                operation = e.getValue().operation();
+
+            assert operation == e.getValue().operation();
+
+            assert e.getValue().status() == ValueStatus.PENDING;
+
+            batch.put(e.getKey(), e.getValue().entry());
+        }
+
+        if (updateStore(operation, batch, initSes)) {
+            for (Map.Entry<K, StatefulValue<K, V>> e : valMap.entrySet()) {
+                StatefulValue<K, V> val = e.getValue();
+
+                val.writeLock().lock();
+
+                try {
+                    val.status(ValueStatus.FLUSHED);
+
+                    StatefulValue<K, V> prev = writeCache.remove(e.getKey());
+
+                    // Additional check to ensure consistency.
+                    assert prev == val : "Map value for key " + e.getKey() + " was updated during flush";
+
+                    val.signalFlushed();
+                }
+                finally {
+                    val.writeLock().unlock();
+                }
+            }
+        }
+        else {
+            // Exception occurred, we must set RETRY status
+            for (StatefulValue<K, V> val : valMap.values()) {
+                val.writeLock().lock();
+
+                try {
+                    val.status(ValueStatus.RETRY);
+
+                    retryEntriesCnt.incrementAndGet();
+
+                    val.signalFlushed();
+                }
+                finally {
+                    val.writeLock().unlock();
+                }
+            }
+        }
+    }
+
+    /**
+     * Tries to update store with the given values and returns {@code true} in case of success.
+     *
+     * <p/> If any exception in underlying store is occurred, this method checks the map size.
+     * If map size exceeds some critical value, then it returns {@code true} and this value will
+     * be lost. If map size does not exceed critical value, it will return false and value will
+     * be retained in write cache.
+     *
+     * @param operation Status indicating operation that should be performed.
+     * @param vals Key-Value map.
+     * @param initSes {@code True} if need to initialize session.
+     * @return {@code true} if value may be deleted from the write cache,
+     *         {@code false} otherwise
+     */
+    private boolean updateStore(StoreOperation operation,
+        Map<K, Entry<? extends K, ? extends  V>> vals,
+        boolean initSes) {
+
+        if (initSes && storeMgr != null)
+            storeMgr.writeBehindSessionInit();
+
+        try {
+            boolean threwEx = true;
+
+            try {
+                switch (operation) {
+                    case PUT:
+                        store.writeAll(vals.values());
+
+                        break;
+
+                    case RMV:
+                        store.deleteAll(vals.keySet());
+
+                        break;
+
+                    default:
+                        assert false : "Unexpected operation: " + operation;
+                }
+
+                threwEx = false;
+
+                return true;
+            }
+            finally {
+                if (initSes && storeMgr != null)
+                    storeMgr.writeBehindSessionEnd(threwEx);
+            }
+        }
+        catch (Exception e) {
+            LT.warn(log, e, "Unable to update underlying store: " + store);
+
+            if (writeCache.sizex() > cacheCriticalSize || stopping.get()) {
+                for (Map.Entry<K, Entry<? extends K, ? extends  V>> entry : vals.entrySet()) {
+                    Object val = entry.getValue() != null ? entry.getValue().getValue() : null;
+
+                    log.warning("Failed to update store (value will be lost as current buffer size is greater " +
+                        "than 'cacheCriticalSize' or node has been stopped before store was repaired) [key=" +
+                        entry.getKey() + ", val=" + val + ", op=" + operation + "]");
+                }
+
+                return true;
+            }
+
+            return false;
+        }
+    }
+
+    /**
+     * Wakes up flushing threads if map size exceeded maximum value or in case of shutdown.
+     */
+    private void wakeUp() {
+        flushLock.lock();
+
+        try {
+            canFlush.signalAll();
+        }
+        finally {
+            flushLock.unlock();
+        }
+    }
+
+    /**
+     * Thread that performs time-based flushing of written values to the underlying storage.
+     */
+    private class Flusher extends GridWorker {
+        /** {@inheritDoc */
+        protected Flusher(String gridName, String name, IgniteLogger log) {
+            super(gridName, name, log);
+        }
+
+        /** {@inheritDoc} */
+        @Override protected void body() throws InterruptedException, IgniteInterruptedCheckedException {
+            while (!stopping.get() || writeCache.sizex() > 0) {
+                awaitOperationsAvailable();
+
+                flushCache(writeCache.entrySet().iterator());
+            }
+        }
+
+        /**
+         * This method awaits until enough elements in map are available or given timeout is over.
+         *
+         * @throws InterruptedException If awaiting was interrupted.
+         */
+        private void awaitOperationsAvailable() throws InterruptedException {
+            flushLock.lock();
+
+            try {
+                do {
+                    if (writeCache.sizex() <= cacheMaxSize || cacheMaxSize == 0) {
+                        if (cacheFlushFreq > 0)
+                            canFlush.await(cacheFlushFreq, TimeUnit.MILLISECONDS);
+                        else
+                            canFlush.await();
+                    }
+                }
+                while (writeCache.sizex() == 0 && !stopping.get());
+            }
+            finally {
+                flushLock.unlock();
+            }
+        }
+
+        /**
+         * Removes values from the write cache and performs corresponding operation
+         * on the underlying store.
+         *
+         * @param it Iterator for write cache.
+         */
+        private void flushCache(Iterator<Map.Entry<K,StatefulValue<K, V>>> it) {
+            StoreOperation operation = null;
+
+            Map<K, StatefulValue<K, V>> batch = null;
+            Map<K, StatefulValue<K, V>> pending  = U.newLinkedHashMap(batchSize);
+
+            while (it.hasNext()) {
+                Map.Entry<K, StatefulValue<K, V>> e = it.next();
+
+                StatefulValue<K, V> val = e.getValue();
+
+                val.writeLock().lock();
+
+                try {
+                    ValueStatus status = val.status();
+
+                    if (acquired(status))
+                        // Another thread is helping us, continue to the next entry.
+                        continue;
+
+                    if (status == ValueStatus.RETRY)
+                        retryEntriesCnt.decrementAndGet();
+
+                    assert retryEntriesCnt.get() >= 0;
+
+                    val.status(ValueStatus.PENDING);
+
+                    // We scan for the next operation and apply batch on operation change. Null means new batch.
+                    if (operation == null)
+                        operation = val.operation();
+
+                    if (operation != val.operation()) {
+                        // Operation is changed, so we need to perform a batch.
+                        batch = pending;
+                        pending = U.newLinkedHashMap(batchSize);
+
+                        operation = val.operation();
+
+                        pending.put(e.getKey(), val);
+                    }
+                    else
+                        pending.put(e.getKey(), val);
+
+                    if (pending.size() == batchSize) {
+                        batch = pending;
+                        pending = U.newLinkedHashMap(batchSize);
+
+                        operation = null;
+                    }
+                }
+                finally {
+                    val.writeLock().unlock();
+                }
+
+                if (batch != null && !batch.isEmpty()) {
+                    applyBatch(batch, true);
+                    batch = null;
+                }
+            }
+
+            // Process the remainder.
+            if (!pending.isEmpty())
+                applyBatch(pending, true);
+        }
+    }
+
+    /**
+     * For test purposes only.
+     *
+     * @return Write cache for the underlying store operations.
+     */
+    Map<K, StatefulValue<K, V>> writeCache() {
+        return writeCache;
+    }
+
+    /**
+     * Enumeration that represents possible operations on the underlying store.
+     */
+    private enum StoreOperation {
+        /** Put key-value pair to the underlying store. */
+        PUT,
+
+        /** Remove key from the underlying store. */
+        RMV
+    }
+
+    /**
+     * Enumeration that represents possible states of value in the map.
+     */
+    private enum ValueStatus {
+        /** Value is scheduled for write or delete from the underlying cache but has not been captured by flusher. */
+        NEW,
+
+        /** Value is captured by flusher and store operation is performed at the moment. */
+        PENDING,
+
+        /** Store operation has failed and it will be re-tried at the next flush. */
+        RETRY,
+
+        /** Store operation succeeded and this value will be removed by flusher. */
+        FLUSHED,
+    }
+
+    /**
+     * Checks if given status indicates pending or complete flush operation.
+     *
+     * @param status Status to check.
+     * @return {@code true} if status indicates any pending or complete store update operation.
+     */
+    private boolean acquired(ValueStatus status) {
+        return status == ValueStatus.PENDING || status == ValueStatus.FLUSHED;
+    }
+
+    /**
+     * A state-value-operation trio.
+     *
+     * @param <V> Value type.
+     */
+    private static class StatefulValue<K, V> extends ReentrantReadWriteLock {
+        /** */
+        private static final long serialVersionUID = 0L;
+
+        /** Value. */
+        @GridToStringInclude
+        private Entry<? extends K, ? extends V> val;
+
+        /** Store operation. */
+        private StoreOperation storeOperation;
+
+        /** Value status. */
+        private ValueStatus valStatus;
+
+        /** Condition to wait for flush event */
+        private Condition flushCond = writeLock().newCondition();
+
+        /**
+         * Creates a state-value pair with {@link ValueStatus#NEW} status.
+         *
+         * @param val Value.
+         * @param storeOperation Store operation.
+         */
+        private StatefulValue(Entry<? extends K, ? extends V> val, StoreOperation storeOperation) {
+            assert storeOperation == StoreOperation.PUT || storeOperation == StoreOperation.RMV;
+
+            this.val = val;
+            this.storeOperation = storeOperation;
+            valStatus = ValueStatus.NEW;
+        }
+
+        /**
+         * @return Stored value.
+         */
+        private Entry<? extends K, ? extends V> entry() {
+            return val;
+        }
+
+        /**
+         * @return Store operation.
+         */
+        private StoreOperation operation() {
+            return storeOperation;
+        }
+
+        /**
+         * @return Value status
+         */
+        private ValueStatus status() {
+            return valStatus;
+        }
+
+        /**
+         * Updates value status.
+         *
+         * @param valStatus Value status.
+         */
+        private void status(ValueStatus valStatus) {
+            this.valStatus = valStatus;
+        }
+
+        /**
+         * Updates both value and value status.
+         *
+         * @param val Value.
+         * @param storeOperation Store operation.
+         * @param valStatus Value status.
+         */
+        private void update(@Nullable Entry<? extends K, ? extends V> val,
+            StoreOperation storeOperation,
+            ValueStatus valStatus) {
+            this.val = val;
+            this.storeOperation = storeOperation;
+            this.valStatus = valStatus;
+        }
+
+        /**
+         * Awaits a signal on flush condition
+         *
+         * @throws IgniteInterruptedCheckedException If thread was interrupted.
+         */
+        private void waitForFlush() throws IgniteInterruptedCheckedException {
+            U.await(flushCond);
+        }
+
+        /**
+         * Signals flush condition.
+         */
+        @SuppressWarnings({"SignalWithoutCorrespondingAwait"})
+        private void signalFlushed() {
+            flushCond.signalAll();
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean equals(Object o) {
+            if (this == o)
+                return true;
+
+            if (!(o instanceof StatefulValue))
+                return false;
+
+            StatefulValue other = (StatefulValue)o;
+
+            return F.eq(val, other.val) && F.eq(valStatus, other.valStatus);
+        }
+
+        /** {@inheritDoc} */
+        @Override public int hashCode() {
+            int res = val != null ? val.hashCode() : 0;
+
+            res = 31 * res + valStatus.hashCode();
+
+            return res;
+        }
+
+        /** {@inheritDoc} */
+        @Override public String toString() {
+            return S.toString(StatefulValue.class, this);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c6629012/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
index acd3202..1b66b4a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
@@ -24,6 +24,7 @@ import org.apache.ignite.internal.managers.communication.*;
 import org.apache.ignite.internal.processors.affinity.*;
 import org.apache.ignite.internal.processors.cache.*;
 import org.apache.ignite.internal.processors.cache.distributed.near.*;
+import org.apache.ignite.internal.processors.cache.store.*;
 import org.apache.ignite.internal.processors.cache.version.*;
 import org.apache.ignite.internal.transactions.*;
 import org.apache.ignite.internal.util.*;
@@ -444,11 +445,11 @@ public abstract class IgniteTxAdapter extends GridMetadataAwareAdapter
      *
      * @return Store manager.
      */
-    protected GridCacheStoreManager store() {
+    protected CacheStoreManager store() {
         if (!activeCacheIds().isEmpty()) {
             int cacheId = F.first(activeCacheIds());
 
-            GridCacheStoreManager store = cctx.cacheContext(cacheId).store();
+            CacheStoreManager store = cctx.cacheContext(cacheId).store();
 
             return store.configured() ? store : null;
         }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c6629012/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
index f2407ce..10146a4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
@@ -25,6 +25,7 @@ import org.apache.ignite.internal.managers.communication.*;
 import org.apache.ignite.internal.processors.cache.*;
 import org.apache.ignite.internal.processors.cache.distributed.near.*;
 import org.apache.ignite.internal.processors.cache.dr.*;
+import org.apache.ignite.internal.processors.cache.store.*;
 import org.apache.ignite.internal.processors.cache.version.*;
 import org.apache.ignite.internal.processors.dr.*;
 import org.apache.ignite.internal.transactions.*;
@@ -370,7 +371,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
                 }
 
                 return new GridFinishedFuture<>(
-                    cacheCtx.store().loadAllFromStore(this, keys, c));
+                    cacheCtx.store().loadAll(this, keys, c));
             }
             catch (IgniteCheckedException e) {
                 return new GridFinishedFuture<>(e);
@@ -387,7 +388,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
                             return false;
                         }
 
-                        return cacheCtx.store().loadAllFromStore(IgniteTxLocalAdapter.this, keys, c);
+                        return cacheCtx.store().loadAll(IgniteTxLocalAdapter.this, keys, c);
                     }
                 },
                 true);
@@ -492,17 +493,17 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
      */
     @SuppressWarnings({"CatchGenericClass"})
     protected void batchStoreCommit(Iterable<IgniteTxEntry> writeEntries) throws IgniteCheckedException {
-        GridCacheStoreManager store = store();
+        CacheStoreManager store = store();
 
-        if (store != null && store.writeThrough() && storeEnabled() &&
-            (!internal() || groupLock()) && (near() || store.writeToStoreFromDht())) {
+        if (store != null && store.isWriteThrough() && storeEnabled() &&
+            (!internal() || groupLock()) && (near() || store.isWriteToStoreFromDht())) {
             try {
                 if (writeEntries != null) {
                     Map<Object, IgniteBiTuple<Object, GridCacheVersion>> putMap = null;
                     List<Object> rmvCol = null;
-                    GridCacheStoreManager writeStore = null;
+                    CacheStoreManager writeStore = null;
 
-                    boolean skipNear = near() && store.writeToStoreFromDht();
+                    boolean skipNear = near() && store.isWriteToStoreFromDht();
 
                     for (IgniteTxEntry e : writeEntries) {
                         if (skipNear && e.cached().isNear())
@@ -527,7 +528,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
                             if (rmvCol != null && !rmvCol.isEmpty()) {
                                 assert writeStore != null;
 
-                                writeStore.removeAllFromStore(this, rmvCol);
+                                writeStore.removeAll(this, rmvCol);
 
                                 // Reset.
                                 rmvCol.clear();
@@ -537,7 +538,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
 
                             // Batch-process puts if cache ID has changed.
                             if (writeStore != null && writeStore != cacheCtx.store() && putMap != null && !putMap.isEmpty()) {
-                                writeStore.putAllToStore(this, putMap);
+                                writeStore.putAll(this, putMap);
 
                                 // Reset.
                                 putMap.clear();
@@ -568,7 +569,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
                             if (putMap != null && !putMap.isEmpty()) {
                                 assert writeStore != null;
 
-                                writeStore.putAllToStore(this, putMap);
+                                writeStore.putAll(this, putMap);
 
                                 // Reset.
                                 putMap.clear();
@@ -577,7 +578,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
                             }
 
                             if (writeStore != null && writeStore != cacheCtx.store() && rmvCol != null && !rmvCol.isEmpty()) {
-                                writeStore.removeAllFromStore(this, rmvCol);
+                                writeStore.removeAll(this, rmvCol);
 
                                 // Reset.
                                 rmvCol.clear();
@@ -609,7 +610,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
                         assert writeStore != null;
 
                         // Batch put at the end of transaction.
-                        writeStore.putAllToStore(this, putMap);
+                        writeStore.putAll(this, putMap);
                     }
 
                     if (rmvCol != null && !rmvCol.isEmpty()) {
@@ -617,12 +618,12 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
                         assert writeStore != null;
 
                         // Batch remove at the end of transaction.
-                        writeStore.removeAllFromStore(this, rmvCol);
+                        writeStore.removeAll(this, rmvCol);
                     }
                 }
 
                 // Commit while locks are held.
-                store.txEnd(this, true);
+                store.sessionEnd(this, true);
             }
             catch (IgniteCheckedException ex) {
                 commitError(ex);
@@ -981,11 +982,11 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
             }
         }
         else {
-            GridCacheStoreManager store = store();
+            CacheStoreManager store = store();
 
             if (store != null && (!internal() || groupLock())) {
                 try {
-                    store.txEnd(this, true);
+                    store.sessionEnd(this, true);
                 }
                 catch (IgniteCheckedException e) {
                     commitError(e);
@@ -1086,11 +1087,11 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
 
                 cctx.tm().rollbackTx(this);
 
-                GridCacheStoreManager store = store();
+                CacheStoreManager store = store();
 
-                if (store != null && (near() || store.writeToStoreFromDht())) {
+                if (store != null && (near() || store.isWriteToStoreFromDht())) {
                     if (!internal() || groupLock())
-                        store.txEnd(this, false);
+                        store.sessionEnd(this, false);
                 }
             }
             catch (Error | IgniteCheckedException | RuntimeException e) {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c6629012/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessor.java
index 42586d2..6a8117f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessor.java
@@ -156,10 +156,4 @@ public interface IgniteCacheObjectProcessor extends GridProcessor {
      *          with {@link IgniteImmutable} annotation.
      */
     public boolean immutable(Object obj);
-
-    /**
-     * @param cacheName Cache name.
-     * @return {@code True} if portable format should be preserved when passing values to cache store.
-     */
-    public boolean keepPortableInStore(@Nullable String cacheName);
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c6629012/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessorImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessorImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessorImpl.java
index f65b7bd..6e46757 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessorImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessorImpl.java
@@ -234,11 +234,6 @@ public class IgniteCacheObjectProcessorImpl extends GridProcessorAdapter impleme
     }
 
     /** {@inheritDoc} */
-    @Override public boolean keepPortableInStore(@Nullable String cacheName) {
-        return false;
-    }
-
-    /** {@inheritDoc} */
     @Override public void onCacheProcessorStarted() {
         // No-op.
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c6629012/modules/core/src/main/java/org/apache/ignite/internal/processors/plugin/CachePluginManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/plugin/CachePluginManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/plugin/CachePluginManager.java
index 69ca1ae..580ff49 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/plugin/CachePluginManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/plugin/CachePluginManager.java
@@ -22,6 +22,7 @@ import org.apache.ignite.configuration.*;
 import org.apache.ignite.internal.*;
 import org.apache.ignite.internal.processors.cache.*;
 import org.apache.ignite.internal.processors.cache.dr.*;
+import org.apache.ignite.internal.processors.cache.store.*;
 import org.apache.ignite.plugin.*;
 
 import java.util.*;
@@ -76,10 +77,13 @@ public class CachePluginManager extends GridCacheManagerAdapter {
     /**
      * Creates optional component.
      *
+     * @param ctx Kernal context.
+     * @param cfg Cache configuration.
      * @param cls Component class.
      * @return Created component.
      */
-    public <T> T createComponent(Class<T> cls) {
+    @SuppressWarnings("unchecked")
+    public <T> T createComponent(GridKernalContext ctx, CacheConfiguration cfg, Class<T> cls) {
         for (CachePluginProvider provider : providers) {
             T res = (T)provider.createComponent(cls);
             
@@ -91,6 +95,8 @@ public class CachePluginManager extends GridCacheManagerAdapter {
             return (T)new GridOsCacheDrManager();
         else if (cls.equals(CacheConflictResolutionManager.class))
             return (T)new CacheOsConflictResolutionManager<>();
+        else if (cls.equals(CacheStoreManager.class))
+            return (T)new CacheOsStoreManager(ctx, cfg);
 
         throw new IgniteException("Unsupported component type: " + cls);
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c6629012/modules/core/src/main/resources/META-INF/classnames.properties
----------------------------------------------------------------------
diff --git a/modules/core/src/main/resources/META-INF/classnames.properties b/modules/core/src/main/resources/META-INF/classnames.properties
index 55c1f9d..d7213a4 100644
--- a/modules/core/src/main/resources/META-INF/classnames.properties
+++ b/modules/core/src/main/resources/META-INF/classnames.properties
@@ -389,10 +389,10 @@ org.apache.ignite.internal.processors.cache.GridCacheProcessor$LocalAffinityFunc
 org.apache.ignite.internal.processors.cache.GridCacheProjectionImpl
 org.apache.ignite.internal.processors.cache.GridCacheProxyImpl
 org.apache.ignite.internal.processors.cache.GridCacheReturn
-org.apache.ignite.internal.processors.cache.GridCacheStoreManager$1
-org.apache.ignite.internal.processors.cache.GridCacheStoreManager$2
-org.apache.ignite.internal.processors.cache.GridCacheStoreManager$3
-org.apache.ignite.internal.processors.cache.GridCacheStoreManager$4
+org.apache.ignite.internal.processors.cache.store.GridCacheStoreManagerAdapter$1
+org.apache.ignite.internal.processors.cache.store.GridCacheStoreManagerAdapter$2
+org.apache.ignite.internal.processors.cache.store.GridCacheStoreManagerAdapter$3
+org.apache.ignite.internal.processors.cache.store.GridCacheStoreManagerAdapter$4
 org.apache.ignite.internal.processors.cache.GridCacheSwapManager$10
 org.apache.ignite.internal.processors.cache.GridCacheSwapManager$12
 org.apache.ignite.internal.processors.cache.GridCacheSwapManager$14
@@ -433,9 +433,9 @@ org.apache.ignite.internal.processors.cache.GridCacheUtils$8
 org.apache.ignite.internal.processors.cache.GridCacheUtils$9
 org.apache.ignite.internal.processors.cache.GridCacheValueCollection
 org.apache.ignite.internal.processors.cache.GridCacheValueCollection$1
-org.apache.ignite.internal.processors.cache.GridCacheWriteBehindStore$StatefulValue
-org.apache.ignite.internal.processors.cache.GridCacheWriteBehindStore$StoreOperation
-org.apache.ignite.internal.processors.cache.GridCacheWriteBehindStore$ValueStatus
+org.apache.ignite.internal.processors.cache.store.GridCacheWriteBehindStore$StatefulValue
+org.apache.ignite.internal.processors.cache.store.GridCacheWriteBehindStore$StoreOperation
+org.apache.ignite.internal.processors.cache.store.GridCacheWriteBehindStore$ValueStatus
 org.apache.ignite.internal.processors.cache.IgniteCacheProxy
 org.apache.ignite.internal.processors.cache.IgniteCacheProxy$1
 org.apache.ignite.internal.processors.cache.IgniteCacheProxy$2

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c6629012/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePartitionedWritesTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePartitionedWritesTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePartitionedWritesTest.java
index b9f9602..c4ba385 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePartitionedWritesTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePartitionedWritesTest.java
@@ -26,14 +26,13 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
 import org.apache.ignite.testframework.junits.common.*;
 import org.apache.ignite.transactions.*;
 
-import javax.cache.configuration.*;
 import java.util.concurrent.atomic.*;
 
 import static org.apache.ignite.cache.CacheAtomicityMode.*;
 
 /**
  * Test that in {@link CacheMode#PARTITIONED} mode cache writes values only to the near cache store. <p/> This check
- * is needed because in current implementation if {@link GridCacheWriteBehindStore} assumes that and user store is
+ * is needed because in current implementation if {@link org.apache.ignite.internal.processors.cache.store.GridCacheWriteBehindStore} assumes that and user store is
  * wrapped only in near cache (see {@link GridCacheProcessor} init logic).
  */
 @SuppressWarnings({"unchecked"})

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c6629012/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheWriteBehindStoreAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheWriteBehindStoreAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheWriteBehindStoreAbstractSelfTest.java
deleted file mode 100644
index 883a216..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheWriteBehindStoreAbstractSelfTest.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache;
-
-import org.apache.ignite.internal.*;
-import org.apache.ignite.internal.util.typedef.internal.*;
-import org.apache.ignite.testframework.junits.common.*;
-
-import java.util.*;
-import java.util.concurrent.*;
-import java.util.concurrent.atomic.*;
-
-/**
- * Harness for {@link GridCacheWriteBehindStore} tests.
- */
-public abstract class GridCacheWriteBehindStoreAbstractSelfTest extends GridCommonAbstractTest {
-    /** Write cache size. */
-    public static final int CACHE_SIZE = 1024;
-
-    /** Value dump interval. */
-    public static final int FLUSH_FREQUENCY = 1000;
-
-    /** Underlying store. */
-    protected GridCacheTestStore delegate = new GridCacheTestStore();
-
-    /** Tested store. */
-    protected GridCacheWriteBehindStore<Integer, String> store;
-
-    /** {@inheritDoc} */
-    @Override protected void afterTestsStopped() throws Exception {
-        delegate = null;
-        store = null;
-
-        super.afterTestsStopped();
-    }
-
-    /**
-     * Initializes store.
-     *
-     * @param flushThreadCnt Count of flush threads
-     * @throws Exception If failed.
-     */
-    protected void initStore(int flushThreadCnt) throws Exception {
-        store = new GridCacheWriteBehindStore<>(null, "", "", log, delegate);
-
-        store.setFlushFrequency(FLUSH_FREQUENCY);
-
-        store.setFlushSize(CACHE_SIZE);
-
-        store.setFlushThreadCount(flushThreadCnt);
-
-        delegate.reset();
-
-        store.start();
-    }
-
-    /**
-     * Shutdowns store.
-     *
-     * @throws Exception If failed.
-     */
-    protected void shutdownStore() throws Exception {
-        store.stop();
-
-        assertTrue("Store cache must be empty after shutdown", store.writeCache().isEmpty());
-    }
-
-    /**
-     * Performs multiple put, get and remove operations in several threads on a store. After
-     * all threads finished their operations, returns the total set of keys that should be
-     * in underlying store.
-     *
-     * @param threadCnt Count of threads that should update keys.
-     * @param keysPerThread Count of unique keys assigned to a thread.
-     * @return Set of keys that was totally put in store.
-     * @throws Exception If failed.
-     */
-    protected Set<Integer> runPutGetRemoveMultithreaded(int threadCnt, final int keysPerThread) throws Exception {
-        final ConcurrentMap<String, Set<Integer>> perThread = new ConcurrentHashMap<>();
-
-        final AtomicBoolean running = new AtomicBoolean(true);
-
-        final AtomicInteger cntr = new AtomicInteger();
-
-        final AtomicInteger operations = new AtomicInteger();
-
-        IgniteInternalFuture<?> fut = multithreadedAsync(new Runnable() {
-            @SuppressWarnings({"NullableProblems"})
-            @Override public void run() {
-                // Initialize key set for this thread.
-                Set<Integer> set = new HashSet<>();
-
-                Set<Integer> old = perThread.putIfAbsent(Thread.currentThread().getName(), set);
-
-                if (old != null)
-                    set = old;
-
-                List<Integer> original = new ArrayList<>();
-
-                Random rnd = new Random();
-
-                for (int i = 0; i < keysPerThread; i++)
-                    original.add(cntr.getAndIncrement());
-
-                try {
-                    while (running.get()) {
-                        int op = rnd.nextInt(3);
-                        int idx = rnd.nextInt(keysPerThread);
-
-                        int key = original.get(idx);
-
-                        switch (op) {
-                            case 0:
-                                store.write(new CacheEntryImpl<>(key, "val" + key));
-                                set.add(key);
-
-                                operations.incrementAndGet();
-
-                                break;
-
-                            case 1:
-                                store.delete(key);
-                                set.remove(key);
-
-                                operations.incrementAndGet();
-
-                                break;
-
-                            case 2:
-                            default:
-                                store.write(new CacheEntryImpl<>(key, "broken"));
-
-                                String val = store.load(key);
-
-                                assertEquals("Invalid intermediate value: " + val, "broken", val);
-
-                                store.write(new CacheEntryImpl<>(key, "val" + key));
-
-                                set.add(key);
-
-                                // 2 put operations performed here.
-                                operations.incrementAndGet();
-                                operations.incrementAndGet();
-                                operations.incrementAndGet();
-
-                                break;
-                        }
-                    }
-                }
-                catch (Exception e) {
-                    error("Unexpected exception in put thread", e);
-
-                    assert false;
-                }
-            }
-        }, threadCnt, "put");
-
-        U.sleep(10000);
-
-        running.set(false);
-
-        fut.get();
-
-        log().info(">>> " + operations + " operations performed totally");
-
-        Set<Integer> total = new HashSet<>();
-
-        for (Set<Integer> threadVals : perThread.values()) {
-            total.addAll(threadVals);
-        }
-
-        return total;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c6629012/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheWriteBehindStoreAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheWriteBehindStoreAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheWriteBehindStoreAbstractTest.java
deleted file mode 100644
index 305b8bb..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheWriteBehindStoreAbstractTest.java
+++ /dev/null
@@ -1,349 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache;
-
-import org.apache.ignite.*;
-import org.apache.ignite.cache.*;
-import org.apache.ignite.configuration.*;
-import org.apache.ignite.internal.*;
-import org.apache.ignite.internal.util.typedef.internal.*;
-import org.apache.ignite.spi.discovery.tcp.*;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
-import org.apache.ignite.testframework.junits.common.*;
-import org.apache.ignite.transactions.*;
-import org.jetbrains.annotations.*;
-
-import javax.cache.configuration.*;
-import java.util.*;
-import java.util.concurrent.*;
-import java.util.concurrent.atomic.*;
-
-import static org.apache.ignite.cache.CacheAtomicityMode.*;
-import static org.apache.ignite.transactions.TransactionConcurrency.*;
-import static org.apache.ignite.transactions.TransactionIsolation.*;
-
-/**
- * Basic store test.
- */
-public abstract class GridCacheWriteBehindStoreAbstractTest extends GridCommonAbstractTest {
-    /** Flush frequency. */
-    private static final int WRITE_FROM_BEHIND_FLUSH_FREQUENCY = 1000;
-
-    /** Cache store. */
-    private static final GridCacheTestStore store = new GridCacheTestStore();
-
-    /**
-     *
-     */
-    protected GridCacheWriteBehindStoreAbstractTest() {
-        super(true /*start grid. */);
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void beforeTest() throws Exception {
-        store.resetTimestamp();
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTest() throws Exception {
-        IgniteCache<?, ?> cache = jcache();
-
-        if (cache != null)
-            cache.clear();
-
-        store.reset();
-    }
-
-    /** @return Caching mode. */
-    protected abstract CacheMode cacheMode();
-
-    /** {@inheritDoc} */
-    @SuppressWarnings("unchecked")
-    @Override protected final IgniteConfiguration getConfiguration() throws Exception {
-        IgniteConfiguration c = super.getConfiguration();
-
-        TcpDiscoverySpi disco = new TcpDiscoverySpi();
-
-        disco.setIpFinder(new TcpDiscoveryVmIpFinder(true));
-
-        c.setDiscoverySpi(disco);
-
-        CacheConfiguration cc = defaultCacheConfiguration();
-
-        cc.setCacheMode(cacheMode());
-        cc.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
-        cc.setSwapEnabled(false);
-        cc.setAtomicityMode(TRANSACTIONAL);
-
-        cc.setCacheStoreFactory(singletonFactory(store));
-        cc.setReadThrough(true);
-        cc.setWriteThrough(true);
-        cc.setLoadPreviousValue(true);
-
-        cc.setWriteBehindEnabled(true);
-        cc.setWriteBehindFlushFrequency(WRITE_FROM_BEHIND_FLUSH_FREQUENCY);
-
-        c.setCacheConfiguration(cc);
-
-        return c;
-    }
-
-    /** @throws Exception If test fails. */
-    public void testWriteThrough() throws Exception {
-        IgniteCache<Integer, String> cache = jcache();
-
-        Map<Integer, String> map = store.getMap();
-
-        assert map.isEmpty();
-
-        Transaction tx = grid().transactions().txStart(OPTIMISTIC, REPEATABLE_READ);
-
-        try {
-            for (int i = 1; i <= 10; i++) {
-                cache.put(i, Integer.toString(i));
-
-                checkLastMethod(null);
-            }
-
-            tx.commit();
-        }
-        finally {
-            tx.close();
-        }
-
-        // Need to wait WFB flush timeout.
-        U.sleep(WRITE_FROM_BEHIND_FLUSH_FREQUENCY + 100);
-
-        checkLastMethod("putAll");
-
-        assert cache.size() == 10;
-
-        for (int i = 1; i <= 10; i++) {
-            String val = map.get(i);
-
-            assert val != null;
-            assert val.equals(Integer.toString(i));
-        }
-
-        store.resetLastMethod();
-
-        tx = grid().transactions().txStart();
-
-        try {
-            for (int i = 1; i <= 10; i++) {
-                String val = cache.getAndRemove(i);
-
-                checkLastMethod(null);
-
-                assert val != null;
-                assert val.equals(Integer.toString(i));
-            }
-
-            tx.commit();
-        }
-        finally {
-            tx.close();
-        }
-
-        // Need to wait WFB flush timeout.
-        U.sleep(WRITE_FROM_BEHIND_FLUSH_FREQUENCY + 100);
-
-        checkLastMethod("removeAll");
-
-        assert map.isEmpty();
-    }
-
-    /** @throws Exception If test failed. */
-    public void testReadThrough() throws Exception {
-        IgniteCache<Integer, String> cache = jcache();
-
-        Map<Integer, String> map = store.getMap();
-
-        assert map.isEmpty();
-
-        try (Transaction tx = grid().transactions().txStart(OPTIMISTIC, REPEATABLE_READ)) {
-            for (int i = 1; i <= 10; i++)
-                cache.put(i, Integer.toString(i));
-
-            checkLastMethod(null);
-
-            tx.commit();
-        }
-
-        // Need to wait WFB flush timeout.
-        U.sleep(WRITE_FROM_BEHIND_FLUSH_FREQUENCY + 100);
-
-        checkLastMethod("putAll");
-
-        for (int i = 1; i <= 10; i++) {
-            String val = map.get(i);
-
-            assert val != null;
-            assert val.equals(Integer.toString(i));
-        }
-
-        cache.clear();
-
-        assert cache.localSize() == 0;
-        assert cache.localSize() == 0;
-
-        // Need to wait WFB flush timeout.
-        U.sleep(WRITE_FROM_BEHIND_FLUSH_FREQUENCY + 100);
-
-        assert map.size() == 10;
-
-        for (int i = 1; i <= 10; i++) {
-            // Read through.
-            String val = cache.get(i);
-
-            checkLastMethod("load");
-
-            assert val != null;
-            assert val.equals(Integer.toString(i));
-        }
-
-        assert cache.size() == 10;
-
-        cache.clear();
-
-        assert cache.localSize() == 0;
-        assert cache.localSize() == 0;
-
-        assert map.size() == 10;
-
-        Set<Integer> keys = new HashSet<>();
-
-        for (int i = 1; i <= 10; i++)
-            keys.add(i);
-
-        // Read through.
-        Map<Integer, String> vals = cache.getAll(keys);
-
-        checkLastMethod("loadAll");
-
-        assert vals != null;
-        assert vals.size() == 10;
-
-        for (int i = 1; i <= 10; i++) {
-            String val = vals.get(i);
-
-            assert val != null;
-            assert val.equals(Integer.toString(i));
-        }
-
-        // Write through.
-        cache.removeAll(keys);
-
-        // Need to wait WFB flush timeout.
-        U.sleep(WRITE_FROM_BEHIND_FLUSH_FREQUENCY + 100);
-
-        checkLastMethod("removeAll");
-
-        assert cache.localSize() == 0;
-        assert cache.localSize() == 0;
-
-        assert map.isEmpty();
-    }
-
-    /** @throws Exception If failed. */
-    public void testMultithreaded() throws Exception {
-        final ConcurrentMap<String, Set<Integer>> perThread = new ConcurrentHashMap<>();
-
-        final AtomicBoolean running = new AtomicBoolean(true);
-
-        final IgniteCache<Integer, String> cache = jcache();
-
-        IgniteInternalFuture<?> fut = multithreadedAsync(new Runnable() {
-            @SuppressWarnings({"NullableProblems"})
-            @Override public void run() {
-                // Initialize key set for this thread.
-                Set<Integer> set = new HashSet<>();
-
-                Set<Integer> old = perThread.putIfAbsent(Thread.currentThread().getName(), set);
-
-                if (old != null)
-                    set = old;
-
-                Random rnd = new Random();
-
-                int keyCnt = 20000;
-
-                while (running.get()) {
-                    int op = rnd.nextInt(2);
-                    int key = rnd.nextInt(keyCnt);
-
-                    switch (op) {
-                        case 0:
-                            cache.put(key, "val" + key);
-                            set.add(key);
-
-                            break;
-
-                        case 1:
-                        default:
-                            cache.remove(key);
-                            set.remove(key);
-
-                            break;
-                    }
-                }
-            }
-        }, 10, "put");
-
-        U.sleep(10000);
-
-        running.set(false);
-
-        fut.get();
-
-        U.sleep(5 * WRITE_FROM_BEHIND_FLUSH_FREQUENCY);
-
-        Map<Integer, String> stored = store.getMap();
-
-        for (Map.Entry<Integer, String> entry : stored.entrySet()) {
-            int key = entry.getKey();
-
-            assertEquals("Invalid value for key " + key, "val" + key, entry.getValue());
-
-            boolean found = false;
-
-            for (Set<Integer> threadPuts : perThread.values()) {
-                if (threadPuts.contains(key)) {
-                    found = true;
-
-                    break;
-                }
-            }
-
-            assert found : "No threads found that put key " + key;
-        }
-    }
-
-    /** @param mtd Expected last method value. */
-    private void checkLastMethod(@Nullable String mtd) {
-        String lastMtd = store.getLastMethod();
-
-        if (mtd == null)
-            assert lastMtd == null : "Last method must be null: " + lastMtd;
-        else {
-            assert lastMtd != null : "Last method must be not null";
-            assert lastMtd.equals(mtd) : "Last method does not match [expected=" + mtd + ", lastMtd=" + lastMtd + ']';
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c6629012/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheWriteBehindStoreLocalTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheWriteBehindStoreLocalTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheWriteBehindStoreLocalTest.java
deleted file mode 100644
index 6c050ca..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheWriteBehindStoreLocalTest.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache;
-
-import org.apache.ignite.cache.*;
-
-/**
- * Tests {@link GridCacheWriteBehindStore} in grid configuration.
- */
-public class GridCacheWriteBehindStoreLocalTest extends GridCacheWriteBehindStoreAbstractTest {
-    /** {@inheritDoc} */
-    @Override protected CacheMode cacheMode() {
-        return CacheMode.LOCAL;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c6629012/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheWriteBehindStoreMultithreadedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheWriteBehindStoreMultithreadedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheWriteBehindStoreMultithreadedSelfTest.java
deleted file mode 100644
index 9607784..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheWriteBehindStoreMultithreadedSelfTest.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache;
-
-import org.apache.ignite.internal.util.typedef.internal.*;
-
-import java.util.*;
-
-/**
- * Multithreaded tests for {@link GridCacheWriteBehindStore}.
- */
-public class GridCacheWriteBehindStoreMultithreadedSelfTest extends GridCacheWriteBehindStoreAbstractSelfTest {
-    /**
-     * This test performs complex set of operations on store from multiple threads.
-     *
-     * @throws Exception If failed.
-     */
-    public void testPutGetRemove() throws Exception {
-        initStore(2);
-
-        Set<Integer> exp;
-
-        try {
-            exp = runPutGetRemoveMultithreaded(10, 10);
-        }
-        finally {
-            shutdownStore();
-        }
-
-        Map<Integer, String> map = delegate.getMap();
-
-        Collection<Integer> extra = new HashSet<>(map.keySet());
-
-        extra.removeAll(exp);
-
-        assertTrue("The underlying store contains extra keys: " + extra, extra.isEmpty());
-
-        Collection<Integer> missing = new HashSet<>(exp);
-
-        missing.removeAll(map.keySet());
-
-        assertTrue("Missing keys in the underlying store: " + missing, missing.isEmpty());
-
-        for (Integer key : exp)
-            assertEquals("Invalid value for key " + key, "val" + key, map.get(key));
-    }
-
-    /**
-     * Tests that cache would keep values if underlying store fails.
-     *
-     * @throws Exception If failed.
-     */
-    public void testStoreFailure() throws Exception {
-        delegate.setShouldFail(true);
-
-        initStore(2);
-
-        Set<Integer> exp;
-
-        try {
-            exp = runPutGetRemoveMultithreaded(10, 10);
-
-            U.sleep(FLUSH_FREQUENCY);
-
-            info(">>> There are " + store.getWriteBehindErrorRetryCount() + " entries in RETRY state");
-
-            delegate.setShouldFail(false);
-
-            // Despite that we set shouldFail flag to false, flush thread may just have caught an exception.
-            // If we move store to the stopping state right away, this value will be lost. That's why this sleep
-            // is inserted here to let all exception handlers in write-behind store exit.
-            U.sleep(1000);
-        }
-        finally {
-            shutdownStore();
-        }
-
-        Map<Integer, String> map = delegate.getMap();
-
-        Collection<Integer> extra = new HashSet<>(map.keySet());
-
-        extra.removeAll(exp);
-
-        assertTrue("The underlying store contains extra keys: " + extra, extra.isEmpty());
-
-        Collection<Integer> missing = new HashSet<>(exp);
-
-        missing.removeAll(map.keySet());
-
-        assertTrue("Missing keys in the underlying store: " + missing, missing.isEmpty());
-
-        for (Integer key : exp)
-            assertEquals("Invalid value for key " + key, "val" + key, map.get(key));
-    }
-
-    /**
-     * Tests store consistency in case of high put rate, when flush is performed from the same thread
-     * as put or remove operation.
-     *
-     * @throws Exception If failed.
-     */
-    public void testFlushFromTheSameThread() throws Exception {
-        // 50 milliseconds should be enough.
-        delegate.setOperationDelay(50);
-
-        initStore(2);
-
-        Set<Integer> exp;
-
-        int start = store.getWriteBehindTotalCriticalOverflowCount();
-
-        try {
-            //We will have in total 5 * CACHE_SIZE keys that should be enough to grow map size to critical value.
-            exp = runPutGetRemoveMultithreaded(5, CACHE_SIZE);
-        }
-        finally {
-            log.info(">>> Done inserting, shutting down the store");
-
-            shutdownStore();
-        }
-
-        // Restore delay.
-        delegate.setOperationDelay(0);
-
-        Map<Integer, String> map = delegate.getMap();
-
-        int end = store.getWriteBehindTotalCriticalOverflowCount();
-
-        log.info(">>> There are " + exp.size() + " keys in store, " + (end - start) + " overflows detected");
-
-        assertTrue("No cache overflows detected (a bug or too few keys or too few delay?)", end > start);
-
-        Collection<Integer> extra = new HashSet<>(map.keySet());
-
-        extra.removeAll(exp);
-
-        assertTrue("The underlying store contains extra keys: " + extra, extra.isEmpty());
-
-        Collection<Integer> missing = new HashSet<>(exp);
-
-        missing.removeAll(map.keySet());
-
-        assertTrue("Missing keys in the underlying store: " + missing, missing.isEmpty());
-
-        for (Integer key : exp)
-            assertEquals("Invalid value for key " + key, "val" + key, map.get(key));
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c6629012/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheWriteBehindStorePartitionedMultiNodeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheWriteBehindStorePartitionedMultiNodeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheWriteBehindStorePartitionedMultiNodeSelfTest.java
deleted file mode 100644
index 8fb4f68..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheWriteBehindStorePartitionedMultiNodeSelfTest.java
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache;
-
-import org.apache.ignite.*;
-import org.apache.ignite.cache.*;
-import org.apache.ignite.cache.store.*;
-import org.apache.ignite.configuration.*;
-import org.apache.ignite.internal.*;
-import org.apache.ignite.internal.util.typedef.internal.*;
-import org.apache.ignite.spi.discovery.tcp.*;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
-import org.apache.ignite.testframework.junits.common.*;
-import org.apache.ignite.transactions.*;
-
-import java.util.*;
-
-import static org.apache.ignite.cache.CacheAtomicityMode.*;
-import static org.apache.ignite.transactions.TransactionConcurrency.*;
-import static org.apache.ignite.transactions.TransactionIsolation.*;
-
-/**
- * Tests write-behind store with near and dht commit option.
- */
-public class GridCacheWriteBehindStorePartitionedMultiNodeSelfTest extends GridCommonAbstractTest {
-    /** Grids to start. */
-    private static final int GRID_CNT = 5;
-
-    /** Ip finder. */
-    private static final TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
-
-    /** Flush frequency. */
-    public static final int WRITE_BEHIND_FLUSH_FREQ = 1000;
-
-    /** Stores per grid. */
-    private GridCacheTestStore[] stores = new GridCacheTestStore[GRID_CNT];
-
-    /** Start grid counter. */
-    private int idx;
-
-    /** {@inheritDoc} */
-    @SuppressWarnings("unchecked")
-    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
-        IgniteConfiguration c = super.getConfiguration(gridName);
-
-        TcpDiscoverySpi disco = new TcpDiscoverySpi();
-
-        disco.setIpFinder(ipFinder);
-
-        c.setDiscoverySpi(disco);
-
-        CacheConfiguration cc = defaultCacheConfiguration();
-
-        cc.setCacheMode(CacheMode.PARTITIONED);
-        cc.setWriteBehindEnabled(true);
-        cc.setWriteBehindFlushFrequency(WRITE_BEHIND_FLUSH_FREQ);
-        cc.setAtomicityMode(TRANSACTIONAL);
-        cc.setNearConfiguration(new NearCacheConfiguration());
-
-        CacheStore store = stores[idx] = new GridCacheTestStore();
-
-        cc.setCacheStoreFactory(singletonFactory(store));
-        cc.setReadThrough(true);
-        cc.setWriteThrough(true);
-        cc.setLoadPreviousValue(true);
-
-        c.setCacheConfiguration(cc);
-
-        idx++;
-
-        return c;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTestsStopped() throws Exception {
-        stores = null;
-
-        super.afterTestsStopped();
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    private void prepare() throws Exception {
-        idx = 0;
-
-        startGrids(GRID_CNT);
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTest() throws Exception {
-        super.afterTest();
-
-        stopAllGrids();
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testSingleWritesOnDhtNode() throws Exception {
-        checkSingleWrites();
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testBatchWritesOnDhtNode() throws Exception {
-        checkBatchWrites();
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testTxWritesOnDhtNode() throws Exception {
-        checkTxWrites();
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    private void checkSingleWrites() throws Exception {
-        prepare();
-
-        IgniteCache<Integer, String> cache = grid(0).cache(null);
-
-        for (int i = 0; i < 100; i++)
-            cache.put(i, String.valueOf(i));
-
-        checkWrites();
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    private void checkBatchWrites() throws Exception {
-        prepare();
-
-        Map<Integer, String> map = new HashMap<>();
-
-        for (int i = 0; i < 100; i++)
-            map.put(i, String.valueOf(i));
-
-        grid(0).cache(null).putAll(map);
-
-        checkWrites();
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    private void checkTxWrites() throws Exception {
-        prepare();
-
-        IgniteCache<Object, Object> cache = grid(0).cache(null);
-
-        try (Transaction tx = grid(0).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
-            for (int i = 0; i < 100; i++)
-                cache.put(i, String.valueOf(i));
-
-            tx.commit();
-        }
-
-        checkWrites();
-    }
-
-    /**
-     * @throws IgniteInterruptedCheckedException If sleep was interrupted.
-     */
-    private void checkWrites() throws IgniteInterruptedCheckedException {
-        U.sleep(WRITE_BEHIND_FLUSH_FREQ * 2);
-
-        Collection<Integer> allKeys = new ArrayList<>(100);
-
-        for (int i = 0; i < GRID_CNT; i++) {
-            Map<Integer,String> map = stores[i].getMap();
-
-            assertFalse("Missing writes for node: " + i, map.isEmpty());
-
-            allKeys.addAll(map.keySet());
-
-            // Check there is no intersection.
-            for (int j = 0; j < GRID_CNT; j++) {
-                if (i == j)
-                    continue;
-
-                Collection<Integer> intersection = new HashSet<>(stores[j].getMap().keySet());
-
-                intersection.retainAll(map.keySet());
-
-                assertTrue(intersection.isEmpty());
-            }
-        }
-
-        assertEquals(100, allKeys.size());
-
-        for (int i = 0; i < 100; i++)
-            assertTrue(allKeys.contains(i));
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c6629012/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheWriteBehindStorePartitionedTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheWriteBehindStorePartitionedTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheWriteBehindStorePartitionedTest.java
deleted file mode 100644
index f9e454f..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheWriteBehindStorePartitionedTest.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache;
-
-import org.apache.ignite.cache.*;
-
-/**
- * Tests {@link GridCacheWriteBehindStore} in partitioned configuration.
- */
-public class GridCacheWriteBehindStorePartitionedTest extends GridCacheWriteBehindStoreAbstractTest {
-    /** {@inheritDoc} */
-    @Override protected CacheMode cacheMode() {
-        return CacheMode.PARTITIONED;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c6629012/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheWriteBehindStoreReplicatedTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheWriteBehindStoreReplicatedTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheWriteBehindStoreReplicatedTest.java
deleted file mode 100644
index c809f90..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheWriteBehindStoreReplicatedTest.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache;
-
-import org.apache.ignite.cache.*;
-
-/**
- * Tests {@link GridCacheWriteBehindStore} in grid configuration.
- */
-public class GridCacheWriteBehindStoreReplicatedTest extends GridCacheWriteBehindStoreAbstractTest {
-    /** {@inheritDoc} */
-    @Override protected CacheMode cacheMode() {
-        return CacheMode.REPLICATED;
-    }
-}


[05/37] incubator-ignite git commit: ignite-10009: Add tests.

Posted by sb...@apache.org.
ignite-10009: Add tests.


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/b8f6904a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/b8f6904a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/b8f6904a

Branch: refs/heads/ignite-cacheplug-rmtvalid
Commit: b8f6904a37495f5473cbb9fd572ee3d9e7a7c6af
Parents: 6413426
Author: ivasilinets <iv...@gridgain.com>
Authored: Wed Apr 1 17:36:38 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Wed Apr 1 17:36:38 2015 +0300

----------------------------------------------------------------------
 .../cache/ttl/CacheTtlAbstractSelfTest.java     | 199 +++++++++++++++++++
 .../ttl/CacheTtlOffheapAbstractSelfTest.java    |  29 +++
 .../CacheTtlOffheapAtomicAbstractSelfTest.java  |  29 +++
 .../ttl/CacheTtlOffheapAtomicLocalSelfTest.java |  34 ++++
 ...acheTtlOffheapAtomicPartitionedSelfTest.java |  34 ++++
 ...TtlOffheapTransactionalAbstractSelfTest.java |  29 +++
 ...cheTtlOffheapTransactionalLocalSelfTest.java |  34 ++++
 ...OffheapTransactionalPartitionedSelfTest.java |  34 ++++
 .../ttl/CacheTtlOnheapAbstractSelfTest.java     |  29 +++
 .../CacheTtlOnheapAtomicAbstractSelfTest.java   |  29 +++
 .../ttl/CacheTtlOnheapAtomicLocalSelfTest.java  |  34 ++++
 ...CacheTtlOnheapAtomicPartitionedSelfTest.java |  34 ++++
 ...eTtlOnheapTransactionalAbstractSelfTest.java |  29 +++
 ...acheTtlOnheapTransactionalLocalSelfTest.java |  34 ++++
 14 files changed, 611 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b8f6904a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlAbstractSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlAbstractSelfTest.java
new file mode 100644
index 0000000..25d32c0
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlAbstractSelfTest.java
@@ -0,0 +1,199 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.ttl;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.*;
+import org.apache.ignite.cache.eviction.lru.*;
+import org.apache.ignite.cache.query.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.spi.discovery.tcp.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
+import org.apache.ignite.testframework.junits.common.*;
+
+import javax.cache.expiry.*;
+import java.util.*;
+
+import static java.util.concurrent.TimeUnit.MILLISECONDS;
+
+/**
+ * TTL test.
+ */
+public abstract class CacheTtlAbstractSelfTest extends GridCommonAbstractTest {
+    /** */
+    private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+    /** */
+    private static final int MAX_CACHE_SIZE = 5;
+
+    /** */
+    private static final int SIZE = 11;
+
+    /** */
+    private static final long DEFAULT_TIME_TO_LIVE = 2000;
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        CacheConfiguration cache = new CacheConfiguration();
+
+        cache.setCacheMode(cacheMode());
+        cache.setAtomicityMode(atomicityMode());
+        cache.setMemoryMode(memoryMode());
+        cache.setOffHeapMaxMemory(0);
+        cache.setDefaultTimeToLive(DEFAULT_TIME_TO_LIVE);
+        cache.setEvictionPolicy(new LruEvictionPolicy(MAX_CACHE_SIZE));
+        cache.setIndexedTypes(Integer.class, Integer.class);
+
+        cfg.setCacheConfiguration(cache);
+
+        TcpDiscoverySpi disco = new TcpDiscoverySpi();
+
+        disco.setIpFinder(IP_FINDER);
+
+        cfg.setDiscoverySpi(disco);
+
+        return cfg;
+    }
+
+    /**
+     * @return Atomicity mode.
+     */
+    protected abstract CacheAtomicityMode atomicityMode();
+
+    /**
+     * @return Memory mode.
+     */
+    protected abstract CacheMemoryMode memoryMode();
+
+    /**
+     * @return Cache mode.
+     */
+    protected abstract CacheMode cacheMode();
+
+    /**
+     * @return GridCount
+     */
+    protected abstract int gridCount();
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        startGrids(gridCount());
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        stopAllGrids();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testDefaultTimeToLivePut() throws Exception {
+        IgniteCache<Integer, Integer> cache = jcache(0);
+
+        List<Integer> keys = primaryKeys(cache, 1);
+
+        cache.put(keys.get(0), 1);
+
+        checkSizeBeforeLive(cache, 1);
+
+        Thread.sleep(DEFAULT_TIME_TO_LIVE + 500);
+
+        checkSizeAfterLive();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testDefaultTimeToLivePutAll() throws Exception {
+        IgniteCache<Integer, Integer> cache = jcache(0);
+
+        Map<Integer, Integer> entries = new HashMap<>();
+
+        List<Integer> keys = primaryKeys(cache, SIZE);
+
+        for (int i = 0; i < SIZE; ++i)
+            entries.put(keys.get(i), i);
+
+        cache.putAll(entries);
+
+        checkSizeBeforeLive(cache, SIZE);
+
+        Thread.sleep(DEFAULT_TIME_TO_LIVE + 500);
+
+        checkSizeAfterLive();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testTimeToLiveTtl() throws Exception {
+        IgniteCache<Integer, Integer> cache = jcache(0);
+
+        long time = DEFAULT_TIME_TO_LIVE + 2000;
+
+        List<Integer> keys = primaryKeys(cache, SIZE);
+
+        for (int i = 0; i < SIZE; i++)
+            cache.withExpiryPolicy(new TouchedExpiryPolicy(new Duration(MILLISECONDS, time))).
+                put(keys.get(i), i);
+
+        checkSizeBeforeLive(cache, SIZE);
+
+        Thread.sleep(DEFAULT_TIME_TO_LIVE + 500);
+
+        checkSizeBeforeLive(cache, SIZE);
+
+        Thread.sleep(time - DEFAULT_TIME_TO_LIVE + 500);
+
+        checkSizeAfterLive();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    private void checkSizeBeforeLive(IgniteCache<Integer, Integer> cache, int size) throws Exception {
+        if (memoryMode() == CacheMemoryMode.OFFHEAP_TIERED) {
+            assertEquals(0, cache.localSize());
+            assertEquals(size, cache.localSize(CachePeekMode.OFFHEAP));
+        }
+        else {
+            assertEquals(size > MAX_CACHE_SIZE ? MAX_CACHE_SIZE : size, cache.localSize());
+            assertEquals(size > MAX_CACHE_SIZE ? size - MAX_CACHE_SIZE : 0, cache.localSize(CachePeekMode.OFFHEAP));
+        }
+
+        assertFalse(cache.query(new SqlQuery<>(Integer.class, "_val >= 0")).getAll().isEmpty());
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    private void checkSizeAfterLive() throws Exception {
+        for (int i = 0; i < gridCount(); ++i) {
+            IgniteCache<Integer, Integer> cache = jcache(i);
+
+            assertEquals(0, cache.localSize());
+            assertEquals(0, cache.localSize(CachePeekMode.OFFHEAP));
+            assertEquals(0, cache.localSize(CachePeekMode.SWAP));
+            assertEquals(0, cache.query(new SqlQuery<>(Integer.class, "_val >= 0")).getAll().size());
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b8f6904a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlOffheapAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlOffheapAbstractSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlOffheapAbstractSelfTest.java
new file mode 100644
index 0000000..59ed837
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlOffheapAbstractSelfTest.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ignite.internal.processors.cache.ttl;
+
+import org.apache.ignite.cache.*;
+
+/**
+ * TTL test with offheap.
+ */
+public abstract class CacheTtlOffheapAbstractSelfTest extends CacheTtlAbstractSelfTest {
+    /** {@inheritDoc} */
+    @Override protected CacheMemoryMode memoryMode() {
+        return CacheMemoryMode.OFFHEAP_TIERED;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b8f6904a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlOffheapAtomicAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlOffheapAtomicAbstractSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlOffheapAtomicAbstractSelfTest.java
new file mode 100644
index 0000000..aac984e
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlOffheapAtomicAbstractSelfTest.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ignite.internal.processors.cache.ttl;
+
+import org.apache.ignite.cache.*;
+
+/**
+ * TTL test with offheap.
+ */
+public abstract class CacheTtlOffheapAtomicAbstractSelfTest extends CacheTtlOffheapAbstractSelfTest {
+    /** {@inheritDoc} */
+    @Override protected CacheAtomicityMode atomicityMode() {
+        return CacheAtomicityMode.ATOMIC;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b8f6904a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlOffheapAtomicLocalSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlOffheapAtomicLocalSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlOffheapAtomicLocalSelfTest.java
new file mode 100644
index 0000000..0772c57
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlOffheapAtomicLocalSelfTest.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ignite.internal.processors.cache.ttl;
+
+import org.apache.ignite.cache.*;
+
+/**
+ * TTL test with offheap.
+ */
+public class CacheTtlOffheapAtomicLocalSelfTest extends CacheTtlOffheapAtomicAbstractSelfTest {
+    /** {@inheritDoc} */
+    @Override protected CacheMode cacheMode() {
+        return CacheMode.LOCAL;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected int gridCount() {
+        return 1;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b8f6904a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlOffheapAtomicPartitionedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlOffheapAtomicPartitionedSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlOffheapAtomicPartitionedSelfTest.java
new file mode 100644
index 0000000..9a86138
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlOffheapAtomicPartitionedSelfTest.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ignite.internal.processors.cache.ttl;
+
+import org.apache.ignite.cache.*;
+
+/**
+ * TTL test with offheap.
+ */
+public class CacheTtlOffheapAtomicPartitionedSelfTest  extends CacheTtlOffheapAtomicAbstractSelfTest {
+    /** {@inheritDoc} */
+    @Override protected CacheMode cacheMode() {
+        return CacheMode.PARTITIONED;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected int gridCount() {
+        return 2;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b8f6904a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlOffheapTransactionalAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlOffheapTransactionalAbstractSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlOffheapTransactionalAbstractSelfTest.java
new file mode 100644
index 0000000..8b73812
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlOffheapTransactionalAbstractSelfTest.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ignite.internal.processors.cache.ttl;
+
+import org.apache.ignite.cache.*;
+
+/**
+ * TTL test with offheap.
+ */
+public abstract class CacheTtlOffheapTransactionalAbstractSelfTest extends CacheTtlOffheapAbstractSelfTest {
+    /** {@inheritDoc} */
+    @Override protected CacheAtomicityMode atomicityMode() {
+        return CacheAtomicityMode.TRANSACTIONAL;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b8f6904a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlOffheapTransactionalLocalSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlOffheapTransactionalLocalSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlOffheapTransactionalLocalSelfTest.java
new file mode 100644
index 0000000..2596e76
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlOffheapTransactionalLocalSelfTest.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ignite.internal.processors.cache.ttl;
+
+import org.apache.ignite.cache.*;
+
+/**
+ * TTL test with offheap.
+ */
+public class CacheTtlOffheapTransactionalLocalSelfTest extends CacheTtlOffheapTransactionalAbstractSelfTest {
+    /** {@inheritDoc} */
+    @Override protected CacheMode cacheMode() {
+        return CacheMode.LOCAL;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected int gridCount() {
+        return 1;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b8f6904a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlOffheapTransactionalPartitionedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlOffheapTransactionalPartitionedSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlOffheapTransactionalPartitionedSelfTest.java
new file mode 100644
index 0000000..6eb52f8
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlOffheapTransactionalPartitionedSelfTest.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ignite.internal.processors.cache.ttl;
+
+import org.apache.ignite.cache.*;
+
+/**
+ * TTL test with offheap.
+ */
+public class CacheTtlOffheapTransactionalPartitionedSelfTest extends CacheTtlOffheapTransactionalAbstractSelfTest {
+    /** {@inheritDoc} */
+    @Override protected CacheMode cacheMode() {
+        return CacheMode.PARTITIONED;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected int gridCount() {
+        return 2;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b8f6904a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlOnheapAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlOnheapAbstractSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlOnheapAbstractSelfTest.java
new file mode 100644
index 0000000..7bce6d9
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlOnheapAbstractSelfTest.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ignite.internal.processors.cache.ttl;
+
+import org.apache.ignite.cache.*;
+
+/**
+ * TTL test with offheap.
+ */
+public abstract class CacheTtlOnheapAbstractSelfTest extends CacheTtlAbstractSelfTest {
+    /** {@inheritDoc} */
+    @Override protected CacheMemoryMode memoryMode() {
+        return CacheMemoryMode.ONHEAP_TIERED;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b8f6904a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlOnheapAtomicAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlOnheapAtomicAbstractSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlOnheapAtomicAbstractSelfTest.java
new file mode 100644
index 0000000..5ba9ee7
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlOnheapAtomicAbstractSelfTest.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ignite.internal.processors.cache.ttl;
+
+import org.apache.ignite.cache.*;
+
+/**
+ * TTL test with offheap.
+ */
+public abstract class CacheTtlOnheapAtomicAbstractSelfTest extends CacheTtlOnheapAbstractSelfTest {
+    /** {@inheritDoc} */
+    @Override protected CacheAtomicityMode atomicityMode() {
+        return CacheAtomicityMode.ATOMIC;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b8f6904a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlOnheapAtomicLocalSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlOnheapAtomicLocalSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlOnheapAtomicLocalSelfTest.java
new file mode 100644
index 0000000..5e5f9b9
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlOnheapAtomicLocalSelfTest.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ignite.internal.processors.cache.ttl;
+
+import org.apache.ignite.cache.*;
+
+/**
+ * TTL test with offheap.
+ */
+public class CacheTtlOnheapAtomicLocalSelfTest extends CacheTtlOnheapAtomicAbstractSelfTest {
+    /** {@inheritDoc} */
+    @Override protected CacheMode cacheMode() {
+        return CacheMode.LOCAL;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected int gridCount() {
+        return 1;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b8f6904a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlOnheapAtomicPartitionedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlOnheapAtomicPartitionedSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlOnheapAtomicPartitionedSelfTest.java
new file mode 100644
index 0000000..dc2dc95
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlOnheapAtomicPartitionedSelfTest.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ignite.internal.processors.cache.ttl;
+
+import org.apache.ignite.cache.*;
+
+/**
+ * TTL test with offheap.
+ */
+public class CacheTtlOnheapAtomicPartitionedSelfTest extends CacheTtlOnheapAtomicAbstractSelfTest {
+    /** {@inheritDoc} */
+    @Override protected CacheMode cacheMode() {
+        return CacheMode.PARTITIONED;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected int gridCount() {
+        return 2;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b8f6904a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlOnheapTransactionalAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlOnheapTransactionalAbstractSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlOnheapTransactionalAbstractSelfTest.java
new file mode 100644
index 0000000..4e9bc10
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlOnheapTransactionalAbstractSelfTest.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ignite.internal.processors.cache.ttl;
+
+import org.apache.ignite.cache.*;
+
+/**
+ * TTL test with offheap.
+ */
+public abstract class CacheTtlOnheapTransactionalAbstractSelfTest extends CacheTtlOnheapAbstractSelfTest {
+    /** {@inheritDoc} */
+    @Override protected CacheAtomicityMode atomicityMode() {
+        return CacheAtomicityMode.TRANSACTIONAL;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b8f6904a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlOnheapTransactionalLocalSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlOnheapTransactionalLocalSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlOnheapTransactionalLocalSelfTest.java
new file mode 100644
index 0000000..f68c317
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlOnheapTransactionalLocalSelfTest.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ignite.internal.processors.cache.ttl;
+
+import org.apache.ignite.cache.*;
+
+/**
+ * TTL test with offheap.
+ */
+public class CacheTtlOnheapTransactionalLocalSelfTest extends CacheTtlOnheapTransactionalAbstractSelfTest {
+    /** {@inheritDoc} */
+    @Override protected CacheMode cacheMode() {
+        return CacheMode.LOCAL;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected int gridCount() {
+        return 1;
+    }
+}


[22/37] incubator-ignite git commit: # ignite-670 more tests, use default expiry policy from isolated updater

Posted by sb...@apache.org.
# ignite-670 more tests, use default expiry policy from isolated updater


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/34c29ed7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/34c29ed7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/34c29ed7

Branch: refs/heads/ignite-cacheplug-rmtvalid
Commit: 34c29ed74578bf569bf537a57f2db642e1d58d2a
Parents: f111294
Author: sboikov <sb...@gridgain.com>
Authored: Thu Apr 2 16:24:01 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu Apr 2 16:24:01 2015 +0300

----------------------------------------------------------------------
 .../datastreamer/DataStreamerImpl.java          |  21 ++-
 .../cache/ttl/CacheTtlAbstractSelfTest.java     | 175 +++++++++++++++----
 2 files changed, 161 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/34c29ed7/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImpl.java
index 71a9364..2b470f6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImpl.java
@@ -43,6 +43,7 @@ import org.jetbrains.annotations.*;
 import org.jsr166.*;
 
 import javax.cache.*;
+import javax.cache.expiry.*;
 import java.util.*;
 import java.util.Map.*;
 import java.util.concurrent.*;
@@ -1390,6 +1391,11 @@ public class DataStreamerImpl<K, V> implements IgniteDataStreamer<K, V>, Delayed
 
                 GridCacheVersion ver = cctx.versions().next(topVer);
 
+                long ttl = CU.TTL_ETERNAL;
+                long expiryTime = CU.EXPIRE_TIME_ETERNAL;
+
+                ExpiryPolicy plc = cctx.expiry();
+
                 for (Entry<KeyCacheObject, CacheObject> e : entries) {
                     try {
                         e.getKey().finishUnmarshal(cctx.cacheObjectContext(), cctx.deploy().globalLoader());
@@ -1398,10 +1404,21 @@ public class DataStreamerImpl<K, V> implements IgniteDataStreamer<K, V>, Delayed
 
                         entry.unswap(false);
 
+                        if (plc != null) {
+                            ttl = CU.toTtl(plc.getExpiryForCreation());
+
+                            if (ttl == CU.TTL_ZERO)
+                                continue;
+                            else if (ttl == CU.TTL_NOT_CHANGED)
+                                ttl = 0;
+
+                            expiryTime = CU.toExpireTime(ttl);
+                        }
+
                         entry.initialValue(e.getValue(),
                             ver,
-                            CU.TTL_ETERNAL,
-                            CU.EXPIRE_TIME_ETERNAL,
+                            ttl,
+                            expiryTime,
                             false,
                             topVer,
                             GridDrType.DR_LOAD);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/34c29ed7/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlAbstractSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlAbstractSelfTest.java
index ebe6f16..0e2e738 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlAbstractSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlAbstractSelfTest.java
@@ -21,17 +21,22 @@ import org.apache.ignite.*;
 import org.apache.ignite.cache.*;
 import org.apache.ignite.cache.eviction.lru.*;
 import org.apache.ignite.cache.query.*;
+import org.apache.ignite.cache.store.*;
 import org.apache.ignite.configuration.*;
+import org.apache.ignite.lang.*;
 import org.apache.ignite.spi.discovery.tcp.*;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
 import org.apache.ignite.testframework.junits.common.*;
 
+import javax.cache.*;
 import javax.cache.configuration.*;
 import javax.cache.expiry.*;
+import javax.cache.integration.*;
 import java.util.*;
 
-import static java.util.concurrent.TimeUnit.MILLISECONDS;
+import static java.util.concurrent.TimeUnit.*;
+import static org.apache.ignite.cache.CachePeekMode.*;
 
 /**
  * TTL test.
@@ -61,17 +66,33 @@ public abstract class CacheTtlAbstractSelfTest extends GridCommonAbstractTest {
         cache.setOffHeapMaxMemory(0);
         cache.setEvictionPolicy(new LruEvictionPolicy(MAX_CACHE_SIZE));
         cache.setIndexedTypes(Integer.class, Integer.class);
+        cache.setBackups(2);
+
+        cache.setCacheStoreFactory(singletonFactory(new CacheStoreAdapter() {
+            @Override public void loadCache(IgniteBiInClosure clo, Object... args) {
+                for (int i = 0; i < SIZE; i++)
+                    clo.apply(i, i);
+            }
+
+            @Override public Object load(Object key) throws CacheLoaderException {
+                return key;
+            }
+
+            @Override public void write(Cache.Entry entry) throws CacheWriterException {
+                // No-op.
+            }
+
+            @Override public void delete(Object key) throws CacheWriterException {
+                // No-op.
+            }
+        }));
 
         cache.setExpiryPolicyFactory(
             FactoryBuilder.factoryOf(new TouchedExpiryPolicy(new Duration(MILLISECONDS, DEFAULT_TIME_TO_LIVE))));
 
         cfg.setCacheConfiguration(cache);
 
-        TcpDiscoverySpi disco = new TcpDiscoverySpi();
-
-        disco.setIpFinder(IP_FINDER);
-
-        cfg.setDiscoverySpi(disco);
+        ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);
 
         return cfg;
     }
@@ -109,14 +130,82 @@ public abstract class CacheTtlAbstractSelfTest extends GridCommonAbstractTest {
     /**
      * @throws Exception If failed.
      */
+    public void testDefaultTimeToLiveLoadCache() throws Exception {
+        IgniteCache<Integer, Integer> cache = jcache(0);
+
+        cache.loadCache(null);
+
+        checkSizeBeforeLive(SIZE);
+
+        Thread.sleep(DEFAULT_TIME_TO_LIVE + 500);
+
+        checkSizeAfterLive();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testDefaultTimeToLiveLoadAll() throws Exception {
+        IgniteCache<Integer, Integer> cache = jcache(0);
+
+        CompletionListenerFuture fut = new CompletionListenerFuture();
+
+        Set<Integer> keys = new HashSet<>();
+
+        for (int i = 0; i < SIZE; ++i)
+            keys.add(i);
+
+        cache.loadAll(keys, false, fut);
+
+        fut.get();
+
+        checkSizeBeforeLive(SIZE);
+
+        Thread.sleep(DEFAULT_TIME_TO_LIVE + 500);
+
+        checkSizeAfterLive();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testDefaultTimeToLiveStreamerAdd() throws Exception {
+        try (IgniteDataStreamer<Integer, Integer> streamer = ignite(0).dataStreamer(null)) {
+            for (int i = 0; i < SIZE; i++)
+                streamer.addData(i, i);
+        }
+
+        checkSizeBeforeLive(SIZE);
+
+        Thread.sleep(DEFAULT_TIME_TO_LIVE + 500);
+
+        checkSizeAfterLive();
+
+        try (IgniteDataStreamer<Integer, Integer> streamer = ignite(0).dataStreamer(null)) {
+            streamer.allowOverwrite(true);
+
+            for (int i = 0; i < SIZE; i++)
+                streamer.addData(i, i);
+        }
+
+        checkSizeBeforeLive(SIZE);
+
+        Thread.sleep(DEFAULT_TIME_TO_LIVE + 500);
+
+        checkSizeAfterLive();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
     public void testDefaultTimeToLivePut() throws Exception {
         IgniteCache<Integer, Integer> cache = jcache(0);
 
-        List<Integer> keys = primaryKeys(cache, 1);
+        Integer key = 0;
 
-        cache.put(keys.get(0), 1);
+        cache.put(key, 1);
 
-        checkSizeBeforeLive(cache, 1);
+        checkSizeBeforeLive(1);
 
         Thread.sleep(DEFAULT_TIME_TO_LIVE + 500);
 
@@ -131,14 +220,12 @@ public abstract class CacheTtlAbstractSelfTest extends GridCommonAbstractTest {
 
         Map<Integer, Integer> entries = new HashMap<>();
 
-        List<Integer> keys = primaryKeys(cache, SIZE);
-
         for (int i = 0; i < SIZE; ++i)
-            entries.put(keys.get(i), i);
+            entries.put(i, i);
 
         cache.putAll(entries);
 
-        checkSizeBeforeLive(cache, SIZE);
+        checkSizeBeforeLive(SIZE);
 
         Thread.sleep(DEFAULT_TIME_TO_LIVE + 500);
 
@@ -149,54 +236,76 @@ public abstract class CacheTtlAbstractSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testTimeToLiveTtl() throws Exception {
-        IgniteCache<Integer, Integer> cache = jcache(0);
-
         long time = DEFAULT_TIME_TO_LIVE + 2000;
 
-        List<Integer> keys = primaryKeys(cache, SIZE);
+        IgniteCache<Integer, Integer> cache = this.<Integer, Integer>jcache(0).withExpiryPolicy(
+            new TouchedExpiryPolicy(new Duration(MILLISECONDS, time)));
 
         for (int i = 0; i < SIZE; i++)
-            cache.withExpiryPolicy(new TouchedExpiryPolicy(new Duration(MILLISECONDS, time))).
-                put(keys.get(i), i);
+            cache.put(i, i);
 
-        checkSizeBeforeLive(cache, SIZE);
+        checkSizeBeforeLive(SIZE);
 
         Thread.sleep(DEFAULT_TIME_TO_LIVE + 500);
 
-        checkSizeBeforeLive(cache, SIZE);
+        checkSizeBeforeLive(SIZE);
 
         Thread.sleep(time - DEFAULT_TIME_TO_LIVE + 500);
 
         checkSizeAfterLive();
     }
 
+    private void checkSizeBeforeLive(int size) throws Exception {
+        checkSizeBeforeLive(size, gridCount());
+    }
+
     /**
+     * @param size Expected size.
+     * @param gridCnt Number of nodes.
      * @throws Exception If failed.
      */
-    private void checkSizeBeforeLive(IgniteCache<Integer, Integer> cache, int size) throws Exception {
-        if (memoryMode() == CacheMemoryMode.OFFHEAP_TIERED) {
-            assertEquals(0, cache.localSize(CachePeekMode.ONHEAP));
-            assertEquals(size, cache.localSize(CachePeekMode.OFFHEAP));
-        }
-        else {
-            assertEquals(size > MAX_CACHE_SIZE ? MAX_CACHE_SIZE : size, cache.localSize(CachePeekMode.ONHEAP));
-            assertEquals(size > MAX_CACHE_SIZE ? size - MAX_CACHE_SIZE : 0, cache.localSize(CachePeekMode.OFFHEAP));
-        }
+    private void checkSizeBeforeLive(int size, int gridCnt) throws Exception {
+        for (int i = 0; i < gridCnt; ++i) {
+            IgniteCache<Integer, Integer> cache = jcache(i);
+
+            if (memoryMode() == CacheMemoryMode.OFFHEAP_TIERED) {
+                assertEquals("Unexpected size, node: " + i, 0, cache.localSize(ONHEAP));
+                assertEquals("Unexpected size, node: " + i, size, cache.localSize(OFFHEAP));
+            }
+            else {
+                assertEquals("Unexpected size, node: " + i, size > MAX_CACHE_SIZE ? MAX_CACHE_SIZE : size,
+                    cache.localSize(ONHEAP));
 
-        assertFalse(cache.query(new SqlQuery<>(Integer.class, "_val >= 0")).getAll().isEmpty());
+                assertEquals("Unexpected size, node: " + i,
+                    size > MAX_CACHE_SIZE ? size - MAX_CACHE_SIZE : 0, cache.localSize(OFFHEAP));
+            }
+
+            assertFalse(cache.query(new SqlQuery<>(Integer.class, "_val >= 0")).getAll().isEmpty());
+        }
     }
 
     /**
      * @throws Exception If failed.
      */
     private void checkSizeAfterLive() throws Exception {
-        for (int i = 0; i < gridCount(); ++i) {
+        checkSizeAfterLive(gridCount());
+    }
+
+    /**
+     * @param gridCnt Number of nodes.
+     * @throws Exception If failed.
+     */
+    private void checkSizeAfterLive(int gridCnt) throws Exception {
+        for (int i = 0; i < gridCnt; ++i) {
             IgniteCache<Integer, Integer> cache = jcache(i);
 
             assertEquals(0, cache.localSize());
-            assertEquals(0, cache.localSize(CachePeekMode.OFFHEAP));
-            assertEquals(0, cache.localSize(CachePeekMode.SWAP));
+            assertEquals(0, cache.localSize(OFFHEAP));
+            assertEquals(0, cache.localSize(SWAP));
             assertEquals(0, cache.query(new SqlQuery<>(Integer.class, "_val >= 0")).getAll().size());
+
+            for (int key = 0; key < SIZE; key++)
+                assertNull(cache.localPeek(key));
         }
     }
 }


[08/37] incubator-ignite git commit: Merge branch 'ignite-sprint-3' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-gg-10002

Posted by sb...@apache.org.
Merge branch 'ignite-sprint-3' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-gg-10002


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/9a629627
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/9a629627
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/9a629627

Branch: refs/heads/ignite-cacheplug-rmtvalid
Commit: 9a6296279d03732f97defa11c591e075c1cc0e71
Parents: f8d5d44 efd98ba
Author: S.Vladykin <sv...@gridgain.com>
Authored: Wed Apr 1 18:16:22 2015 +0300
Committer: S.Vladykin <sv...@gridgain.com>
Committed: Wed Apr 1 18:16:22 2015 +0300

----------------------------------------------------------------------
 examples/pom.xml                                |  19 ++-
 examples/schema-import/pom.xml                  |  10 +-
 modules/aop/pom.xml                             |   6 +-
 modules/aws/pom.xml                             |   4 +-
 modules/clients/pom.xml                         |  10 +-
 modules/codegen/pom.xml                         |   4 +-
 modules/core/pom.xml                            |   8 +-
 .../store/jdbc/CacheAbstractJdbcStore.java      |   2 +-
 .../cache/store/jdbc/CacheJdbcBlobStore.java    |   9 +-
 .../configuration/FileSystemConfiguration.java  |   6 +
 .../apache/ignite/internal/IgniteKernal.java    |   5 +-
 .../cache/DynamicCacheDescriptor.java           |   2 +-
 .../processors/cache/GridCacheAdapter.java      |   4 +-
 .../processors/cache/GridCacheProcessor.java    |  66 +++++------
 .../continuous/CacheContinuousQueryManager.java |  28 +++++
 .../processors/igfs/IgfsDataManager.java        |  11 +-
 .../processors/igfs/IgfsFileAffinityRange.java  |  23 +---
 .../processors/igfs/IgfsHelperImpl.java         |   3 +-
 .../spi/discovery/tcp/TcpDiscoverySpi.java      |   9 +-
 .../ignite/startup/BasicWarmupClosure.java      |   2 +-
 ...IgniteCacheJdbcBlobStoreNodeRestartTest.java |  52 +++++++++
 ...IgniteCacheStoreNodeRestartAbstractTest.java | 116 +++++++++++++++++++
 .../ignite/testsuites/IgniteCacheTestSuite.java |   2 +
 modules/extdata/p2p/pom.xml                     |   4 +-
 modules/extdata/uri/pom.xml                     |   4 +-
 modules/geospatial/pom.xml                      |   4 +-
 modules/hadoop/pom.xml                          |   8 +-
 modules/hibernate/pom.xml                       |   6 +-
 .../hibernate/CacheHibernateBlobStore.java      |   9 +-
 .../CacheHibernateBlobStoreNodeRestartTest.java |  52 +++++++++
 .../testsuites/IgniteHibernateTestSuite.java    |   2 +
 modules/indexing/pom.xml                        |   4 +-
 .../processors/query/h2/IgniteH2Indexing.java   |   4 +-
 modules/jcl/pom.xml                             |   4 +-
 modules/jta/pom.xml                             |   4 +-
 modules/log4j/pom.xml                           |   4 +-
 modules/rest-http/pom.xml                       |   2 +-
 modules/scalar/pom.xml                          |  10 +-
 modules/schedule/pom.xml                        |   4 +-
 modules/schema-import/pom.xml                   |   2 +-
 modules/slf4j/pom.xml                           |   2 +-
 modules/spring/pom.xml                          |   8 +-
 modules/ssh/pom.xml                             |   8 +-
 modules/urideploy/pom.xml                       |   6 +-
 modules/visor-console/pom.xml                   |   8 +-
 modules/visor-plugins/pom.xml                   |   2 +-
 modules/web/pom.xml                             |   8 +-
 modules/yardstick/pom.xml                       |   6 +-
 pom.xml                                         |  56 ++++-----
 49 files changed, 440 insertions(+), 192 deletions(-)
----------------------------------------------------------------------



[18/37] incubator-ignite git commit: Merge remote-tracking branch 'origin/ignite-sprint-3' into ignite-sprint-3

Posted by sb...@apache.org.
Merge remote-tracking branch 'origin/ignite-sprint-3' into ignite-sprint-3


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/214a461e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/214a461e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/214a461e

Branch: refs/heads/ignite-cacheplug-rmtvalid
Commit: 214a461e4da316ea92d92514327fdd6523ab451f
Parents: 71f201c ddb8e91
Author: sboikov <sb...@gridgain.com>
Authored: Thu Apr 2 12:58:11 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu Apr 2 12:58:11 2015 +0300

----------------------------------------------------------------------
 DEVNOTES.txt                                    |  2 +
 ipc/shmem/README.txt                            |  2 +-
 .../visor/cache/VisorCacheConfiguration.java    | 81 ++++++++------------
 .../cache/VisorCacheNearConfiguration.java      | 11 ++-
 .../visor/node/VisorGridConfiguration.java      | 28 ++++++-
 .../internal/visor/util/VisorMimeTypes.java     |  4 +-
 .../resources/META-INF/classnames.properties    | 79 +++++--------------
 .../GridUriDeploymentFileResourceLoader.java    |  2 +-
 parent/pom.xml                                  | 10 ++-
 9 files changed, 102 insertions(+), 117 deletions(-)
----------------------------------------------------------------------



[17/37] incubator-ignite git commit: Merge branch 'ignite-gg-9942' into ignite-sprint-3

Posted by sb...@apache.org.
Merge branch 'ignite-gg-9942' into ignite-sprint-3


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/ddb8e91a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/ddb8e91a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/ddb8e91a

Branch: refs/heads/ignite-cacheplug-rmtvalid
Commit: ddb8e91ad4a7dd2dd5b6e7e8d603e8927fdae6c6
Parents: 0e297a6 624eaf4
Author: AKuznetsov <ak...@gridgain.com>
Authored: Thu Apr 2 16:51:16 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Thu Apr 2 16:51:16 2015 +0700

----------------------------------------------------------------------
 .../visor/cache/VisorCacheConfiguration.java    | 81 ++++++++------------
 .../cache/VisorCacheNearConfiguration.java      | 11 ++-
 .../visor/node/VisorGridConfiguration.java      | 28 ++++++-
 .../resources/META-INF/classnames.properties    | 79 +++++--------------
 4 files changed, 87 insertions(+), 112 deletions(-)
----------------------------------------------------------------------



[37/37] incubator-ignite git commit: refactor CachePluginManager

Posted by sb...@apache.org.
refactor CachePluginManager


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/be31dc22
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/be31dc22
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/be31dc22

Branch: refs/heads/ignite-cacheplug-rmtvalid
Commit: be31dc22a74ad2144432f2efc50c46b933677e46
Parents: a4ba0ad
Author: Artem Shutak <as...@gridgain.com>
Authored: Fri Apr 3 12:12:47 2015 +0300
Committer: Artem Shutak <as...@gridgain.com>
Committed: Fri Apr 3 12:12:47 2015 +0300

----------------------------------------------------------------------
 .../internal/processors/cache/GridCacheProcessor.java  |  9 ++++-----
 .../internal/processors/plugin/CachePluginManager.java | 13 ++++++++++---
 2 files changed, 14 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/be31dc22/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index f1581be..2619156 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
@@ -1050,12 +1050,11 @@ public class GridCacheProcessor extends GridProcessorAdapter {
         
         pluginMgr.validate();
 
-        CacheConflictResolutionManager rslvrMgr = pluginMgr.createComponent(ctx, cfg,
-            CacheConflictResolutionManager.class);
+        CacheConflictResolutionManager rslvrMgr = pluginMgr.createComponent(CacheConflictResolutionManager.class);
 
-        GridCacheDrManager drMgr = pluginMgr.createComponent(ctx, cfg,GridCacheDrManager.class);
+        GridCacheDrManager drMgr = pluginMgr.createComponent(GridCacheDrManager.class);
 
-        CacheStoreManager storeMgr = pluginMgr.createComponent(ctx, cfg, CacheStoreManager.class);
+        CacheStoreManager storeMgr = pluginMgr.createComponent(CacheStoreManager.class);
 
         storeMgr.initialize(cfgStore, sesHolders);
 
@@ -1185,7 +1184,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
             evictMgr = new GridCacheEvictionManager();
             evtMgr = new GridCacheEventManager();
             pluginMgr = new CachePluginManager(ctx, cfg);
-            drMgr = pluginMgr.createComponent(ctx, cfg, GridCacheDrManager.class);
+            drMgr = pluginMgr.createComponent(GridCacheDrManager.class);
 
             cacheCtx = new GridCacheContext(
                 ctx,

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/be31dc22/modules/core/src/main/java/org/apache/ignite/internal/processors/plugin/CachePluginManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/plugin/CachePluginManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/plugin/CachePluginManager.java
index ab1ad1c..640271a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/plugin/CachePluginManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/plugin/CachePluginManager.java
@@ -38,11 +38,20 @@ public class CachePluginManager extends GridCacheManagerAdapter {
     /** */
     private final Map<CachePluginContext, CachePluginProvider> providersMap = new HashMap<>();
 
+    /** */
+    private final GridKernalContext ctx;
+
+    /** */
+    private final CacheConfiguration cfg;
+
     /**
      * @param ctx Context.
      * @param cfg Cache config.
      */
     public CachePluginManager(GridKernalContext ctx, CacheConfiguration cfg) {
+        this.ctx = ctx;
+        this.cfg = cfg;
+        
         if (cfg.getPluginConfigurations() != null) {
             for (CachePluginConfiguration cachePluginCfg : cfg.getPluginConfigurations()) {
                 CachePluginContext pluginCtx = new GridCachePluginContext(ctx, cfg, cachePluginCfg);
@@ -82,13 +91,11 @@ public class CachePluginManager extends GridCacheManagerAdapter {
     /**
      * Creates optional component.
      *
-     * @param ctx Kernal context.
-     * @param cfg Cache configuration.
      * @param cls Component class.
      * @return Created component.
      */
     @SuppressWarnings("unchecked")
-    public <T> T createComponent(GridKernalContext ctx, CacheConfiguration cfg, Class<T> cls) {
+    public <T> T createComponent(Class<T> cls) {
         for (CachePluginProvider provider : providersList) {
             T res = (T)provider.createComponent(cls);
             


[02/37] incubator-ignite git commit: Merge branches 'ignite-gg-10002' and 'ignite-sprint-3' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-gg-10002

Posted by sb...@apache.org.
Merge branches 'ignite-gg-10002' and 'ignite-sprint-3' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-gg-10002


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/c9b3f21c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/c9b3f21c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/c9b3f21c

Branch: refs/heads/ignite-cacheplug-rmtvalid
Commit: c9b3f21cff691150577937761b0d3530f5b687d5
Parents: d7dad48 091369c
Author: S.Vladykin <sv...@gridgain.com>
Authored: Wed Apr 1 13:14:45 2015 +0300
Committer: S.Vladykin <sv...@gridgain.com>
Committed: Wed Apr 1 13:14:45 2015 +0300

----------------------------------------------------------------------
 .../examples/datagrid/CacheQueryExample.java    |  12 +-
 .../checkpoint/s3/S3CheckpointSpiSelfTest.java  |  12 +-
 .../client/impl/ClientCacheFlagsCodecTest.java  |  18 +-
 .../configuration/CacheConfiguration.java       |  23 ++
 .../ignite/internal/GridCachePluginContext.java |  72 ++++
 .../ignite/internal/GridKernalContextImpl.java  |  17 +-
 .../org/apache/ignite/internal/IgniteEx.java    |   4 +-
 .../apache/ignite/internal/IgniteKernal.java    |  12 +-
 .../org/apache/ignite/internal/IgnitionEx.java  |  10 +-
 .../internal/MarshallerContextAdapter.java      |   6 +-
 .../ignite/internal/MarshallerContextImpl.java  |  90 ++++-
 .../internal/client/GridClientCacheFlag.java    |  13 -
 .../impl/connection/GridClientConnection.java   |   9 -
 .../internal/managers/GridManagerAdapter.java   |   4 +
 .../cache/CacheConflictResolutionManager.java   |  30 ++
 .../internal/processors/cache/CacheFlag.java    | 108 ------
 .../processors/cache/CacheFlagException.java    |  67 ----
 .../cache/CacheObjectByteArrayImpl.java         |   2 +-
 .../cache/CacheOsConflictResolutionManager.java |  58 +++
 .../processors/cache/CacheProjection.java       | 233 +-----------
 .../internal/processors/cache/GridCache.java    |   3 -
 .../processors/cache/GridCacheAdapter.java      | 271 +++-----------
 .../cache/GridCacheConcurrentMap.java           |  44 +--
 .../processors/cache/GridCacheContext.java      | 256 ++-----------
 .../processors/cache/GridCacheEntryEx.java      |   3 +-
 .../processors/cache/GridCacheMapEntry.java     |  27 +-
 .../processors/cache/GridCacheProcessor.java    |  66 ++--
 .../processors/cache/GridCacheProjectionEx.java |  29 --
 .../cache/GridCacheProjectionImpl.java          | 357 +++----------------
 .../processors/cache/GridCacheProxyImpl.java    |  55 +--
 .../cache/GridCacheSharedContext.java           |  21 --
 .../processors/cache/GridCacheUtils.java        |  39 ++
 .../processors/cache/IgniteCacheProxy.java      |  31 +-
 .../CacheDataStructuresManager.java             |   4 +-
 .../GridDistributedTxRemoteAdapter.java         |   2 +-
 .../distributed/dht/GridDhtCacheAdapter.java    |   2 +-
 .../distributed/dht/GridDhtLocalPartition.java  |   2 +-
 .../distributed/dht/GridDhtLockFuture.java      |   2 +-
 .../distributed/dht/GridDhtTxLocalAdapter.java  |   2 +-
 .../distributed/dht/GridDhtTxPrepareFuture.java |   2 +-
 .../dht/GridPartitionedGetFuture.java           |   3 +-
 .../dht/atomic/GridDhtAtomicCache.java          |  32 --
 .../dht/atomic/GridDhtAtomicUpdateFuture.java   |   2 -
 .../dht/atomic/GridNearAtomicUpdateFuture.java  |   3 -
 .../dht/atomic/GridNearAtomicUpdateRequest.java |  78 ++--
 .../dht/colocated/GridDhtColocatedCache.java    |   2 -
 .../colocated/GridDhtDetachedCacheEntry.java    |   2 +-
 .../distributed/near/GridNearAtomicCache.java   |   5 +-
 .../distributed/near/GridNearCacheAdapter.java  |   9 -
 .../distributed/near/GridNearGetFuture.java     |   3 +-
 .../near/GridNearTransactionalCache.java        |   2 -
 .../cache/distributed/near/GridNearTxLocal.java |   4 +-
 .../processors/cache/dr/GridCacheDrManager.java |   5 -
 .../cache/dr/GridOsCacheDrManager.java          | 106 ++++++
 .../cache/dr/os/GridOsCacheDrManager.java       | 111 ------
 .../local/atomic/GridLocalAtomicCache.java      |  74 +---
 .../cache/query/GridCacheQueriesImpl.java       |  23 +-
 .../continuous/CacheContinuousQueryHandler.java |   5 -
 .../CacheContinuousQueryListener.java           |   3 +
 .../continuous/CacheContinuousQueryManager.java |   2 +-
 .../transactions/IgniteTransactionsImpl.java    |   5 +-
 .../transactions/IgniteTxLocalAdapter.java      |  19 +-
 .../cache/transactions/IgniteTxManager.java     |   2 -
 .../version/CacheVersionConflictResolver.java   |  40 +++
 ...ridCacheVersionAbstractConflictResolver.java |  56 ---
 .../GridCacheVersionConflictResolver.java       |  59 ---
 .../datastreamer/DataStreamerImpl.java          |   2 +-
 .../datastructures/DataStructuresProcessor.java |  13 +-
 .../datastructures/GridCacheAtomicLongImpl.java |  14 +-
 .../GridCacheAtomicReferenceImpl.java           |   2 +-
 .../GridCacheAtomicReferenceValue.java          |  15 +-
 .../GridCacheAtomicSequenceImpl.java            |   2 +-
 .../GridCacheAtomicStampedImpl.java             |   2 +-
 .../GridCacheAtomicStampedValue.java            |  15 +-
 .../GridCacheCountDownLatchImpl.java            |   2 +-
 .../processors/plugin/CachePluginManager.java   | 107 ++++++
 .../handlers/cache/GridCacheCommandHandler.java |  66 ++--
 .../ignite/internal/util/IgniteUtils.java       |   2 +-
 .../ignite/marshaller/MarshallerContext.java    |   3 +-
 .../optimized/OptimizedMarshallerUtils.java     |   9 +-
 .../ignite/plugin/CachePluginConfiguration.java |  36 ++
 .../ignite/plugin/CachePluginContext.java       |  54 +++
 .../ignite/plugin/CachePluginProvider.java      |  84 +++++
 .../org/apache/ignite/spi/IgniteSpiAdapter.java |  16 +-
 .../org/apache/ignite/spi/IgniteSpiContext.java |   5 +
 .../communication/tcp/TcpCommunicationSpi.java  |  13 +-
 .../spi/discovery/tcp/TcpDiscoverySpi.java      |  14 +-
 ...eJdbcStoreAbstractMultithreadedSelfTest.java |  11 +-
 .../GridProjectionForCachesSelfTest.java        |  12 +-
 .../managers/GridNoopManagerSelfTest.java       |   2 +-
 .../communication/GridIoManagerSelfTest.java    |   9 +-
 .../GridCacheAbstractFailoverSelfTest.java      |   2 +-
 .../cache/GridCacheAbstractFlagsTest.java       |  97 -----
 .../cache/GridCacheAbstractFullApiSelfTest.java |  61 +++-
 .../cache/GridCacheMemoryModeSelfTest.java      |  12 +-
 .../cache/GridCachePutAllFailoverSelfTest.java  |  26 +-
 .../GridCacheReturnValueTransferSelfTest.java   |  36 +-
 .../processors/cache/GridCacheTestEntryEx.java  |   2 +-
 .../cache/IgniteCacheInvokeAbstractTest.java    |  11 -
 ...PartitionedQueueCreateMultiNodeSelfTest.java |   6 +-
 .../IgniteCacheSystemTransactionsSelfTest.java  |  38 +-
 ...GridCacheValueConsistencyAtomicSelfTest.java | 101 ------
 .../near/GridCachePartitionedFlagsTest.java     |  41 ---
 ...achePartitionedMultiNodeFullApiSelfTest.java |   2 +
 .../GridCacheReplicatedFlagsTest.java           |  28 --
 ...ridCacheContinuousQueryAbstractSelfTest.java |   2 +-
 .../cache/GridCacheCommandHandlerSelfTest.java  |   2 +-
 .../GridServiceReassignmentSelfTest.java        |   5 +-
 .../internal/util/IgniteUtilsSelfTest.java      |   2 +-
 .../loadtests/hashmap/GridCacheTestContext.java |   8 +-
 .../OptimizedMarshallerNodeFailoverTest.java    |  71 +++-
 .../OptimizedObjectStreamSelfTest.java          |   4 -
 .../spi/GridSpiLocalHostInjectionTest.java      |   2 +-
 .../GridPriorityQueueCollisionSpiSelfTest.java  |   2 +-
 ...RobinLoadBalancingSpiNotPerTaskSelfTest.java |   2 +-
 .../testframework/GridSpiTestContext.java       |  18 +-
 .../testframework/junits/GridAbstractTest.java  |  28 +-
 .../junits/GridTestKernalContext.java           |   2 +-
 .../junits/IgniteTestResources.java             |   8 +-
 .../junits/spi/GridSpiAbstractTest.java         |  13 +-
 .../IgniteCacheFailoverTestSuite.java           |   8 +-
 .../ignite/testsuites/IgniteCacheTestSuite.java |   1 -
 .../hadoop/jobtracker/HadoopJobTracker.java     |   7 +-
 .../HadoopDefaultMapReducePlannerSelfTest.java  |   3 +-
 .../processors/cache/jta/CacheJtaManager.java   |   1 -
 .../ignite/scalar/pimps/ScalarCachePimp.scala   |  36 --
 .../ant/beautifier/GridJavadocAntTask.java      |   8 +-
 .../commands/disco/VisorDiscoveryCommand.scala  |   8 +-
 .../commands/events/VisorEventsCommand.scala    |  24 +-
 .../commands/tasks/VisorTasksCommand.scala      |   6 +-
 parent/pom.xml                                  |  38 +-
 131 files changed, 1454 insertions(+), 2501 deletions(-)
----------------------------------------------------------------------



[12/37] incubator-ignite git commit: Merge branches 'ignite-gg-10002' and 'ignite-sprint-3' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-gg-10002

Posted by sb...@apache.org.
Merge branches 'ignite-gg-10002' and 'ignite-sprint-3' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-gg-10002


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/acb5d2b4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/acb5d2b4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/acb5d2b4

Branch: refs/heads/ignite-cacheplug-rmtvalid
Commit: acb5d2b4c59bd6e17144195e36092f1cd41aaa96
Parents: aabe5a9 505a7bf
Author: S.Vladykin <sv...@gridgain.com>
Authored: Thu Apr 2 10:42:21 2015 +0300
Committer: S.Vladykin <sv...@gridgain.com>
Committed: Thu Apr 2 10:42:21 2015 +0300

----------------------------------------------------------------------
 .../apache/ignite/IgniteCacheAffinitySelfTest.java  |  2 ++
 .../cache/GridCacheOnCopyFlagAbstractSelfTest.java  | 16 +++++++++-------
 2 files changed, 11 insertions(+), 7 deletions(-)
----------------------------------------------------------------------



[30/37] incubator-ignite git commit: Merge branch 'ignite-gg-10002' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-sprint-3

Posted by sb...@apache.org.
Merge branch 'ignite-gg-10002' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-sprint-3


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/0180d180
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/0180d180
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/0180d180

Branch: refs/heads/ignite-cacheplug-rmtvalid
Commit: 0180d1803d20bfd52687a5f279b37688d616a0f8
Parents: 7e86251 5cabdf2
Author: S.Vladykin <sv...@gridgain.com>
Authored: Thu Apr 2 22:52:12 2015 +0300
Committer: S.Vladykin <sv...@gridgain.com>
Committed: Thu Apr 2 22:52:12 2015 +0300

----------------------------------------------------------------------
 .../apache/ignite/cache/CacheTypeMetadata.java  |   4 +-
 .../cacheobject/IgniteCacheObjectProcessor.java |   8 ++
 .../IgniteCacheObjectProcessorImpl.java         |   5 +
 .../processors/query/GridQueryProcessor.java    | 143 +++++++++----------
 .../messages/GridQueryNextPageResponse.java     |  34 ++---
 .../query/h2/twostep/GridMapQueryExecutor.java  |  86 +++++++++--
 .../query/h2/twostep/GridResultPage.java        |   9 +-
 7 files changed, 185 insertions(+), 104 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0180d180/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessor.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0180d180/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessorImpl.java
----------------------------------------------------------------------


[31/37] incubator-ignite git commit: # Add GridCachePartitionNotLoadedEventSelfTest to suite.

Posted by sb...@apache.org.
# Add GridCachePartitionNotLoadedEventSelfTest to suite.


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/b10fdc74
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/b10fdc74
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/b10fdc74

Branch: refs/heads/ignite-cacheplug-rmtvalid
Commit: b10fdc74a39a1fee746e177909e72c1148f76557
Parents: 0180d18
Author: sevdokimov <se...@jetbrains.com>
Authored: Thu Apr 2 23:38:25 2015 +0300
Committer: sevdokimov <se...@jetbrains.com>
Committed: Thu Apr 2 23:39:03 2015 +0300

----------------------------------------------------------------------
 .../java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java     | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b10fdc74/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
index a4553c4..d5ae2e6 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
@@ -219,6 +219,7 @@ public class IgniteCacheTestSuite extends TestSuite {
         suite.addTest(new TestSuite(GridCacheDhtPreloadDelayedSelfTest.class));
         suite.addTest(new TestSuite(GridPartitionedBackupLoadSelfTest.class));
         suite.addTest(new TestSuite(GridCachePartitionedLoadCacheSelfTest.class));
+        suite.addTest(new TestSuite(GridCachePartitionNotLoadedEventSelfTest.class));
         suite.addTest(new TestSuite(GridCacheDhtEvictionsDisabledSelfTest.class));
         suite.addTest(new TestSuite(GridCacheNearEvictionEventSelfTest.class));
         suite.addTest(new TestSuite(GridCacheAtomicNearEvictionEventSelfTest.class));


[36/37] incubator-ignite git commit: Merge branch 'ignite-sprint-3' into ignite-cacheplug-rmtvalid

Posted by sb...@apache.org.
Merge branch 'ignite-sprint-3' into ignite-cacheplug-rmtvalid

Conflicts:
	modules/core/src/main/java/org/apache/ignite/internal/processors/plugin/CachePluginManager.java


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/a4ba0ad7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/a4ba0ad7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/a4ba0ad7

Branch: refs/heads/ignite-cacheplug-rmtvalid
Commit: a4ba0ad7a692e6aa57e48eda3d70e903cb0f94be
Parents: 9dda6bf d173f37
Author: Artem Shutak <as...@gridgain.com>
Authored: Fri Apr 3 12:08:28 2015 +0300
Committer: Artem Shutak <as...@gridgain.com>
Committed: Fri Apr 3 12:08:28 2015 +0300

----------------------------------------------------------------------
 DEVNOTES.txt                                    |   17 +-
 examples/pom-standalone.xml                     |    1 -
 ipc/shmem/README.txt                            |    2 +-
 .../apache/ignite/cache/CacheTypeMetadata.java  |    4 +-
 .../configuration/CacheConfiguration.java       |   29 -
 .../processors/cache/CacheMetricsImpl.java      |    1 +
 .../cache/CacheStorePartialUpdateException.java |    2 +-
 .../processors/cache/GridCacheAdapter.java      |   19 +-
 .../processors/cache/GridCacheAttributes.java   |    8 -
 .../cache/GridCacheConcurrentMap.java           |   34 +-
 .../processors/cache/GridCacheContext.java      |    9 +-
 .../processors/cache/GridCacheMapEntry.java     |   56 +-
 .../cache/GridCacheMapEntryFactory.java         |    2 -
 .../processors/cache/GridCacheProcessor.java    |   16 +-
 .../processors/cache/GridCacheStoreManager.java | 1202 ------------------
 .../cache/GridCacheWriteBehindStore.java        | 1015 ---------------
 .../distributed/GridDistributedCacheEntry.java  |    4 +-
 .../distributed/dht/GridDhtCacheAdapter.java    |   22 +-
 .../distributed/dht/GridDhtCacheEntry.java      |    8 +-
 .../distributed/dht/GridDhtLocalPartition.java  |    4 +-
 .../distributed/dht/GridDhtLockFuture.java      |    2 +-
 .../distributed/dht/GridNoStorageCacheMap.java  |   11 +-
 .../dht/atomic/GridDhtAtomicCache.java          |   11 +-
 .../dht/atomic/GridDhtAtomicCacheEntry.java     |    4 +-
 .../dht/colocated/GridDhtColocatedCache.java    |    5 +-
 .../colocated/GridDhtColocatedCacheEntry.java   |    4 +-
 .../colocated/GridDhtDetachedCacheEntry.java    |    5 +-
 .../distributed/near/GridNearCacheAdapter.java  |    3 +-
 .../distributed/near/GridNearCacheEntry.java    |    4 +-
 .../processors/cache/local/GridLocalCache.java  |    3 +-
 .../cache/local/GridLocalCacheEntry.java        |    4 +-
 .../local/atomic/GridLocalAtomicCache.java      |    7 +-
 .../cache/store/CacheOsStoreManager.java        |   59 +
 .../cache/store/CacheStoreManager.java          |  182 +++
 .../store/GridCacheStoreManagerAdapter.java     | 1111 ++++++++++++++++
 .../cache/store/GridCacheWriteBehindStore.java  | 1015 +++++++++++++++
 .../cache/transactions/IgniteTxAdapter.java     |    5 +-
 .../transactions/IgniteTxLocalAdapter.java      |   43 +-
 .../cacheobject/IgniteCacheObjectProcessor.java |   14 +-
 .../IgniteCacheObjectProcessorImpl.java         |   10 +-
 .../datastreamer/DataStreamerImpl.java          |   21 +-
 .../processors/plugin/CachePluginManager.java   |    8 +-
 .../processors/query/GridQueryProcessor.java    |  143 ++-
 .../messages/GridQueryNextPageResponse.java     |   34 +-
 .../visor/cache/VisorCacheConfiguration.java    |   81 +-
 .../cache/VisorCacheDefaultConfiguration.java   |   21 -
 .../cache/VisorCacheNearConfiguration.java      |   11 +-
 .../visor/node/VisorGridConfiguration.java      |   28 +-
 .../internal/visor/util/VisorMimeTypes.java     |    4 +-
 .../resources/META-INF/classnames.properties    |   93 +-
 ...idCacheConfigurationConsistencySelfTest.java |    3 -
 .../cache/GridCachePartitionedWritesTest.java   |    3 +-
 ...idCacheWriteBehindStoreAbstractSelfTest.java |  189 ---
 .../GridCacheWriteBehindStoreAbstractTest.java  |  349 -----
 .../GridCacheWriteBehindStoreLocalTest.java     |   30 -
 ...heWriteBehindStoreMultithreadedSelfTest.java |  163 ---
 ...BehindStorePartitionedMultiNodeSelfTest.java |  215 ----
 ...ridCacheWriteBehindStorePartitionedTest.java |   30 -
 ...GridCacheWriteBehindStoreReplicatedTest.java |   30 -
 .../GridCacheWriteBehindStoreSelfTest.java      |  267 ----
 .../GridCacheDhtEvictionsDisabledSelfTest.java  |    8 +-
 .../distributed/dht/GridCacheDhtTestUtils.java  |    2 +-
 ...idCacheWriteBehindStoreAbstractSelfTest.java |  191 +++
 .../GridCacheWriteBehindStoreAbstractTest.java  |  350 +++++
 .../GridCacheWriteBehindStoreLocalTest.java     |   30 +
 ...heWriteBehindStoreMultithreadedSelfTest.java |  163 +++
 ...BehindStorePartitionedMultiNodeSelfTest.java |  216 ++++
 ...ridCacheWriteBehindStorePartitionedTest.java |   30 +
 ...GridCacheWriteBehindStoreReplicatedTest.java |   30 +
 .../GridCacheWriteBehindStoreSelfTest.java      |  268 ++++
 .../processors/igfs/IgsfStartCacheTest.java     |  115 ++
 .../loadtests/hashmap/GridCacheTestContext.java |    8 +-
 .../loadtests/hashmap/GridHashMapLoadTest.java  |    2 +-
 .../ignite/testsuites/IgniteCacheTestSuite.java |    1 +
 .../IgniteCacheWriteBehindTestSuite.java        |    3 +-
 .../query/h2/twostep/GridMapQueryExecutor.java  |   86 +-
 .../query/h2/twostep/GridResultPage.java        |    9 +-
 .../cache/ttl/CacheTtlAbstractSelfTest.java     |  368 ++++++
 .../ttl/CacheTtlOffheapAbstractSelfTest.java    |   29 +
 .../CacheTtlOffheapAtomicAbstractSelfTest.java  |   29 +
 .../ttl/CacheTtlOffheapAtomicLocalSelfTest.java |   34 +
 ...acheTtlOffheapAtomicPartitionedSelfTest.java |   34 +
 ...TtlOffheapTransactionalAbstractSelfTest.java |   29 +
 ...cheTtlOffheapTransactionalLocalSelfTest.java |   34 +
 ...OffheapTransactionalPartitionedSelfTest.java |   34 +
 .../ttl/CacheTtlOnheapAbstractSelfTest.java     |   29 +
 .../CacheTtlOnheapAtomicAbstractSelfTest.java   |   29 +
 .../ttl/CacheTtlOnheapAtomicLocalSelfTest.java  |   34 +
 ...CacheTtlOnheapAtomicPartitionedSelfTest.java |   34 +
 ...eTtlOnheapTransactionalAbstractSelfTest.java |   29 +
 ...acheTtlOnheapTransactionalLocalSelfTest.java |   34 +
 ...lOnheapTransactionalPartitionedSelfTest.java |   34 +
 .../IgniteCacheWithIndexingTestSuite.java       |   51 +
 .../IgniteH2IndexingSpiTestSuite.java           |    7 -
 .../GridUriDeploymentFileResourceLoader.java    |    2 +-
 .../commands/cache/VisorCacheCommand.scala      |    4 +-
 96 files changed, 5100 insertions(+), 3970 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a4ba0ad7/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a4ba0ad7/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a4ba0ad7/modules/core/src/main/java/org/apache/ignite/internal/processors/plugin/CachePluginManager.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/plugin/CachePluginManager.java
index 96e5054,580ff49..ab1ad1c
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/plugin/CachePluginManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/plugin/CachePluginManager.java
@@@ -84,8 -82,9 +87,9 @@@ public class CachePluginManager extend
       * @param cls Component class.
       * @return Created component.
       */
-     public <T> T createComponent(Class<T> cls) {
+     @SuppressWarnings("unchecked")
+     public <T> T createComponent(GridKernalContext ctx, CacheConfiguration cfg, Class<T> cls) {
 -        for (CachePluginProvider provider : providers) {
 +        for (CachePluginProvider provider : providersList) {
              T res = (T)provider.createComponent(cls);
              
              if (res != null)


[04/37] incubator-ignite git commit: ignite-gg-10002 - fixed

Posted by sb...@apache.org.
ignite-gg-10002 - fixed


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/e78ce56a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/e78ce56a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/e78ce56a

Branch: refs/heads/ignite-cacheplug-rmtvalid
Commit: e78ce56aebcb83d43b25ae96360d586d72d0eaf5
Parents: c9b3f21
Author: S.Vladykin <sv...@gridgain.com>
Authored: Wed Apr 1 16:29:30 2015 +0300
Committer: S.Vladykin <sv...@gridgain.com>
Committed: Wed Apr 1 16:29:30 2015 +0300

----------------------------------------------------------------------
 .../apache/ignite/cache/CacheTypeMetadata.java  |   4 +-
 .../cacheobject/IgniteCacheObjectProcessor.java |   8 ++
 .../IgniteCacheObjectProcessorImpl.java         |   6 +-
 .../processors/query/GridQueryProcessor.java    | 143 ++++++++++---------
 4 files changed, 87 insertions(+), 74 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e78ce56a/modules/core/src/main/java/org/apache/ignite/cache/CacheTypeMetadata.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/CacheTypeMetadata.java b/modules/core/src/main/java/org/apache/ignite/cache/CacheTypeMetadata.java
index db088e6..20129b7 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/CacheTypeMetadata.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/CacheTypeMetadata.java
@@ -98,9 +98,9 @@ public class CacheTypeMetadata implements Serializable {
 
         dbTbl = src.getDatabaseTable();
 
-        keyType = getKeyType();
+        keyType = src.getKeyType();
 
-        valType = getValueType();
+        valType = src.getValueType();
 
         keyFields = new ArrayList<>(src.getKeyFields());
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e78ce56a/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessor.java
index 42586d2..1f1f601 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessor.java
@@ -75,6 +75,14 @@ public interface IgniteCacheObjectProcessor extends GridProcessor {
     public boolean isPortableObject(Object obj);
 
     /**
+     * Checks whether given class is portable.
+     *
+     * @param cls Class.
+     * @return {@code true} If the class was registered as portable.
+     */
+    public boolean isPortableClass(Class<?> cls);
+
+    /**
      * @param obj Portable object to get field from.
      * @param fieldName Field name.
      * @return Field value.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e78ce56a/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessorImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessorImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessorImpl.java
index c0be7c9..53c3ea8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessorImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessorImpl.java
@@ -26,7 +26,6 @@ import org.apache.ignite.internal.processors.*;
 import org.apache.ignite.internal.processors.cache.*;
 import org.apache.ignite.internal.processors.query.*;
 import org.apache.ignite.internal.util.*;
-import org.apache.ignite.internal.util.typedef.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
 import org.apache.ignite.lang.*;
 import org.jetbrains.annotations.*;
@@ -294,6 +293,11 @@ public class IgniteCacheObjectProcessorImpl extends GridProcessorAdapter impleme
     }
 
     /** {@inheritDoc} */
+    @Override public boolean isPortableClass(Class<?> cls) {
+        return false;
+    }
+
+    /** {@inheritDoc} */
     @Override public int typeId(Object obj) {
         return 0;
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e78ce56a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
index 2e5a7a0..4e30f41 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
@@ -70,9 +70,6 @@ public class GridQueryProcessor extends GridProcessorAdapter {
     /** */
     private final GridQueryIndexing idx;
 
-    /** Portable ID to name mapping. */
-    private final Map<Integer, String> portableIds = new ConcurrentHashMap8<>();
-
     /**
      * @param ctx Kernal context.
      */
@@ -113,24 +110,39 @@ public class GridQueryProcessor extends GridProcessorAdapter {
      * @param ccfg Cache configuration.
      */
     public void initializeCache(CacheConfiguration<?, ?> ccfg) throws IgniteCheckedException {
-        Map<TypeName,CacheTypeMetadata> declaredTypes = new HashMap<>();
-
         idx.registerCache(ccfg);
 
         if (!F.isEmpty(ccfg.getTypeMetadata())) {
             for (CacheTypeMetadata meta : ccfg.getTypeMetadata()) {
-                declaredTypes.put(new TypeName(ccfg.getName(), meta.getValueType()), meta);
+                if (F.isEmpty(meta.getValueType()))
+                    throw new IgniteCheckedException("Value type is not set: " + meta);
+
+                TypeDescriptor desc = new TypeDescriptor(ccfg);
+
+                Class<?> valCls = U.classForName(meta.getValueType(), null);
+
+                desc.name(valCls != null ? typeName(valCls) : meta.getValueType());
+
+                desc.valueClass(valCls != null ? valCls : Object.class);
+                desc.keyClass(meta.getKeyType() == null ? Object.class : U.classForName(meta.getKeyType(), Object.class));
 
-                int valTypeId = ctx.cacheObjects().typeId(meta.getValueType());
+                TypeId typeId;
 
-                portableIds.put(valTypeId, meta.getValueType());
+                if (valCls == null || ctx.cacheObjects().isPortableClass(valCls)) {
+                    processPortableMeta(meta, desc);
 
-                TypeDescriptor desc = processPortableMeta(ccfg, meta);
+                    typeId = new TypeId(ccfg.getName(), ctx.cacheObjects().typeId(meta.getValueType()));
+                }
+                else {
+                    processClassMeta(meta, desc);
+
+                    typeId = new TypeId(ccfg.getName(), valCls);
+                }
 
                 desc.registered(idx.registerType(ccfg.getName(), desc));
 
                 typesByName.put(new TypeName(ccfg.getName(), desc.name()), desc);
-                types.put(new TypeId(ccfg.getName(), valTypeId), desc);
+                types.put(typeId, desc);
             }
         }
 
@@ -141,7 +153,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
                 Class<?> keyCls = clss[i];
                 Class<?> valCls = clss[i + 1];
 
-                TypeDescriptor desc = processKeyAndValueClasses(ccfg, keyCls, valCls, declaredTypes);
+                TypeDescriptor desc = processKeyAndValueClasses(ccfg, keyCls, valCls);
 
                 desc.registered(idx.registerType(ccfg.getName(), desc));
 
@@ -155,35 +167,23 @@ public class GridQueryProcessor extends GridProcessorAdapter {
      * @param ccfg Cache configuration.
      * @param keyCls Key class.
      * @param valCls Value class.
-     * @param declaredTypes Knows types.
      * @return Type descriptor.
      * @throws IgniteCheckedException If failed.
      */
-    private TypeDescriptor processKeyAndValueClasses(CacheConfiguration<?,?> ccfg, Class<?> keyCls, Class<?> valCls,
-        Map<TypeName,CacheTypeMetadata> declaredTypes)
+    private TypeDescriptor processKeyAndValueClasses(CacheConfiguration<?,?> ccfg, Class<?> keyCls, Class<?> valCls)
         throws IgniteCheckedException {
         TypeDescriptor d = new TypeDescriptor(ccfg);
 
         d.keyClass(keyCls);
         d.valueClass(valCls);
 
-        CacheTypeMetadata keyMeta = declaredTypes.get(new TypeName(ccfg.getName(), keyCls.getName()));
-
-        if (keyMeta == null)
-            processAnnotationsInClass(true, d.keyCls, d, null);
-        else
-            processClassMeta(true, d.keyCls, keyMeta, d);
+        processAnnotationsInClass(true, d.keyCls, d, null);
 
         String valTypeName = typeName(valCls);
 
         d.name(valTypeName);
 
-        CacheTypeMetadata typeMeta = declaredTypes.get(new TypeName(ccfg.getName(), valCls.getName()));
-
-        if (typeMeta == null)
-            processAnnotationsInClass(false, d.valCls, d, null);
-        else
-            processClassMeta(false, d.valCls, typeMeta, d);
+        processAnnotationsInClass(false, d.valCls, d, null);
 
         return d;
     }
@@ -397,16 +397,17 @@ public class GridQueryProcessor extends GridProcessorAdapter {
         try {
             final Class<?> valCls = val.getClass();
 
-            int typeId = ctx.cacheObjects().typeId(val);
+            TypeId id;
 
             if (ctx.cacheObjects().isPortableObject(val)) {
-                String typeName = portableName(typeId);
+                int typeId = ctx.cacheObjects().typeId(val);
 
-                if (typeName == null)
-                    return;
+                id = new TypeId(space, typeId);
             }
+            else
+                id = new TypeId(space, valCls);
 
-            TypeDescriptor desc = types.get(new TypeId(space, typeId));
+            TypeDescriptor desc = types.get(id);
 
             if (desc == null || !desc.registered())
                 return;
@@ -707,16 +708,6 @@ public class GridQueryProcessor extends GridProcessorAdapter {
     }
 
     /**
-     * Gets portable type name by portable ID.
-     *
-     * @param typeId Type ID.
-     * @return Name.
-     */
-    private String portableName(int typeId) {
-        return portableIds.get(typeId);
-    }
-
-    /**
      * @param space Space.
      * @param clause Clause.
      * @param resType Result type.
@@ -985,16 +976,20 @@ public class GridQueryProcessor extends GridProcessorAdapter {
     /**
      * Processes declarative metadata for class.
      *
-     * @param key Key or value flag.
-     * @param cls Class to process.
      * @param meta Type metadata.
      * @param d Type descriptor.
      * @throws IgniteCheckedException If failed.
      */
-    static void processClassMeta(boolean key, Class<?> cls, CacheTypeMetadata meta, TypeDescriptor d)
+    static void processClassMeta(CacheTypeMetadata meta, TypeDescriptor d)
         throws IgniteCheckedException {
+        Class<?> keyCls = d.keyClass();
+        Class<?> valCls = d.valueClass();
+
+        assert keyCls != null;
+        assert valCls != null;
+
         for (Map.Entry<String, Class<?>> entry : meta.getAscendingFields().entrySet()) {
-            ClassProperty prop = buildClassProperty(key, cls, entry.getKey(), entry.getValue());
+            ClassProperty prop = buildClassProperty(keyCls, valCls, entry.getKey(), entry.getValue());
 
             d.addProperty(prop, false);
 
@@ -1006,7 +1001,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
         }
 
         for (Map.Entry<String, Class<?>> entry : meta.getDescendingFields().entrySet()) {
-            ClassProperty prop = buildClassProperty(key, cls, entry.getKey(), entry.getValue());
+            ClassProperty prop = buildClassProperty(keyCls, valCls, entry.getKey(), entry.getValue());
 
             d.addProperty(prop, false);
 
@@ -1018,7 +1013,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
         }
 
         for (String txtIdx : meta.getTextFields()) {
-            ClassProperty prop = buildClassProperty(key, cls, txtIdx, String.class);
+            ClassProperty prop = buildClassProperty(keyCls, valCls, txtIdx, String.class);
 
             d.addProperty(prop, false);
 
@@ -1036,7 +1031,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
                 int order = 0;
 
                 for (Map.Entry<String, IgniteBiTuple<Class<?>, Boolean>> idxField : idxFields.entrySet()) {
-                    ClassProperty prop = buildClassProperty(key, cls, idxField.getKey(), idxField.getValue().get1());
+                    ClassProperty prop = buildClassProperty(keyCls, valCls, idxField.getKey(), idxField.getValue().get1());
 
                     d.addProperty(prop, false);
 
@@ -1050,7 +1045,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
         }
 
         for (Map.Entry<String, Class<?>> entry : meta.getQueryFields().entrySet()) {
-            ClassProperty prop = buildClassProperty(key, cls, entry.getKey(), entry.getValue());
+            ClassProperty prop = buildClassProperty(keyCls, valCls, entry.getKey(), entry.getValue());
 
             d.addProperty(prop, false);
         }
@@ -1059,15 +1054,12 @@ public class GridQueryProcessor extends GridProcessorAdapter {
     /**
      * Processes declarative metadata for portable object.
      *
-     * @param ccfg Cache configuration.
      * @param meta Declared metadata.
-     * @return Type descriptor.
+     * @param d Type descriptor.
      * @throws IgniteCheckedException If failed.
      */
-    private TypeDescriptor processPortableMeta(CacheConfiguration<?,?> ccfg, CacheTypeMetadata meta)
+    private void processPortableMeta(CacheTypeMetadata meta, TypeDescriptor d)
         throws IgniteCheckedException {
-        TypeDescriptor d = new TypeDescriptor(ccfg);
-
         for (Map.Entry<String, Class<?>> entry : meta.getAscendingFields().entrySet()) {
             PortableProperty prop = buildPortableProperty(entry.getKey(), entry.getValue());
 
@@ -1130,18 +1122,6 @@ public class GridQueryProcessor extends GridProcessorAdapter {
             if (!d.props.containsKey(prop.name()))
                 d.addProperty(prop, false);
         }
-
-        if (F.isEmpty(meta.getValueType()))
-            throw new IgniteCheckedException("Value type is not set: " + meta);
-
-        Class<?> valCls = U.classForName(meta.getValueType(), null);
-
-        d.name(valCls != null ? typeName(valCls) : meta.getValueType());
-
-        d.valueClass(valCls != null ? valCls : Object.class);
-        d.keyClass(meta.getKeyType() == null ? Object.class : U.classForName(meta.getKeyType(), Object.class));
-
-        return d;
     }
 
     /**
@@ -1164,6 +1144,29 @@ public class GridQueryProcessor extends GridProcessorAdapter {
     }
 
     /**
+     * @param keyCls Key class.
+     * @param valCls Value class.
+     * @param pathStr Path string.
+     * @param resType Result type.
+     * @return Class property.
+     * @throws IgniteCheckedException If failed.
+     */
+    private static ClassProperty buildClassProperty(Class<?> keyCls, Class<?> valCls, String pathStr, Class<?> resType)
+        throws IgniteCheckedException {
+        ClassProperty res = buildClassProperty(true, keyCls, pathStr, resType);
+
+        if (res == null) // We check key before value consistently with PortableProperty.
+            res = buildClassProperty(false, valCls, pathStr, resType);
+
+        if (res == null)
+            throw new IgniteCheckedException("Failed to initialize property '" + pathStr + "' for " +
+                "key class '" + keyCls + "' and value class '" + valCls + "'. " +
+                "Make sure that one of these classes contains respective getter method or field.");
+
+        return res;
+    }
+
+    /**
      * @param key If this is a key property.
      * @param cls Source type class.
      * @param pathStr String representing path to the property. May contains dots '.' to identify nested fields.
@@ -1194,8 +1197,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
                     tmp = new ClassProperty(cls.getDeclaredField(prop), key);
                 }
                 catch (NoSuchFieldException ignored) {
-                    throw new IgniteCheckedException("Failed to find getter method or field for property named " +
-                        "'" + prop + "': " + cls.getName());
+                    return null;
                 }
             }
 
@@ -1207,9 +1209,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
         }
 
         if (!U.box(resType).isAssignableFrom(U.box(res.type())))
-            throw new IgniteCheckedException("Failed to create property for given path (actual property type is not assignable" +
-                " to declared type [path=" + pathStr + ", actualType=" + res.type().getName() +
-                ", declaredType=" + resType.getName() + ']');
+            return null;
 
         return res;
     }
@@ -1449,6 +1449,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
                 int isKeyProp0 = isKeyProp;
 
                 if (isKeyProp0 == 0) { // Key is allowed to be a non-portable object here.
+                    // We check key before value consistently with ClassProperty.
                     if (ctx.cacheObjects().isPortableObject(key) && ctx.cacheObjects().hasField(key, propName))
                         isKeyProp = isKeyProp0 = 1;
                     else if (ctx.cacheObjects().hasField(val, propName))


[13/37] incubator-ignite git commit: 10002 review

Posted by sb...@apache.org.
10002 review


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/162bdac1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/162bdac1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/162bdac1

Branch: refs/heads/ignite-cacheplug-rmtvalid
Commit: 162bdac1c1407cf870fb6b18ba3bb7440b1a300c
Parents: acb5d2b
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Thu Apr 2 10:55:24 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Thu Apr 2 10:55:24 2015 +0300

----------------------------------------------------------------------
 .../ignite/internal/processors/query/GridQueryProcessor.java | 8 ++++++--
 .../query/h2/twostep/messages/GridQueryNextPageResponse.java | 2 ++
 2 files changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/162bdac1/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
index 4e30f41..048a0c8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
@@ -124,7 +124,10 @@ public class GridQueryProcessor extends GridProcessorAdapter {
                 desc.name(valCls != null ? typeName(valCls) : meta.getValueType());
 
                 desc.valueClass(valCls != null ? valCls : Object.class);
-                desc.keyClass(meta.getKeyType() == null ? Object.class : U.classForName(meta.getKeyType(), Object.class));
+                desc.keyClass(
+                    meta.getKeyType() == null ?
+                        Object.class :
+                        U.classForName(meta.getKeyType(), Object.class));
 
                 TypeId typeId;
 
@@ -1448,7 +1451,8 @@ public class GridQueryProcessor extends GridProcessorAdapter {
             else {
                 int isKeyProp0 = isKeyProp;
 
-                if (isKeyProp0 == 0) { // Key is allowed to be a non-portable object here.
+                if (isKeyProp0 == 0) {
+                    // Key is allowed to be a non-portable object here.
                     // We check key before value consistently with ClassProperty.
                     if (ctx.cacheObjects().isPortableObject(key) && ctx.cacheObjects().hasField(key, propName))
                         isKeyProp = isKeyProp0 = 1;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/162bdac1/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryNextPageResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryNextPageResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryNextPageResponse.java
index 22f9cb4..b7b6f4c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryNextPageResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryNextPageResponse.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.internal.processors.query.h2.twostep.messages;
 
+import org.apache.ignite.internal.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
 import org.apache.ignite.plugin.extensions.communication.*;
 
@@ -46,6 +47,7 @@ public class GridQueryNextPageResponse implements Message {
     private byte[] rows;
 
     /** */
+    @GridDirectTransient
     private transient Object plainRows;
 
     /**


[16/37] incubator-ignite git commit: Merge branches 'ignite-gg-9942' and 'ignite-sprint-3' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-gg-9942

Posted by sb...@apache.org.
Merge branches 'ignite-gg-9942' and 'ignite-sprint-3' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-gg-9942


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/624eaf45
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/624eaf45
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/624eaf45

Branch: refs/heads/ignite-cacheplug-rmtvalid
Commit: 624eaf454d68bb82ff3ecfedd1b2208db4a2e423
Parents: e2cbd21 9b23109
Author: AKuznetsov <ak...@gridgain.com>
Authored: Thu Apr 2 16:41:11 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Thu Apr 2 16:41:11 2015 +0700

----------------------------------------------------------------------
 DEVNOTES.txt                                        |  2 ++
 .../apache/ignite/IgniteCacheAffinitySelfTest.java  |  2 ++
 .../cache/GridCacheOnCopyFlagAbstractSelfTest.java  | 16 +++++++++-------
 parent/pom.xml                                      | 10 +++++++++-
 4 files changed, 22 insertions(+), 8 deletions(-)
----------------------------------------------------------------------



[03/37] incubator-ignite git commit: # GG-9942 Fixed Visor logic after DR was reworked.

Posted by sb...@apache.org.
# GG-9942 Fixed Visor logic after DR was reworked.


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/c8428a45
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/c8428a45
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/c8428a45

Branch: refs/heads/ignite-cacheplug-rmtvalid
Commit: c8428a453bdee6da2fa0a6221d53c41f157f4e45
Parents: b05b06f
Author: AKuznetsov <ak...@gridgain.com>
Authored: Wed Apr 1 18:12:43 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Wed Apr 1 18:12:43 2015 +0700

----------------------------------------------------------------------
 .../visor/cache/VisorCacheConfiguration.java    | 81 ++++++++------------
 .../visor/node/VisorGridConfiguration.java      | 28 ++++++-
 2 files changed, 58 insertions(+), 51 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c8428a45/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfiguration.java
index 98a8bc2..923fedd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfiguration.java
@@ -121,56 +121,37 @@ public class VisorCacheConfiguration implements Serializable {
      * @param ccfg Cache configuration.
      * @return Data transfer object for cache configuration properties.
      */
-    public static VisorCacheConfiguration from(Ignite ignite, CacheConfiguration ccfg) {
-        VisorCacheConfiguration cfg = new VisorCacheConfiguration();
-
-        cfg.name = ccfg.getName();
-        cfg.mode = ccfg.getCacheMode();
-        cfg.atomicityMode = ccfg.getAtomicityMode();
-        cfg.atomicWriteOrderMode = ccfg.getAtomicWriteOrderMode();
-        cfg.eagerTtl = ccfg.isEagerTtl();
-        cfg.writeSynchronizationMode = ccfg.getWriteSynchronizationMode();
-        cfg.swapEnabled = ccfg.isSwapEnabled();
-        cfg.invalidate = ccfg.isInvalidate();
-        cfg.startSize = ccfg.getStartSize();
-        cfg.tmLookupClsName = ccfg.getTransactionManagerLookupClassName();
-        cfg.offHeapMaxMemory = ccfg.getOffHeapMaxMemory();
-        cfg.maxConcurrentAsyncOps = ccfg.getMaxConcurrentAsyncOperations();
-        cfg.memoryMode = ccfg.getMemoryMode();
-        cfg.interceptor = compactClass(ccfg.getInterceptor());
-        cfg.typeMeta = VisorCacheTypeMetadata.list(ccfg.getTypeMetadata());
-        cfg.statisticsEnabled = ccfg.isStatisticsEnabled();
-        cfg.mgmtEnabled = ccfg.isManagementEnabled();
-        cfg.ldrFactory = compactClass(ccfg.getCacheLoaderFactory());
-        cfg.writerFactory = compactClass(ccfg.getCacheWriterFactory());
-        cfg.expiryPlcFactory = compactClass(ccfg.getExpiryPolicyFactory());
-
-        cfg.affinityCfg = VisorCacheAffinityConfiguration.from(ccfg);
-        cfg.rebalanceCfg = VisorCacheRebalanceConfiguration.from(ccfg);
-        cfg.evictCfg = VisorCacheEvictionConfiguration.from(ccfg);
-        cfg.nearCfg = VisorCacheNearConfiguration.from(ccfg);
-        cfg.dfltCfg = VisorCacheDefaultConfiguration.from(ccfg);
-        cfg.storeCfg = VisorCacheStoreConfiguration.from(ignite, ccfg);
-        cfg.qryCfg = VisorCacheQueryConfiguration.from(ccfg);
-
-        return cfg;
-    }
-
-    /**
-     * @param ignite Grid.
-     * @param caches Cache configurations.
-     * @return Data transfer object for cache configurations properties.
-     */
-    public static Iterable<VisorCacheConfiguration> list(Ignite ignite, CacheConfiguration[] caches) {
-        if (caches == null)
-            return Collections.emptyList();
-
-        final Collection<VisorCacheConfiguration> cfgs = new ArrayList<>(caches.length);
-
-        for (CacheConfiguration cache : caches)
-            cfgs.add(from(ignite, cache));
-
-        return cfgs;
+    public VisorCacheConfiguration from(Ignite ignite, CacheConfiguration ccfg) {
+        name = ccfg.getName();
+        mode = ccfg.getCacheMode();
+        atomicityMode = ccfg.getAtomicityMode();
+        atomicWriteOrderMode = ccfg.getAtomicWriteOrderMode();
+        eagerTtl = ccfg.isEagerTtl();
+        writeSynchronizationMode = ccfg.getWriteSynchronizationMode();
+        swapEnabled = ccfg.isSwapEnabled();
+        invalidate = ccfg.isInvalidate();
+        startSize = ccfg.getStartSize();
+        tmLookupClsName = ccfg.getTransactionManagerLookupClassName();
+        offHeapMaxMemory = ccfg.getOffHeapMaxMemory();
+        maxConcurrentAsyncOps = ccfg.getMaxConcurrentAsyncOperations();
+        memoryMode = ccfg.getMemoryMode();
+        interceptor = compactClass(ccfg.getInterceptor());
+        typeMeta = VisorCacheTypeMetadata.list(ccfg.getTypeMetadata());
+        statisticsEnabled = ccfg.isStatisticsEnabled();
+        mgmtEnabled = ccfg.isManagementEnabled();
+        ldrFactory = compactClass(ccfg.getCacheLoaderFactory());
+        writerFactory = compactClass(ccfg.getCacheWriterFactory());
+        expiryPlcFactory = compactClass(ccfg.getExpiryPolicyFactory());
+
+        affinityCfg = VisorCacheAffinityConfiguration.from(ccfg);
+        rebalanceCfg = VisorCacheRebalanceConfiguration.from(ccfg);
+        evictCfg = VisorCacheEvictionConfiguration.from(ccfg);
+        nearCfg = VisorCacheNearConfiguration.from(ccfg);
+        dfltCfg = VisorCacheDefaultConfiguration.from(ccfg);
+        storeCfg = VisorCacheStoreConfiguration.from(ignite, ccfg);
+        qryCfg = VisorCacheQueryConfiguration.from(ccfg);
+
+        return this;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c8428a45/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorGridConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorGridConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorGridConfiguration.java
index f6243c1..6548d07 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorGridConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorGridConfiguration.java
@@ -106,7 +106,7 @@ public class VisorGridConfiguration implements Serializable {
         inclEvtTypes = c.getIncludeEventTypes();
         rest = VisorRestConfiguration.from(c);
         userAttrs = c.getUserAttributes();
-        caches = VisorCacheConfiguration.list(ignite, c.getCacheConfiguration());
+        caches = collectCaches(ignite, c.getCacheConfiguration());
         igfss = VisorIgfsConfiguration.list(c.getFileSystemConfiguration());
         env = new HashMap<>(System.getenv());
         sysProps = IgniteSystemProperties.snapshot();
@@ -194,6 +194,32 @@ public class VisorGridConfiguration implements Serializable {
     }
 
     /**
+     * @return List of data transfer objects for caches.
+     */
+    private Iterable<VisorCacheConfiguration> collectCaches(IgniteEx ignite, CacheConfiguration[] ccfgs) {
+        if (ccfgs == null)
+            return Collections.emptyList();
+
+        final Collection<VisorCacheConfiguration> res = new ArrayList<>(ccfgs.length);
+
+        for (CacheConfiguration ccfg : ccfgs)
+            res.add(collectCache(ignite, ccfg));
+
+        return res;
+    }
+
+    /**
+     * Create data transfer object for cache configuration.
+     *
+     * @param ignite Ignite instance.
+     * @param ccfg Cache configuration.
+     * @return Data transfer objects for cache
+     */
+    protected VisorCacheConfiguration collectCache(IgniteEx ignite, CacheConfiguration ccfg) {
+        return new VisorCacheConfiguration().from(ignite, ccfg);
+    }
+
+    /**
      * @return Caches.
      */
     public Iterable<VisorCacheConfiguration> caches() {