Merge remote-tracking branch 'remotes/origin/ignite-sprint-3' into ignite-629-1
Conflicts: modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheProjection.java modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionImpl.java modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.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/a4f580e8 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/a4f580e8 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/a4f580e8 Branch: refs/heads/ignite-598 Commit: a4f580e8bec7a5ac2ed8ac265ceb7a6c2e07d68f Parents: 5fd9ded dfe90fb Author: sboikov <sboi...@gridgain.com> Authored: Tue Mar 31 13:01:22 2015 +0300 Committer: sboikov <sboi...@gridgain.com> Committed: Tue Mar 31 13:01:22 2015 +0300 ---------------------------------------------------------------------- .../org/apache/ignite/internal/IgniteEx.java | 4 +- .../apache/ignite/internal/IgniteKernal.java | 5 +- .../processors/cache/CacheProjection.java | 24 -- .../processors/cache/GridCacheAdapter.java | 60 +--- .../processors/cache/GridCacheProcessor.java | 11 - .../processors/cache/GridCacheProjectionEx.java | 9 - .../cache/GridCacheProjectionImpl.java | 276 +++---------------- .../processors/cache/GridCacheProxyImpl.java | 19 -- .../processors/cache/IgniteCacheProxy.java | 2 +- .../CacheDataStructuresManager.java | 4 +- .../cache/query/GridCacheQueriesImpl.java | 23 +- .../GridProjectionForCachesSelfTest.java | 12 +- ...achePartitionedMultiNodeFullApiSelfTest.java | 2 + .../GridServiceReassignmentSelfTest.java | 5 +- .../hadoop/jobtracker/HadoopJobTracker.java | 7 +- .../HadoopDefaultMapReducePlannerSelfTest.java | 3 +- 16 files changed, 56 insertions(+), 410 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a4f580e8/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheProjection.java ---------------------------------------------------------------------- diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheProjection.java index d4f1ec0,c6e13ee..0ff316d --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheProjection.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheProjection.java @@@ -217,34 -219,25 +217,10 @@@ public interface CacheProjection<K, V> public CacheQueries<K, V> queries(); /** - * Gets cache projection only for given key and value type. Only {@code non-null} key-value - * pairs that have matching key and value pairs will be used in this projection. - * - * @param keyType Key type. - * @param valType Value type. - * @param <K1> Key type. - * @param <V1> Value type. - * @return Cache projection for given key and value types. - */ - public <K1, V1> CacheProjection<K1, V1> projection(Class<? super K1> keyType, Class<? super V1> valType); - - /** - * Gets cache projection based on given entry filter. This filter will be simply passed through - * to all cache operations on this projection. Unlike <code>projection(org.apache.ignite.lang.IgniteBiPredicate)</code> - * method, this filter will <b>not</b> be used for pre-filtering. - * Gets cache projection base on this one, but with the specified flags turned on. - * <h1 class="header">Cache Flags</h1> - * The resulting projection will inherit all the flags from this projection. -- * - * @param filter Filter to be passed through to all cache operations. If {@code null}, then the - * same projection is returned. If cache operation receives its own filter, then filters - * will be {@code 'anded'}. - * @return Projection based on given filter. - */ - public CacheProjection<K, V> projection(@Nullable CacheEntryPredicate filter); - - /** - * @param flags Flags to turn on (if empty, then no-op). - * @return New projection based on this one, but with the specified flags turned on. + * @param skipStore Skip store flag. + * @return New projection based on this one, but with skip store flag enabled. */ - public CacheProjection<K, V> flagsOn(@Nullable CacheFlag... flags); - - /** - * Gets cache projection base on this but with the specified flags turned off. - * <h1 class="header">Cache Flags</h1> - * The resulting projection will inherit all the flags from this projection except for - * the ones that were turned off. - * - * @param flags Flags to turn off (if empty, then all flags will be turned off). - * @return New projection based on this one, but with the specified flags turned off. - */ - public CacheProjection<K, V> flagsOff(@Nullable CacheFlag... flags); + public CacheProjection<K, V> setSkipStore(boolean skipStore); /** * Creates projection that will operate with portable objects. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a4f580e8/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java ---------------------------------------------------------------------- diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java index 00ab5719,4c77c68..c3a1225 --- 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 @@@ -379,16 -380,15 +379,10 @@@ public abstract class GridCacheAdapter< } /** {@inheritDoc} */ - @Override public CacheEntryPredicate predicate() { - return null; - @Override public Set<CacheFlag> flags() { - return F.asSet(ctx.forcedFlags()); -- } -- -- /** {@inheritDoc} */ @Override public GridCacheProjectionEx<K, V> forSubjectId(UUID subjId) { GridCacheProjectionImpl<K, V> prj = new GridCacheProjectionImpl<>(this, ctx, -- null, + false, subjId, false, null); @@@ -408,8 -403,7 +402,8 @@@ GridCacheProjectionImpl<K, V> prj = new GridCacheProjectionImpl<>(this, ctx, - EnumSet.copyOf(F.asList(flags)), + null, - skipStore, ++ false, null, false, null); @@@ -458,59 -455,8 +452,7 @@@ plc); } - /** {@inheritDoc} */ - @SuppressWarnings({"unchecked", "RedundantCast"}) - @Override public <K1, V1> CacheProjection<K1, V1> projection( - Class<? super K1> keyType, - Class<? super V1> valType - ) { - if (ctx.deploymentEnabled()) { - try { - ctx.deploy().registerClasses(keyType, valType); - } - catch (IgniteCheckedException e) { - throw new IgniteException(e); - } - } - - GridCacheProjectionImpl<K1, V1> prj = new GridCacheProjectionImpl<>((CacheProjection<K1, V1>)this, - (GridCacheContext<K1, V1>)ctx, - CU.typeFilter0(keyType, valType), - false, - /*clientId*/null, - false, - null); - - return new GridCacheProxyImpl<>((GridCacheContext<K1, V1>)ctx, prj, prj); - } - - /** {@inheritDoc} */ - @Override public CacheProjection<K, V> projection(CacheEntryPredicate filter) { - if (filter == null) - return this; - - if (ctx.deploymentEnabled()) { - try { - ctx.deploy().registerClasses(filter); - } - catch (IgniteCheckedException e) { - throw new IgniteException(e); - } - } - - GridCacheProjectionImpl<K, V> prj = new GridCacheProjectionImpl<>( - this, - ctx, - filter, - false, - null, - false, - null); - - return new GridCacheProxyImpl<>(ctx, prj, prj); - } - - /** {@inheritDoc} */ @Override public CacheConfiguration configuration() { return ctx.config(); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a4f580e8/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionEx.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a4f580e8/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionImpl.java ---------------------------------------------------------------------- diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionImpl.java index eea665a,5526f51..53d353f --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionImpl.java @@@ -88,8 -82,7 +82,7 @@@ public class GridCacheProjectionImpl<K /** * @param parent Parent projection. * @param cctx Cache context. - * @param entryFilter Entry filter. - * @param flags Flags for new projection + * @param skipStore Skip store flag. * @param subjId Subject ID. * @param keepPortable Keep portable flag. * @param expiryPlc Expiry policy. @@@ -97,21 -90,24 +90,17 @@@ public GridCacheProjectionImpl( CacheProjection<K, V> parent, GridCacheContext<K, V> cctx, - @Nullable CacheEntryPredicate entryFilter, - @Nullable Set<CacheFlag> flags, + boolean skipStore, @Nullable UUID subjId, boolean keepPortable, @Nullable ExpiryPolicy expiryPlc) { assert parent != null; assert cctx != null; - // Check if projection flags are conflicting with an ongoing transaction, if any. - cctx.shared().checkTxFlags(flags); - this.cctx = cctx; - this.flags = !F.isEmpty(flags) ? EnumSet.copyOf(flags) : EnumSet.noneOf(CacheFlag.class); - - Set<CacheFlag> f = this.flags; - - this.flags = Collections.unmodifiableSet(f); + this.skipStore = skipStore; - this.filter = entryFilter; - this.subjId = subjId; cache = cctx.cache(); @@@ -256,8 -159,7 +152,7 @@@ GridCacheProjectionImpl<K, V> prj = new GridCacheProjectionImpl<>(this, cctx, - filter, - flags, + skipStore, subjId, keepPortable, expiryPlc); @@@ -275,73 -177,42 +170,13 @@@ } /** {@inheritDoc} */ - @SuppressWarnings( {"unchecked", "RedundantCast"}) - @Override public <K1, V1> CacheProjection<K1, V1> projection( - Class<? super K1> keyType, - Class<? super V1> valType - ) { - A.notNull(keyType, "keyType", valType, "valType"); - - if (cctx.deploymentEnabled()) { - try { - cctx.deploy().registerClasses(keyType, valType); - } - catch (IgniteCheckedException e) { - throw new IgniteException(e); - } - } - - GridCacheProjectionImpl<K1, V1> prj = new GridCacheProjectionImpl<>( - (CacheProjection<K1, V1>)this, - (GridCacheContext<K1, V1>)cctx, - CU.typeFilter0(keyType, valType), - skipStore, - subjId, - keepPortable, - expiryPlc); - - return new GridCacheProxyImpl((GridCacheContext<K1, V1>)cctx, prj, prj); - } - - /** {@inheritDoc} */ - @SuppressWarnings({"unchecked"}) - @Override public CacheProjection<K, V> projection(CacheEntryPredicate filter) { - if (filter == null) - return new GridCacheProxyImpl<>(cctx, this, this); - - if (this.filter != null) - filter = and(filter); - - if (cctx.deploymentEnabled()) { - try { - cctx.deploy().registerClasses(filter); - } - catch (IgniteCheckedException e) { - throw new IgniteException(e); - } - } - - GridCacheProjectionImpl<K, V> prj = new GridCacheProjectionImpl<>(this, - cctx, - filter, - skipStore, - subjId, - keepPortable, - expiryPlc); - - return new GridCacheProxyImpl<>(cctx, prj, prj); - } - - - /** {@inheritDoc} */ - @Override public CacheProjection<K, V> flagsOn(@Nullable CacheFlag[] flags) { - if (F.isEmpty(flags)) + @Override public CacheProjection<K, V> setSkipStore(boolean skipStore) { + if (this.skipStore == skipStore) return new GridCacheProxyImpl<>(cctx, this, this); - Set<CacheFlag> res = EnumSet.noneOf(CacheFlag.class); - - if (!F.isEmpty(this.flags)) - res.addAll(this.flags); - - res.addAll(EnumSet.copyOf(F.asList(flags))); - GridCacheProjectionImpl<K, V> prj = new GridCacheProjectionImpl<>(this, cctx, - filter, - res, - subjId, - keepPortable, - expiryPlc); - - return new GridCacheProxyImpl<>(cctx, prj, prj); - } - - /** {@inheritDoc} */ - @Override public CacheProjection<K, V> flagsOff(@Nullable CacheFlag[] flags) { - if (F.isEmpty(flags)) - return new GridCacheProxyImpl<>(cctx, this, this); - - Set<CacheFlag> res = EnumSet.noneOf(CacheFlag.class); - - if (!F.isEmpty(this.flags)) - res.addAll(this.flags); - - res.removeAll(EnumSet.copyOf(F.asList(flags))); - - GridCacheProjectionImpl<K, V> prj = new GridCacheProjectionImpl<>(this, - cctx, - res, + skipStore, subjId, keepPortable, expiryPlc); @@@ -354,8 -225,7 +189,7 @@@ GridCacheProjectionImpl<K1, V1> prj = new GridCacheProjectionImpl<>( (CacheProjection<K1, V1>)this, (GridCacheContext<K1, V1>)cctx, - filter, - flags, + skipStore, subjId, true, expiryPlc); @@@ -1112,8 -954,7 +907,7 @@@ return new GridCacheProjectionImpl<>( this, cctx, - filter, - flags, + skipStore, subjId, true, plc); @@@ -1123,9 -964,7 +917,7 @@@ @Override public void writeExternal(ObjectOutput out) throws IOException { out.writeObject(cctx); - out.writeObject(filter); - - U.writeCollection(out, flags); + out.writeBoolean(skipStore); out.writeBoolean(keepPortable); } @@@ -1135,9 -974,7 +927,7 @@@ @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { cctx = (GridCacheContext<K, V>)in.readObject(); - filter = (CacheEntryPredicate)in.readObject(); - - flags = U.readSet(in); + skipStore = in.readBoolean(); cache = cctx.cache(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a4f580e8/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java ---------------------------------------------------------------------- diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java index 79cf9b2,e66c9f9..d2a561a --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java @@@ -297,31 -285,7 +297,12 @@@ public class GridCacheProxyImpl<K, V> i } /** {@inheritDoc} */ - @Override public CacheEntryPredicate predicate() { - return delegate.predicate(); - } - - /** {@inheritDoc} */ - @Override public Set<CacheFlag> flags() { + @Override public GridCacheProjectionEx<K, V> forSubjectId(UUID subjId) { + return delegate.forSubjectId(subjId); + } + + /** {@inheritDoc} */ - @Override public <K1, V1> CacheProjection<K1, V1> projection( - Class<? super K1> keyType, - Class<? super V1> valType - ) { - return delegate.projection(keyType, valType); - } - - /** {@inheritDoc} */ - @Override public CacheProjection<K, V> projection( - @Nullable CacheEntryPredicate filter) { - return delegate.projection(filter); - } - - /** {@inheritDoc} */ + @Override public CacheProjection<K, V> setSkipStore(boolean skipStore) { GridCacheProjectionImpl<K, V> prev = gate.enter(prj); try { http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a4f580e8/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java ---------------------------------------------------------------------- diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java index aba0c73,fcbfcb2..364b1c3 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java @@@ -1384,8 -1384,7 +1384,7 @@@ public class IgniteCacheProxy<K, V> ext GridCacheProjectionImpl<K1, V1> prj0 = new GridCacheProjectionImpl<>( (CacheProjection<K1, V1>)(prj != null ? prj : delegate), (GridCacheContext<K1, V1>)ctx, - null, - prj != null ? prj.flags() : null, + prj != null ? prj.skipStore() : false, prj != null ? prj.subjectId() : null, true, prj != null ? prj.expiry() : null); @@@ -1415,10 -1425,9 +1414,11 @@@ GridCacheProjectionImpl<K, V> prj0 = new GridCacheProjectionImpl<>( (prj != null ? prj : delegate), ctx, - res, + null, + prj != null ? prj.subjectId() : null, true, + prj != null ? prj.subjectId() : null, + prj != null && prj.isKeepPortable(), prj != null ? prj.expiry() : null); return new IgniteCacheProxy<>(ctx,