What happen when creating an object on master, and reading it on a slave afterwards?

39 views
Skip to first unread message

Mathias

unread,
Oct 31, 2011, 5:13:14 AM10/31/11
to Octopus - Database sharding for ActiveRecord
Hi,

I just found Octopus, and it sounds great.

But one question: What happen when creating an object on master, and
reading it on a slave afterwards?
For example, redirect after creating a user. Creating means writing to
the master. Redirecting to a show actions means reading to one slave.
Maybe this slave does not have the new user yet...

Is this a problem or is it already solved?

somethingsomething

unread,
Jul 31, 2012, 10:54:09 PM7/31/12
to octopus-ac...@googlegroups.com
This is a timing issue that isn't really solveable, I would say, in octopus itself.  

If your slaves are really that far behind your master, you might need to put in a page that simply says "New User Created" with a "View user option" or something along these lines in order to give your database stack time to catch up.  You might also consider caching data in the session and using it after the redirect.  Or if the slave query fails fall back to the master?  There are several things you could try.  
Reply all
Reply to author
Forward
0 new messages