You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by kl...@apache.org on 2016/04/29 01:09:56 UTC
[17/50] [abbrv] incubator-geode git commit: GEODE-1304: remove TODO
OFFHEAP comments
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/44f403d9/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelGatewaySenderQueue.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelGatewaySenderQueue.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelGatewaySenderQueue.java
index b4efd21..b0b1a32 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelGatewaySenderQueue.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelGatewaySenderQueue.java
@@ -826,7 +826,6 @@ public class ParallelGatewaySenderQueue implements RegionQueue {
// this.bucketToTempQueueMap.put(bucketId, tempQueue);
// }
tempQueue.add(value);
- // TODO OFFHEAP is value refCount ok here?
// For debugging purpose.
if (isDebugEnabled) {
logger.debug("The value {} is enqueued to the tempQueue for the BucketRegionQueue.", value);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/44f403d9/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/AbstractStoredObject.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/AbstractStoredObject.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/AbstractStoredObject.java
index 22e2d55..7e6ac93 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/AbstractStoredObject.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/AbstractStoredObject.java
@@ -116,7 +116,6 @@ public abstract class AbstractStoredObject implements StoredObject {
if (!isSerialized()) {
return false;
}
- // TODO OFFHEAP: what if the data is compressed?
byte dsCode = this.readDataByte(0);
return dsCode == DSCODE.PDX || dsCode == DSCODE.PDX_ENUM || dsCode == DSCODE.PDX_INLINE_ENUM;
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/44f403d9/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/FreeListManager.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/FreeListManager.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/FreeListManager.java
index 6de7be9..c5e17e8 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/FreeListManager.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/FreeListManager.java
@@ -304,13 +304,6 @@ public class FreeListManager {
/**
* Defragments memory and returns true if enough memory to allocate chunkSize
* is freed. Otherwise returns false;
- * TODO OFFHEAP: what should be done about contiguous chunks that end up being bigger than 2G?
- * Currently if we are given slabs bigger than 2G or that just happen to be contiguous and add
- * up to 2G then the FreeListManager may unify them together into a single Chunk and our 32-bit chunkSize
- * field will overflow. This code needs to detect this and just create a chunk of 2G and then start
- * a new one.
- * Or to prevent it from happening we could just check the incoming slabs and throw away a few bytes
- * to keep them from being contiguous.
*/
boolean defragment(int chunkSize) {
final long startDefragmentationTime = this.ma.getStats().startDefragmentation();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/44f403d9/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/OffHeapStoredObject.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/OffHeapStoredObject.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/OffHeapStoredObject.java
index 9861a54..c2066b4 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/OffHeapStoredObject.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/OffHeapStoredObject.java
@@ -165,7 +165,6 @@ import com.gemstone.gemfire.internal.offheap.annotations.Unretained;
// Hopefully the jvm is smart enough to use our stack for this short lived array.
final byte[] dataCache1 = new byte[1024];
final byte[] dataCache2 = new byte[dataCache1.length];
- // TODO OFFHEAP: no need to copy to heap. Just get the address of each and compare each byte. No need to call incReads when reading from address.
int i;
// inc it twice since we are reading two different objects
MemoryAllocatorImpl.getAllocator().getStats().incReads();
@@ -202,7 +201,6 @@ import com.gemstone.gemfire.internal.offheap.annotations.Unretained;
}
// We want to be able to do this operation without copying any of the data into the heap.
// Hopefully the jvm is smart enough to use our stack for this short lived array.
- // TODO OFFHEAP: no need to copy to heap. Just get the address of each and compare each byte. No need to call incReads when reading from address.
final byte[] dataCache = new byte[1024];
int idx=0;
int i;
@@ -421,7 +419,6 @@ import com.gemstone.gemfire.internal.offheap.annotations.Unretained;
}
protected byte[] getRawBytes() {
byte[] result = getCompressedBytes();
- // TODO OFFHEAP: change the following to assert !isCompressed();
if (isCompressed()) {
throw new UnsupportedOperationException();
}
@@ -441,10 +438,7 @@ import com.gemstone.gemfire.internal.offheap.annotations.Unretained;
@Override
public Object getDeserializedValue(Region r, RegionEntry re) {
if (isSerialized()) {
- // TODO OFFHEAP: debug deserializeChunk
return EntryEventImpl.deserialize(getRawBytes());
- //assert !isCompressed();
- //return EntryEventImpl.deserializeChunk(this);
} else {
return getRawBytes();
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/44f403d9/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/TinyStoredObject.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/TinyStoredObject.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/TinyStoredObject.java
index e8878fa..aee1b15 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/TinyStoredObject.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/TinyStoredObject.java
@@ -160,7 +160,6 @@ public class TinyStoredObject extends AbstractStoredObject {
@Override
public byte readDataByte(int offset) {
- // TODO OFFHEAP: what if the data is compressed?
return getRawBytes()[offset];
}
@@ -181,7 +180,6 @@ public class TinyStoredObject extends AbstractStoredObject {
@Override
public void readDataBytes(int offset, byte[] bytes, int bytesOffset, int size) {
- // TODO OFFHEAP: what if the data is compressed?
byte[] src = getRawBytes();
int dstIdx = bytesOffset;
for (int i = offset; i < offset+size; i++) {
@@ -206,13 +204,11 @@ public class TinyStoredObject extends AbstractStoredObject {
@Override
public boolean checkDataEquals(StoredObject so) {
- // TODO OFFHEAP: what if the data is compressed?
return equals(so);
}
@Override
public boolean checkDataEquals(byte[] serializedObj) {
- // TODO OFFHEAP: what if the data is compressed?
byte[] myBytes = getSerializedValue();
return Arrays.equals(myBytes, serializedObj);
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/44f403d9/geode-core/src/main/java/com/gemstone/gemfire/internal/tcp/MsgStreamer.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/tcp/MsgStreamer.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/tcp/MsgStreamer.java
index 9fb2eb8..d3941bc 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/tcp/MsgStreamer.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/tcp/MsgStreamer.java
@@ -64,12 +64,6 @@ public class MsgStreamer extends OutputStream implements
* Any exceptions that happen during sends
*/
private ConnectExceptions ce;
- // TODO OFFHEAP: instead of MsgStreamer extending OutputStream
- // we could have it extends HeapDataOutputStream.
- // HDOS can now be given a direct ByteBuffer and told
- // to not copy large byte sequences it is given.
- // Also be it being a HDOS we can take advantage of code
- // that is already optimized to pass Chunk direct ByteBuffers.
/**
* The byte buffer we used for preparing a chunk of the message.
* Currently this buffer is obtained from the connection.
@@ -408,10 +402,6 @@ public class MsgStreamer extends OutputStream implements
return;
}
int len = bb.remaining();
- // TODO OFFHEAP: if len > remainingSpace and isOverflowMode() then
- // (and the overflow HDOS has doNotCopy set?) it is probably better to not copy part of
- // bb to this.buffer and then add the remainder of it to the HDOS. Instead
- // we can just add the whole bb to the HDOS.
while (len > 0) {
int remainingSpace = this.buffer.capacity() - this.buffer.position();
if (remainingSpace == 0) {
@@ -938,7 +928,6 @@ public class MsgStreamer extends OutputStream implements
* will all fit into our current buffer.
*/
public final void writeAsSerializedByteArray(Object v) throws IOException {
- // TODO OFFHEAP: update this class to take into account the "noCopy" mode added to HDOS and that we might be adding direct ByteBuffers to this.
if (v instanceof HeapDataOutputStream) {
HeapDataOutputStream other = (HeapDataOutputStream)v;
InternalDataSerializer.writeArrayLength(other.size(), this);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/44f403d9/geode-core/src/main/java/com/gemstone/gemfire/pdx/internal/PdxReaderImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/pdx/internal/PdxReaderImpl.java b/geode-core/src/main/java/com/gemstone/gemfire/pdx/internal/PdxReaderImpl.java
index f4b133c..6771117 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/pdx/internal/PdxReaderImpl.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/pdx/internal/PdxReaderImpl.java
@@ -889,9 +889,6 @@ public class PdxReaderImpl implements InternalPdxReader, java.io.Serializable {
bytes = buffer.array();
}
else{
- // TODO OFFHEAP: this is going to break once we have a ByteSource that is offheap.
- // Should we just copy the offheap ByteSource to a heap byte[] here or change
- // PdxString to work with a ByteSource?
throw new IllegalStateException();
}
int offset = getPositionForField(ft) + buffer.arrayOffset();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/44f403d9/geode-core/src/test/java/com/gemstone/gemfire/cache/operations/internal/GetOperationContextImplJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/operations/internal/GetOperationContextImplJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/operations/internal/GetOperationContextImplJUnitTest.java
index 8efec6e..00aa506 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/operations/internal/GetOperationContextImplJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/operations/internal/GetOperationContextImplJUnitTest.java
@@ -287,5 +287,4 @@ public class GetOperationContextImplJUnitTest {
}
}
}
- // @TODO OFFHEAP: add coverage of "release" and the gettors methods with StoreObject and off-heap Chunk values
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/44f403d9/geode-cq/src/main/java/com/gemstone/gemfire/cache/query/internal/cq/CqServiceImpl.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/main/java/com/gemstone/gemfire/cache/query/internal/cq/CqServiceImpl.java b/geode-cq/src/main/java/com/gemstone/gemfire/cache/query/internal/cq/CqServiceImpl.java
index 05e062c..9188e56 100644
--- a/geode-cq/src/main/java/com/gemstone/gemfire/cache/query/internal/cq/CqServiceImpl.java
+++ b/geode-cq/src/main/java/com/gemstone/gemfire/cache/query/internal/cq/CqServiceImpl.java
@@ -1398,7 +1398,7 @@ public final class CqServiceImpl implements CqService {
// Get new value. If its not retrieved.
if (cqUnfilteredEventsSet_newValue.isEmpty() && (event.getOperation().isCreate() || event.getOperation().isUpdate())) {
- Object newValue = entryEvent.getNewValue(); // TODO OFFHEAP: optimize by not copying the value on to the heap
+ Object newValue = entryEvent.getNewValue();
if (newValue != null) {
//We have a new value to run the query on
cqUnfilteredEventsSet_newValue.add(newValue);