<div class="gmail_quote">On Thu Feb 05 2015 at 9:02:49 AM Robert Collins <<a href="mailto:robertc@robertcollins.net">robertc@robertcollins.net</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 5 February 2015 at 10:24, Joshua Harlow <<a href="mailto:harlowja@outlook.com" target="_blank">harlowja@outlook.com</a>> wrote:<br>
> How interesting,<br>
><br>
> Why are people using galera if it behaves like this? :-/<br>
<br>
Because its actually fairly normal. In fact its an instance of point 7<br>
on <a href="https://wiki.openstack.org/wiki/BasicDesignTenets" target="_blank">https://wiki.openstack.org/<u></u>wiki/BasicDesignTenets</a> - one of our<br>
oldest wiki pages :).<br>
<br>
In more detail, consider what happens in full isolation when you have<br>
the A and B example given, but B starts its transaction before A.<br>
<br>
B BEGIN<br>
A BEGIN<br>
A INSERT foo<br>
A COMMIT<br>
B SELECT foo -> NULL<br></blockquote><div><br></div><div>Note that this still makes sense from each of A and B's individual view of the world.</div><div><br></div><div>If I understood correctly, the big change with Galera that Matthew is highlighting is that read-after-write may not be consistent from the pov of a single thread.</div><div><br></div><div>Not have read-after-write is *really* hard to code to (see for example x86 SMP cache coherency, C++ threading semantics, etc which all provide read-after-write for this reason). This is particularly true when the affected operations are hidden behind an ORM - it isn't clear what might involve a database call and sequencers (or logical clocks, etc) aren't made explicit in the API.</div><div><br></div><div>I strongly suggest just enabling wsrep_casual_reads on all galera sessions, unless you can guarantee that the high-level task is purely read-only, and then moving on to something else ;) If we choose performance over correctness here then we're just signing up for lots of debugging of hard to reproduce race conditions, and the fixes are going to look like what wsrep_casual_reads does anyway.</div><div><br></div><div>(Mind you, exposing sequencers at every API interaction would be awesome, and I look forward to a future framework and toolchain that makes that easy to do correctly)</div><div><br></div><div> - Gus</div></div>