Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

A possible solution is to transform the byte arrays they provided during the marshaling/unmarshalling phase. This will cover both layers, messaging (network) and storage (in-memory + persist).

Transformation

CacheObjects

We need to cover all CacheObjects, most of them has the following structure:

...

Code Block
languagejava
titleCacheObjectAdapter transformation
protected byte[] valueBytesFromValue(CacheObjectValueContext ctx) throws IgniteCheckedException {
    byte[] bytes = ctx.kernalContext().cacheObjects().marshal(ctx, val);

    return CacheObjectsTransformer.transformIfNecessary(bytes, ctx);
}


protected Object valueFromValueBytes(CacheObjectValueContext ctx, ClassLoader ldr) throws IgniteCheckedException {
    byte[] bytes = CacheObjectsTransformer.restoreIfNecessary(valBytes, ctx);

    return ctx.kernalContext().cacheObjects().unmarshal(ctx, bytes, ldr);
}

...

if (valBytes == null)
	valBytes = valueBytesFromValue(ctx);

...

if (val == null) 
    val = valueFromValueBytes(ctx, ldr);

BinaryObject


Risks and Assumptions

Transformation requires additional memory allocation and subsequent GC work.

...