[ 
https://issues.apache.org/jira/browse/GEODE-7247?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16938909#comment-16938909
 ] 

Barrett Oglesby commented on GEODE-7247:
----------------------------------------

GEODE-7246 and GEODE-7247 were added to address export issues. They are 
mutually exclusive. If the entry value is no longer deserialized, then export 
won't throw the SerializationException, and no entries will be skipped.


> Export data shouldn't deserialize the value
> -------------------------------------------
>
>                 Key: GEODE-7247
>                 URL: https://issues.apache.org/jira/browse/GEODE-7247
>             Project: Geode
>          Issue Type: Bug
>          Components: snapshot
>            Reporter: Barrett Oglesby
>            Priority: Major
>
> Currently RegionSnapshotService save attempts to deserialize the value before 
> writing it to the snapshot file.
> {noformat}
> org.apache.geode.SerializationException: An IOException was thrown while 
> deserializing
>       at 
> org.apache.geode.internal.cache.EntryEventImpl.deserialize(EntryEventImpl.java:1915)
>       at 
> org.apache.geode.internal.cache.EntryEventImpl.deserialize(EntryEventImpl.java:1904)
>       at 
> org.apache.geode.internal.cache.VMCachedDeserializable.getDeserializedValue(VMCachedDeserializable.java:134)
>       at 
> org.apache.geode.internal.cache.EntrySnapshot.getRawValue(EntrySnapshot.java:113)
>       at 
> org.apache.geode.internal.cache.EntrySnapshot.getRawValue(EntrySnapshot.java:101)
>       at 
> org.apache.geode.internal.cache.EntrySnapshot.getValue(EntrySnapshot.java:130)
>       at 
> org.apache.geode.internal.cache.snapshot.SnapshotPacket$SnapshotRecord.<init>(SnapshotPacket.java:79)
>       at 
> org.apache.geode.internal.cache.snapshot.LocalExporter.export(LocalExporter.java:46)
>       at 
> org.apache.geode.internal.cache.snapshot.RegionSnapshotServiceImpl.exportOnMember(RegionSnapshotServiceImpl.java:322)
>       at 
> org.apache.geode.internal.cache.snapshot.RegionSnapshotServiceImpl.save(RegionSnapshotServiceImpl.java:150)
>       at 
> org.apache.geode.internal.cache.snapshot.RegionSnapshotServiceImpl.save(RegionSnapshotServiceImpl.java:133)
> Caused by: java.io.IOException: Unknown header byte: -3
>       at 
> org.apache.geode.internal.InternalDataSerializer.basicReadObject(InternalDataSerializer.java:2876)
>       at org.apache.geode.DataSerializer.readObject(DataSerializer.java:2961)
>       at 
> org.apache.geode.internal.util.BlobHelper.deserializeBlob(BlobHelper.java:99)
>       at 
> org.apache.geode.internal.cache.EntryEventImpl.deserialize(EntryEventImpl.java:1911)
> {noformat}
> Instead it should just take the serialized bytes and write them to the file.
> The SnapshotRecord constructor calls entry.getValue() which deserializes the 
> value here:
> {noformat}
> public <K, V> SnapshotRecord(LocalRegion region, Entry<K, V> entry) throws 
> IOException {
>   key = BlobHelper.serializeToBlob(entry.getKey());
>   if (entry instanceof NonTXEntry && region != null) {
>     @Released
>     Object v =
>         ((NonTXEntry) 
> entry).getRegionEntry().getValueOffHeapOrDiskWithoutFaultIn(region);
>     try {
>       value = convertToBytes(v);
>     } finally {
>       OffHeapHelper.release(v);
>     }
>   } else {
> ->   value = convertToBytes(entry.getValue());
>   }
> }
> {noformat}
> Code like this gets the CachedDeserializable instead:
> {noformat}
> value = convertToBytes(((EntrySnapshot) 
> entry).getRegionEntry().getValue(null));
> {noformat}
> which when passed to convertToBytes gets the bytes instead:
> {noformat}
> byte[] bytes = ((CachedDeserializable) val).getSerializedValue();
> {noformat}
> Currently, export can fail with serialization exceptions on corrupted 
> records. Not deserializing the value would hide corrupted data and propagate 
> it via import into the new system. Any access will cause the 
> SerializationException.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to