Thursday, June 30, 2011

Re: More than one project using the same database



On Thu, Jun 30, 2011 at 4:13 PM, Tom Evans <tevans.uk@googlemail.com> wrote:
On Thu, Jun 30, 2011 at 4:03 PM, Cal Leeming [Simplicity Media Ltd]
<cal.leeming@simplicitymedialtd.co.uk> wrote:
> The advice given to you by Andres is absolutely wrong.
> By doing this, you are opening yourself up to all sorts of race conditions.
> If you absolutely must allow this, you may want to consider implementing an
> object locking server (we have used memcache to do this before), but you'd
> need to handle this within the code logic, and you can open yourself up to
> more issues if it's not done correctly.
> Personally, I would strongly advice against doing this.
> Cal

Woah, thats a bit harsh. I can't see anything wrong with this
approach, provided that both applications use precisely the same model
definitions (preferably by sharing the app between the two projects).

In effect, it is no different from two load balanced backends talking
to the same DB server, which is *well tested*.

I agree the principle is *almost* the same, but the risks are higher, because OP said that the two applications are not the same, and that the external app performs db writes, thus increasing the risk even further.

Andres said, that because the database has transactions, then the OP should be fine. This is a huge overstatement, and could have left OP under the impression that race conditions wouldn't happen. The reason I've jumped on this pretty hard, is simply because of a lack of respect for handling/understanding race conditions by some developers, and because Andres answered an issue which he clearly did not understand properly. (of which the OP accepted that answer as correct). Could have lead to the OP having a very bad day a few days/weeks/months later lol.
 

Cheers

Tom

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment