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 2017/04/24 13:49:08 UTC
ignite git commit: Removed unused swap-related code.
Repository: ignite
Updated Branches:
refs/heads/ignite-2.0 b58d58429 -> 340204333
Removed unused swap-related code.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/34020433
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/34020433
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/34020433
Branch: refs/heads/ignite-2.0
Commit: 340204333624ecbc4166e52a83056885c673373c
Parents: b58d584
Author: sboikov <sb...@gridgain.com>
Authored: Mon Apr 24 16:49:02 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Mon Apr 24 16:49:02 2017 +0300
----------------------------------------------------------------------
.../cache/GridCacheBatchSwapEntry.java | 76 -----
.../processors/cache/GridCacheEntryEx.java | 23 --
.../cache/GridCacheEvictionManager.java | 95 +-----
.../processors/cache/GridCacheMapEntry.java | 73 ----
.../processors/cache/GridCacheSwapEntry.java | 82 -----
.../cache/GridCacheSwapEntryImpl.java | 339 -------------------
.../cache/IgniteCacheOffheapManager.java | 3 -
.../cache/IgniteCacheOffheapManagerImpl.java | 5 -
.../processors/cache/GridCacheTestEntryEx.java | 15 -
9 files changed, 9 insertions(+), 702 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/34020433/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheBatchSwapEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheBatchSwapEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheBatchSwapEntry.java
deleted file mode 100644
index 01c9bab..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheBatchSwapEntry.java
+++ /dev/null
@@ -1,76 +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 java.nio.ByteBuffer;
-import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
-import org.apache.ignite.lang.IgniteUuid;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Entry for batch swap operations.
- */
-public class GridCacheBatchSwapEntry extends GridCacheSwapEntryImpl {
- /** Key. */
- private KeyCacheObject key;
-
- /** Partition. */
- private int part;
-
- /**
- * Creates batch swap entry.
- *
- * @param key Key.
- * @param part Partition id.
- * @param valBytes Value bytes.
- * @param type Value type.
- * @param ver Version.
- * @param ttl Time to live.
- * @param expireTime Expire time.
- * @param keyClsLdrId Key class loader ID.
- * @param valClsLdrId Optional value class loader ID.
- */
- public GridCacheBatchSwapEntry(KeyCacheObject key,
- int part,
- ByteBuffer valBytes,
- byte type,
- GridCacheVersion ver,
- long ttl,
- long expireTime,
- IgniteUuid keyClsLdrId,
- @Nullable IgniteUuid valClsLdrId) {
- super(valBytes, type, ver, ttl, expireTime, keyClsLdrId, valClsLdrId);
-
- this.key = key;
- this.part = part;
- }
-
- /**
- * @return Key.
- */
- public KeyCacheObject key() {
- return key;
- }
-
- /**
- * @return Partition id.
- */
- public int partition() {
- return part;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/34020433/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
index 1eab04e..6a5b4b9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
@@ -221,16 +221,6 @@ public interface GridCacheEntryEx {
boolean evictOffheap) throws IgniteCheckedException;
/**
- * Evicts entry when batch evict is performed. When called, does not write entry data to swap, but instead
- * returns batch swap entry if entry was marked obsolete.
- *
- * @param obsoleteVer Version to mark obsolete with.
- * @return Swap entry if this entry was marked obsolete, {@code null} if entry was not evicted.
- * @throws IgniteCheckedException If failed.
- */
- public GridCacheBatchSwapEntry evictInBatchInternal(GridCacheVersion obsoleteVer) throws IgniteCheckedException;
-
- /**
* This method should be called each time entry is marked obsolete
* other than by calling {@link #markObsolete(GridCacheVersion)}.
*/
@@ -695,19 +685,6 @@ public interface GridCacheEntryEx {
boolean fromStore) throws IgniteCheckedException, GridCacheEntryRemovedException;
/**
- * Sets new value if current version is <tt>0</tt> using swap entry data.
- * Note that this method does not update cache index.
- *
- * @param key Key.
- * @param unswapped Swap entry to set entry state from.
- * @return {@code True} if initial value was set.
- * @throws IgniteCheckedException In case of error.
- * @throws GridCacheEntryRemovedException If entry was removed.
- */
- public boolean initialValue(KeyCacheObject key, GridCacheSwapEntry unswapped)
- throws IgniteCheckedException, GridCacheEntryRemovedException;
-
- /**
* Create versioned entry for this cache entry.
*
* @param keepBinary Keep binary flag.
http://git-wip-us.apache.org/repos/asf/ignite/blob/34020433/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionManager.java
index 0deae07..8ba10a2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionManager.java
@@ -17,12 +17,7 @@
package org.apache.ignite.internal.processors.cache;
-import java.util.ArrayList;
import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Map;
import java.util.Set;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.cache.eviction.EvictionFilter;
@@ -31,8 +26,8 @@ import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.transactions.IgniteTxEntry;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.internal.processors.cache.version.GridCacheVersionManager;
import org.apache.ignite.internal.util.GridBusyLock;
-import org.apache.ignite.internal.util.GridUnsafe;
import org.apache.ignite.internal.util.typedef.X;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteUuid;
@@ -260,96 +255,24 @@ public class GridCacheEvictionManager extends GridCacheManagerAdapter implements
/** {@inheritDoc} */
@Override public void batchEvict(Collection<?> keys, @Nullable GridCacheVersion obsoleteVer)
throws IgniteCheckedException {
- List<GridCacheEntryEx> locked = new ArrayList<>(keys.size());
-
- Set<GridCacheEntryEx> notRmv = null;
-
- Collection<GridCacheBatchSwapEntry> swapped = new ArrayList<>(keys.size());
-
boolean recordable = cctx.events().isRecordable(EVT_CACHE_ENTRY_EVICTED);
GridCacheAdapter cache = cctx.cache();
- Map<Object, GridCacheEntryEx> cached = U.newLinkedHashMap(keys.size());
-
// Get all participating entries to avoid deadlock.
for (Object k : keys) {
KeyCacheObject cacheKey = cctx.toCacheKeyObject(k);
- GridCacheEntryEx e = cache.peekEx(cacheKey);
-
- if (e != null)
- cached.put(k, e);
- }
-
- try {
- for (GridCacheEntryEx entry : cached.values()) {
- // Do not evict internal entries.
- if (entry.key().internal())
- continue;
-
- // Lock entry.
- GridUnsafe.monitorEnter(entry);
-
- locked.add(entry);
-
- if (entry.obsolete()) {
- if (notRmv == null)
- notRmv = new HashSet<>();
-
- notRmv.add(entry);
-
- continue;
- }
-
- if (obsoleteVer == null)
- obsoleteVer = cctx.versions().next();
-
- GridCacheBatchSwapEntry swapEntry = entry.evictInBatchInternal(obsoleteVer);
-
- if (swapEntry != null) {
- assert entry.obsolete() : entry;
-
- swapped.add(swapEntry);
-
- if (log.isDebugEnabled())
- log.debug("Entry was evicted [entry=" + entry + ", localNode=" + cctx.nodeId() + ']');
- }
- else if (!entry.obsolete()) {
- if (notRmv == null)
- notRmv = new HashSet<>();
-
- notRmv.add(entry);
- }
- }
-
- // Batch write to swap.
- if (!swapped.isEmpty())
- cctx.offheap().writeAll(swapped);
- }
- finally {
- // Unlock entries in reverse order.
- for (ListIterator<GridCacheEntryEx> it = locked.listIterator(locked.size()); it.hasPrevious(); ) {
- GridCacheEntryEx e = it.previous();
-
- GridUnsafe.monitorExit(e);
- }
-
- // Remove entries and fire events outside the locks.
- for (GridCacheEntryEx entry : locked) {
- if (entry.obsolete() && (notRmv == null || !notRmv.contains(entry))) {
- entry.onMarkedObsolete();
-
- cache.removeEntry(entry);
+ GridCacheEntryEx entry = cache.peekEx(cacheKey);
- if (plcEnabled)
- notifyPolicy(entry);
+ if (entry != null && entry.evictInternal(GridCacheVersionManager.EVICT_VER, null, false)) {
+ if (plcEnabled)
+ notifyPolicy(entry);
- if (recordable)
- cctx.events().addEvent(entry.partition(), entry.key(), cctx.nodeId(), (IgniteUuid)null, null,
- EVT_CACHE_ENTRY_EVICTED, null, false, entry.rawGet(), entry.hasValue(), null, null, null,
- false);
- }
+ if (recordable)
+ cctx.events().addEvent(entry.partition(), entry.key(), cctx.nodeId(), (IgniteUuid)null, null,
+ EVT_CACHE_ENTRY_EVICTED, null, false, entry.rawGet(), entry.hasValue(), null, null, null,
+ false);
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/34020433/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 856ac993..21c58fa 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
@@ -2709,31 +2709,6 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
}
/** {@inheritDoc} */
- @Override public synchronized boolean initialValue(KeyCacheObject key, GridCacheSwapEntry unswapped) throws
- IgniteCheckedException,
- GridCacheEntryRemovedException {
- checkObsolete();
-
- if (isNew()) {
- CacheObject val = unswapped.value();
-
- val = cctx.kernalContext().cacheObjects().prepareForCache(val, cctx);
-
- // Version does not change for load ops.
- update(val,
- unswapped.expireTime(),
- unswapped.ttl(),
- unswapped.version(),
- true
- );
-
- return true;
- }
-
- return false;
- }
-
- /** {@inheritDoc} */
@Override public synchronized GridCacheVersionedEntryEx versionedEntry(final boolean keepBinary)
throws IgniteCheckedException, GridCacheEntryRemovedException {
boolean isNew = isStartVersion();
@@ -3518,54 +3493,6 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
return false;
}
- /** {@inheritDoc} */
- @Override public final GridCacheBatchSwapEntry evictInBatchInternal(GridCacheVersion obsoleteVer)
- throws IgniteCheckedException {
- assert Thread.holdsLock(this);
- assert !obsolete();
-
- GridCacheBatchSwapEntry ret = null;
-
- try {
- if (!hasReaders() && markObsolete0(obsoleteVer, false, null)) {
- if (!isStartVersion() && hasValueUnlocked()) {
- IgniteUuid valClsLdrId = null;
- IgniteUuid keyClsLdrId = null;
-
- if (cctx.deploymentEnabled()) {
- if (val != null) {
- valClsLdrId = cctx.deploy().getClassLoaderId(
- U.detectObjectClassLoader(val.value(cctx.cacheObjectContext(), false)));
- }
-
- keyClsLdrId = cctx.deploy().getClassLoaderId(
- U.detectObjectClassLoader(keyValue(false)));
- }
-
- IgniteBiTuple<byte[], Byte> valBytes = valueBytes0();
-
- ret = new GridCacheBatchSwapEntry(key(),
- partition(),
- ByteBuffer.wrap(valBytes.get1()),
- valBytes.get2(),
- ver,
- ttlExtras(),
- expireTimeExtras(),
- keyClsLdrId,
- valClsLdrId);
- }
-
- value(null);
- }
- }
- catch (GridCacheEntryRemovedException ignored) {
- if (log.isDebugEnabled())
- log.debug("Got removed entry when evicting (will simply return): " + this);
- }
-
- return ret;
- }
-
/**
* @param filter Entry filter.
* @return {@code True} if entry is visitable.
http://git-wip-us.apache.org/repos/asf/ignite/blob/34020433/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapEntry.java
deleted file mode 100644
index 73519eb..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapEntry.java
+++ /dev/null
@@ -1,82 +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.processors.cache.version.GridCacheVersion;
-import org.apache.ignite.lang.IgniteUuid;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Swap entry.
- */
-public interface GridCacheSwapEntry {
- /**
- * @return Value bytes.
- */
- public byte[] valueBytes();
-
- /**
- * @return Object type.
- */
- public byte type();
-
- /**
- * @param valBytes Value bytes.
- */
- public void valueBytes(@Nullable byte[] valBytes);
-
- /**
- * @return Value.
- */
- public CacheObject value();
-
- /**
- * @param val Value.
- */
- public void value(CacheObject val);
-
- /**
- * @return Version.
- */
- public GridCacheVersion version();
-
- /**
- * @return Time to live.
- */
- public long ttl();
-
- /**
- * @return Expire time.
- */
- public long expireTime();
-
- /**
- * @return Class loader ID for entry key ({@code null} for local class loader).
- */
- @Nullable public IgniteUuid keyClassLoaderId();
-
- /**
- * @return Class loader ID for entry value ({@code null} for local class loader).
- */
- @Nullable public IgniteUuid valueClassLoaderId();
-
- /**
- * @return If entry is offheap based returns offheap address, otherwise 0.
- */
- public long offheapPointer();
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/34020433/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapEntryImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapEntryImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapEntryImpl.java
deleted file mode 100644
index 410a6ee..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapEntryImpl.java
+++ /dev/null
@@ -1,339 +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 java.nio.ByteBuffer;
-import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
-import org.apache.ignite.internal.processors.cache.version.GridCacheVersionEx;
-import org.apache.ignite.internal.util.GridUnsafe;
-import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.lang.IgniteBiTuple;
-import org.apache.ignite.lang.IgniteUuid;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Swap entry.
- */
-public class GridCacheSwapEntryImpl implements GridCacheSwapEntry {
- /** */
- static final int EXPIRE_TIME_OFFSET = 8;
-
- /** */
- static final int VERSION_OFFSET = 16;
-
- /** */
- static final int VERSION_SIZE = 16;
-
- /** */
- static final int VERSION_EX_SIZE = 32;
-
- /** */
- static final int GUID_SIZE = 24;
-
- /** Value bytes. */
- private ByteBuffer valBytes;
-
- /** Value. */
- private CacheObject val;
-
- /** Type. */
- private byte type;
-
- /** Class loader ID. */
- private IgniteUuid keyClsLdrId;
-
- /** Class loader ID. */
- private IgniteUuid valClsLdrId;
-
- /** Version. */
- private GridCacheVersion ver;
-
- /** Time to live. */
- private long ttl;
-
- /** Expire time. */
- private long expireTime;
-
- /**
- * @param valBytes Value.
- * @param type Type.
- * @param ver Version.
- * @param ttl Entry time to live.
- * @param expireTime Expire time.
- * @param keyClsLdrId Class loader ID for entry key (can be {@code null} for local class loader).
- * @param valClsLdrId Class loader ID for entry value (can be {@code null} for local class loader).
- */
- public GridCacheSwapEntryImpl(
- ByteBuffer valBytes,
- byte type,
- GridCacheVersion ver,
- long ttl,
- long expireTime,
- @Nullable IgniteUuid keyClsLdrId,
- @Nullable IgniteUuid valClsLdrId) {
- this.valBytes = valBytes;
- this.type = type;
- this.ver = ver;
- this.ttl = ttl;
- this.expireTime = expireTime;
- this.valClsLdrId = valClsLdrId;
- this.keyClsLdrId = keyClsLdrId;
- }
-
- /**
- * @param bytes Entry bytes.
- * @return TTL.
- */
- public static long timeToLive(byte[] bytes) {
- return GridUnsafe.getLong(bytes, GridUnsafe.BYTE_ARR_OFF);
- }
-
- /**
- * @param bytes Entry bytes.
- * @return Expire time.
- */
- public static long expireTime(byte[] bytes) {
- return GridUnsafe.getLong(bytes, GridUnsafe.BYTE_ARR_OFF + EXPIRE_TIME_OFFSET);
- }
-
- /**
- * @param bytes Entry bytes.
- * @return Version.
- */
- public static GridCacheVersion version(byte[] bytes) {
- long off = GridUnsafe.BYTE_ARR_OFF + VERSION_OFFSET; // Skip ttl, expire time.
-
- boolean verEx = GridUnsafe.getByte(bytes, off++) != 0;
-
- return U.readVersion(bytes, off, verEx);
- }
-
- /**
- * @param bytes Entry bytes.
- * @return Value if value is byte array, otherwise {@code null}.
- */
- @Nullable public static IgniteBiTuple<byte[], Byte> getValue(byte[] bytes) {
- long off = GridUnsafe.BYTE_ARR_OFF + VERSION_OFFSET; // Skip ttl, expire time.
-
- boolean verEx = GridUnsafe.getByte(bytes, off++) != 0;
-
- off += verEx ? VERSION_EX_SIZE : VERSION_SIZE;
-
- int arrLen = GridUnsafe.getInt(bytes, off);
-
- off += 4;
-
- byte type = GridUnsafe.getByte(bytes, off++);
-
- byte[] valBytes = new byte[arrLen];
-
- GridUnsafe.copyMemory(bytes, off, valBytes, GridUnsafe.BYTE_ARR_OFF, arrLen);
-
- return new IgniteBiTuple<>(valBytes, type);
- }
-
- /** {@inheritDoc} */
- @Override public byte[] valueBytes() {
- if (valBytes != null) {
- assert valBytes.capacity() == valBytes.limit();
-
- return valBytes.array();
- }
-
- return null;
- }
-
- /** {@inheritDoc} */
- @Override public void valueBytes(@Nullable byte[] valBytes) {
- this.valBytes = valBytes != null ? ByteBuffer.wrap(valBytes) : null;
- }
-
- /** {@inheritDoc} */
- @Override public CacheObject value() {
- return val;
- }
-
- /** {@inheritDoc} */
- @Override public void value(CacheObject val) {
- this.val = val;
- }
-
- /** {@inheritDoc} */
- @Override public byte type() {
- return type;
- }
-
- /** {@inheritDoc} */
- @Override public GridCacheVersion version() {
- return ver;
- }
-
- /** {@inheritDoc} */
- @Override public long ttl() {
- return ttl;
- }
-
- /** {@inheritDoc} */
- @Override public long expireTime() {
- return expireTime;
- }
-
- /** {@inheritDoc} */
- @Nullable @Override public IgniteUuid keyClassLoaderId() {
- return keyClsLdrId;
- }
-
- /** {@inheritDoc} */
- @Nullable @Override public IgniteUuid valueClassLoaderId() {
- return valClsLdrId;
- }
-
- /** {@inheritDoc} */
- @Override public long offheapPointer() {
- return 0;
- }
-
- /**
- * @return Entry bytes.
- */
- public byte[] marshal() {
- // Ttl + expire time + Ex Version flag + Version.
- int size = 16 + 1 + ((ver instanceof GridCacheVersionEx) ? VERSION_EX_SIZE : VERSION_SIZE);
-
- size += 1; // Plain byte array flag.
-
- int len = valBytes.limit();
-
- size += len + 4; // Value bytes.
-
- size += (valClsLdrId == null ? 1 : (1 + GUID_SIZE));
-
- size += (keyClsLdrId == null ? 1 : (1 + GUID_SIZE));
-
- byte[] arr = new byte[size];
-
- long off = GridUnsafe.BYTE_ARR_OFF;
-
- GridUnsafe.putLong(arr, off, ttl);
-
- off += 8;
-
- GridUnsafe.putLong(arr, off, expireTime);
-
- off += 8;
-
- off = U.writeVersion(arr, off, ver);
-
- GridUnsafe.putInt(arr, off, len);
-
- off += 4;
-
- GridUnsafe.putByte(arr, off++, type);
-
- GridUnsafe.copyMemory(valBytes.array(), GridUnsafe.BYTE_ARR_OFF, arr, off, len);
-
- off += len;
-
- off = U.writeGridUuid(arr, off, valClsLdrId);
-
- U.writeGridUuid(arr, off, keyClsLdrId);
-
- return arr;
- }
-
- /**
- * @param arr Entry bytes.
- * @param valOnly If {@code true} unmarshalls only entry value.
- * @return Entry.
- */
- public static GridCacheSwapEntryImpl unmarshal(byte[] arr, boolean valOnly) {
- if (valOnly) {
- long off = GridUnsafe.BYTE_ARR_OFF + VERSION_OFFSET; // Skip ttl, expire time.
-
- boolean verEx = GridUnsafe.getByte(arr, off++) != 0;
-
- off += verEx ? VERSION_EX_SIZE : VERSION_SIZE;
-
- int arrLen = GridUnsafe.getInt(arr, off);
-
- off += 4;
-
- byte type = GridUnsafe.getByte(arr, off++);
-
- byte[] valBytes = new byte[arrLen];
-
- GridUnsafe.copyMemory(arr, off, valBytes, GridUnsafe.BYTE_ARR_OFF, arrLen);
-
- return new GridCacheSwapEntryImpl(ByteBuffer.wrap(valBytes),
- type,
- null,
- 0L,
- 0L,
- null,
- null);
- }
-
- long off = GridUnsafe.BYTE_ARR_OFF;
-
- long ttl = GridUnsafe.getLong(arr, off);
-
- off += 8;
-
- long expireTime = GridUnsafe.getLong(arr, off);
-
- off += 8;
-
- boolean verEx = GridUnsafe.getBoolean(arr, off++);
-
- GridCacheVersion ver = U.readVersion(arr, off, verEx);
-
- off += verEx ? VERSION_EX_SIZE : VERSION_SIZE;
-
- int arrLen = GridUnsafe.getInt(arr, off);
-
- off += 4;
-
- byte type = GridUnsafe.getByte(arr, off++);
-
- byte[] valBytes = new byte[arrLen];
-
- GridUnsafe.copyMemory(arr, off, valBytes, GridUnsafe.BYTE_ARR_OFF, arrLen);
-
- off += arrLen;
-
- IgniteUuid valClsLdrId = U.readGridUuid(arr, off);
-
- off += valClsLdrId == null ? 1 : (1 + GUID_SIZE);
-
- IgniteUuid keyClsLdrId = U.readGridUuid(arr, off);
-
- return new GridCacheSwapEntryImpl(ByteBuffer.wrap(valBytes),
- type,
- ver,
- ttl,
- expireTime,
- keyClsLdrId,
- valClsLdrId);
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(GridCacheSwapEntryImpl.class, this);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/34020433/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManager.java
index 4a98f6a..9eb5368 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManager.java
@@ -239,9 +239,6 @@ public interface IgniteCacheOffheapManager extends GridCacheManager {
*/
public GridAtomicLong globalRemoveId();
- // TODO GG-10884: moved from GridCacheSwapManager.
- void writeAll(Iterable<GridCacheBatchSwapEntry> swapped) throws IgniteCheckedException;
-
/**
* @param idxName Index name.
* @return Root page for index tree.
http://git-wip-us.apache.org/repos/asf/ignite/blob/34020433/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
index 73edbe1..650f65e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
@@ -431,11 +431,6 @@ public class IgniteCacheOffheapManagerImpl extends GridCacheManagerAdapter imple
return 0;
}
- /** {@inheritDoc} */
- @Override public void writeAll(Iterable<GridCacheBatchSwapEntry> swapped) throws IgniteCheckedException {
- // No-op.
- }
-
/**
* @param primary {@code True} if need return primary entries.
* @param backup {@code True} if need return backup entries.
http://git-wip-us.apache.org/repos/asf/ignite/blob/34020433/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
index a060f7e..53764ca 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
@@ -376,14 +376,6 @@ public class GridCacheTestEntryEx extends GridMetadataAwareAdapter implements Gr
return false;
}
- /** {@inheritDoc} */
- @Override public GridCacheBatchSwapEntry evictInBatchInternal(GridCacheVersion obsoleteVer)
- throws IgniteCheckedException {
- assert false;
-
- return null;
- }
-
/** @inheritDoc */
@Override public boolean isNew() {
assert false; return false;
@@ -663,13 +655,6 @@ public class GridCacheTestEntryEx extends GridMetadataAwareAdapter implements Gr
}
/** @inheritDoc */
- @Override public boolean initialValue(KeyCacheObject key, GridCacheSwapEntry unswapped) {
- assert false;
-
- return false;
- }
-
- /** @inheritDoc */
@Override public GridCacheVersionedEntryEx versionedEntry(final boolean keepBinary) throws IgniteCheckedException {
return null;
}