OK, so, I've tracked down the issue I was having with the replication branch to a difference in behaviour in atomic<> variables on CentOS (osindriz03) vs. other machines...hoping someone has an answer.

Here is the code which is behaving differently depending on the platform:

log_offset is declared as drizzled::atomic<off_t>.

log_offset= 0;
uint64_t length= 42;

off_t cur_offset;

cur_offset= log_offset.fetch_and_add((sizeof(uint64_t) + length));

On ALL other platforms other than CentOS 5, the above code sets log_offset AND cur_offset equal to 50.

On CentOS, it sets log_offset to 50 and cur_offset to 0.

What does this mean? It means that the assignment to cur_offset is happening *before* the call to drizzled::atomic<off_t>::fetch_and_add().

Without resorting back to mutexes, I am uncertain how to solve this particular timing/atomics problem. I'm hoping someone out there has more experience dealing with this.

Cheers,

Jay

p.s. CentOS box is GCC 4.3.3, and my local laptop, which doesn't show the behaviour, is GCC 4.3.2. Not sure if this is related or not...

_______________________________________________
Mailing list: https://launchpad.net/~drizzle-discuss
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~drizzle-discuss
More help   : https://help.launchpad.net/ListHelp

Reply via email to