Closed Bug 476943 Opened 15 years ago Closed 15 years ago

Edit multiple issues token after switching to shadow DB

Categories

(Bugzilla :: Query/Bug List, defect)

3.2.2
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 3.2

People

(Reporter: gregaryh, Assigned: gregaryh)

References

Details

(Keywords: regression, selenium)

Attachments

(1 file, 2 obsolete files)

As part of the fix to Bug 466748 a token is now generated in buglist.cgi. This is done after the switch to the shadow db, meaning that issue_token tries to write the token to the shadow database. If the shadow is in readonly mode (as it should be), this will fail with the following error:

DBD::mysql::db do failed: The MySQL server is running with the --read-only option so it cannot execute this statement [for Statement "INSERT INTO tokens (userid, issuedate, token, tokentype, eventdata)
        VALUES (?, NOW(), ?, ?, ?)"] at Bugzilla/Token.pm line 418
	Bugzilla::Token::_create_token(9, 'session', 'buglist_mass_change') called at Bugzilla/Token.pm line 173
	Bugzilla::Token::issue_session_token('buglist_mass_change') called at /shared/bugzilla/docroot/buglist.cgi line 1252
Attached patch V1 (obsolete) — Splinter Review
I have tested this on our installation and it seems to work.
Assignee: query-and-buglist → ghendricks
Attachment #360590 - Flags: review?(mkanat)
Comment on attachment 360590 [details] [diff] [review]
V1

This then generates the token for all searches, which we definitely don't want to do.

What would probably be ideal would be function like:

  on_main_db {
    issue_session_token
  }

  This can be accomplished by writing a function with a prototype of (&).

Then we can make sure that certain code always runs on the main DB even if we're currently on the shadow DB.

So that's my thought unless you have any other idea. I'm not perfectly happy with it, because it seems like a hacky solution instead of a good architectural solution, but it's the best idea I have.
Attachment #360590 - Flags: review?(mkanat) → review-
But for 3.2, you can just wrap it in switch_to_main_db and switch_to_shadow_db.
(In reply to comment #3)
> But for 3.2, you can just wrap it in switch_to_main_db and switch_to_shadow_db.

I think you should use them even on tip. We don't need anything else.
Attached patch V2 (obsolete) — Splinter Review
Attachment #360590 - Attachment is obsolete: true
Attachment #360601 - Flags: review?(mkanat)
(In reply to comment #0)
> As part of the fix to Bug 466748 a token is now generated in buglist.cgi.

No, this token has been introduced in bug 26257, which affects 3.2.1 and newer only. 3.0.x is not affected.
Depends on: 26257
Flags: blocking3.2.3+
Keywords: regression
OS: Linux → All
Hardware: x86 → All
Target Milestone: --- → Bugzilla 3.2
Comment on attachment 360601 [details] [diff] [review]
V2

You actually don't even need the $dbh = bits. Could I get a new patch without them? (I just don't like relying on checkin fixes for important multi-branch patches like this one.)
Attachment #360601 - Flags: review?(mkanat) → review-
Attached patch V3Splinter Review
I just copied and pasted without looking closely. Sorry. Fixed now.
Attachment #360601 - Attachment is obsolete: true
Attachment #360732 - Flags: review?(mkanat)
Comment on attachment 360732 [details] [diff] [review]
V3

Looks fine.
Attachment #360732 - Flags: review?(mkanat) → review+
Flags: approval3.2+
Flags: approval+
    Checking in buglist.cgi;
    /cvsroot/mozilla/webtools/bugzilla/buglist.cgi,v  <--  buglist.cgi
    new revision: 1.374.2.8; previous revision: 1.374.2.7
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Please also commit it on tip.
    Checking in buglist.cgi;
    /cvsroot/mozilla/webtools/bugzilla/buglist.cgi,v  <--  buglist.cgi
    new revision: 1.393; previous revision: 1.392
Will be tested by test_bug_editing.t, see qa bug 3098.
Flags: testcase?
Keywords: selenium
Flags: testcase? → testcase+
You need to log in before you can comment on or make changes to this bug.