drsnyder / poky

PostgreSQL key value store
MIT License
13 stars 1 forks source link

Do upsert's individually to prevent deadlock #22

Closed drsnyder closed 11 years ago

drsnyder commented 11 years ago

Doing upserts as a batch was causing deadlocks in production when there were overlapping tuples being upserted in different threads in different orders.

A script to reproduce this can be found here: https://gist.github.com/drsnyder/6466651.

To prevent this, upsert each row individually. Of the many ways we may attempt to solve this individually upserting seemed to me to be the simplest approach.

/cc @loganlinn @frankfarmer

loganlinn commented 11 years ago

lgtm