Closed Bug 124587 Opened 22 years ago Closed 22 years ago

lock the bugs table for writing when inserting a new bug


(Bugzilla :: Creating/Changing Bugs, defect, P1)




Bugzilla 2.16


(Reporter: myk, Assigned: myk)



(1 file, 1 obsolete file)

bbbaetz makes a good point in bug 87006, comment 14.  post_bug.cgi does not lock
the bugs table before inserting a bug.  For installations that use the shadow
database, this could result in misordered (or perhaps even missing) shadow
database records, because SendSQL first inserts the record into the bugs table
and then inserts a record into the shadowlog table that will later create the
bug in the shadow database.  If two bugs are created at the same time, the four
inserts could happen in the wrong order, switching bug numbers or overwriting
one bug with the other (and potentially making everything off by one) in the
shadow database.
As I discussed on IRC, I really hate the shadowdb ;)

A patch for this should only lock if we're using the shadowdb. (I'm not sure if
select or update takes higher priority. a write lock could swap the order round,
leading to other perf problems, although the frequency of INSERT is probably not
enough to be concerned)

Also, we need to be careful. When adding ccs, for example, do you lock the cc
table?. bugzilla's locking is a mess ATM, and cleaning it up is one of my 2.18
Attached patch patch v1: locks the tables (obsolete) — Splinter Review
Comment on attachment 68718 [details] [diff] [review]
patch v1: locks the tables

OK. r=bbaetz. Not that I can test if this reduces the corruption risk, mind
Attachment #68718 - Flags: review+
See my comments on bug 87006...  I think syncshadowdb needs to obtain a lock
before reading stuff from the shadowlog table, too.
dave: possibly, but see my comments in bug 124589. ;)

Are we concerned about that in this late stage? Anyone who already uses the
shadwowdb stuff knows how unreliable it is, and we're already planning to scrap
it anyway.
Keywords: patch, review
Since this is marked critical, moving to 2.16.
Priority: -- → P1
Target Milestone: --- → Bugzilla 2.16
Comment on attachment 80206 [details] [diff] [review]
Myk's patch - no changes except applies to tip

inheriting r=bbaetz from previous patch.
adding r=justdave
Attachment #80206 - Flags: review+
Someone appears to have checked this in.

Closed: 22 years ago
Resolution: --- → FIXED
QA Contact: matty_is_a_geek → default-qa
You need to log in before you can comment on or make changes to this bug.