Forum: VoltDB Architecture

Post: What happens if several transactions return inconsistent results

What happens if several transactions return inconsistent results
gideon caller
Nov 11, 2015
Hi everyone,

I read this wonderful blog post lifecycle-transaction. In one of the last paragraph is says the following: "Since VoltDB did identical work at two sites, both should return the same data. VoltDB is paranoid about data consistency, so it will ensure the data returned from both sites is identical"
My question is what happens if the data returned is inconsistent? does Volt throws an exception or does it try to repair the data? If it tries to repair the data, how does it do so?

That's it,
Thanks :)
jhugg
Nov 11, 2015
Great question with an easy, if unsatisfying answer.

VoltDB will shut down immediately and you'll have to recover from a snapshot and a log. You should probably identify the sources of non-determinism first, though. This is one of the tradeoffs made to achieve strong consistency at very high throughput.

The good news is that this is easy to avoid and is not something we've seen in production in over a year (over hundreds of deployments). A lot has changed over the years as we've made this case easier to avoid as well. Our SQL planner is aware of many sources of non-determinism and can plan accordingly. We fixed a few other bugs along the way.

Today, the primary sources of non-determinism are random numbers and using wall-clock time in procedures. Avoid those (use our APIs for time & randomness), read over any warnings from our compiler, and you should be good to go.

I would suggest you always run your app in a pre-production test environment first though. Just smart to do no matter what.
gideon caller
Nov 12, 2015
Thanks jhugg,

I've looked at the seeded random number generator. Regarding your time API - is it the TimestampType class? If not, could you give a specific class name (i'm just curious to see how to use it)

Also, I've just noticed that you were the one who wrote that blog post. It was very helpful :)
jhugg
Nov 12, 2015
Check out the documentation chapter on designing stored procedures:
https://docs.voltdb.com/UsingVoltDB/DesignProc.php

Section 5.1.2.2 covers your questions directly.

Note that determinism doesn't care about what time *type* you use, just that the source of that time is deterministic. Our TimestampType is just a type that offers microsecond precision.
gideon caller
Nov 15, 2015
Thanks for the link :)