Serialization and deserialization of data members

query
java

#1

Hi All,

We are using 3.7.1 Aerospike Enterprise Edition for caching and getting below explained unexpected behavior.

Requirement : our requirement is to cache a list of child entries[client configuration] against a unique parent entity.

Our approach: Earlier we were inserting all config entries one by one with unique primary key for a particular entity.

For example:

parentEntity 1:
child entity:1_1
child entity:1_2
child entity:1_3
child entity:1_4
child entity:1_5

---------------java pseudocode----------------------------------------------------------------

List<childEntity> pa;
If((pa = aerospikeOperation.query(class,index,entityId)!= null)
{
    return pa; //spring data aerospike;
}

else
{
    childList  = service.getChilds(parentId);db query
}

for(child 1---5 :childList )
{
    client put{childId}
}

return childList;

But the problem we were facing with above approach was if a single entry insertion throws write timeout exception then next time we will get incomplete list [while querying from aerospike] as all above insertions were not atomic.

To Encounter above issue we created a wrapper and then we thought of inserting a complete parentWrapperObject that contains child lis at once.

---------------java pseudocode--------------

ParentWrapper pa
if((pa = aerospikeOperation.query(entityId)!= null)
{
   return pa.getList();
}

else
{
    childList  = service.getChilds(parentId);db query
}

ParentWrapper pa = new ParentWrapper();
pa.setChilds(childList)

client.put{pa}

return childList;

[in above approach we were assuming that it would serialize the whole list in a single bin and this operation would be atomic as the wrapper object insertion would be either successful or not]

But in above approach some child data members are getting changed to null even if the values were there when we were putting those values into Aerospike:

for example:

when inserting.

parent 1:
child 1 [name:"akash",url:"www.akash.com"]        [java string]
child 2 [name:"alok",url:"www.alok.com"]              [java string]

while pulling the data from Aerospike:

parent 1:
child 1 [name:"akash",url:null]        [java string]
child 2 [name:"alok",url:nulll]          [java string]

How is it possible??? and what is the resolution for this issue:

Thanks Akash


#2

Any Update?


#3

Try the same thing with a newer version of Aerospike that is actually supported, anything >= 3.16. See if you can replicate it. If you can’t, move to that version, because you’re likely not going to get a bug fixed on an unsupported version fixed. Your Aerospike CE 3.7.1 is from 30 months ago.

Make sure you’re on a current version of the Java client, and use atomic ListOperation methods where possible, instead of reading the entire list over to the application and manipulating it there, then saving it.