Write Generation Policy - Multi threaded application

All,

In a multi threaded application, where writes have to be done in parallel, how can you implement “GEN_EQUAL” policy? We cannot use the same WritePolicy object because any other thread can update the “generation” value before the “put” happens for that record.

Another option would be to create a “WritePolicy” object for each record, but this will end up with “n” number of WritePolicy objects for n records.

Any help is appreciated.

Thanks.

In Python, the generation value to check against is specified separately in the meta argument. See here. In Java, it is part of the WritePolicy object. A write-specific WritePolicy can be constructed from a global WritePolicy object and the correct write-specific generation assigned to it. As you point out, in this case, you will need as many WritePolicy objects as concurrent writes. This should not pose any problem. Please let us know if you think there would be or experience any issues.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.