Open metdos opened 8 years ago
In principle, there's no guarantee that the SELECT will obtain a snapshot before any of the DELETEs if they are concurrent, even if the command was sent earlier. You could see the same behaviour on PostgreSQL, even though it's unlikely.
The main issue is that a real-time or task-tracker SELECT might see the DELETEs in a different order because we don't have a global transaction manager.
While a re-partition query runs, especially a long one, we still continue to run INSERT/UPDATE/DELETE queries in parallel. Therefore, some tasks see the shards before the INSERT/UPDATE/DELETE queries, and other tasks see the shards after INSERT/UPDATE/DELETE queries.
How to replicate;
Load data:
Set task tracker:
Run a long running query
Run the same query above again, but this time after starting the query, start to delete some rows concurrently.
Finally, observe that the result of the query above changed by the concurrent delete commands which are run after the original select query starts.