Edit multiple issues token after switching to shadow DB

RESOLVED FIXED in Bugzilla 3.2

Status

()

Bugzilla
Query/Bug List
RESOLVED FIXED
8 years ago
6 years ago

People

(Reporter: Greg Hendricks, Assigned: Greg Hendricks)

Tracking

({regression, selenium})

3.2.2
Bugzilla 3.2
regression, selenium
Bug Flags:
approval +
approval3.2 +
blocking3.2.3 +
testcase +

Details

Attachments

(1 attachment, 2 obsolete attachments)

V3
777 bytes, patch
Max Kanat-Alexander
: review+
Details | Diff | Splinter Review
(Assignee)

Description

8 years ago
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
(Assignee)

Comment 1

8 years ago
Created attachment 360590 [details] [diff] [review]
V1

I have tested this on our installation and it seems to work.
Assignee: query-and-buglist → ghendricks
Attachment #360590 - Flags: review?(mkanat)

Comment 2

8 years ago
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-

Comment 3

8 years ago
But for 3.2, you can just wrap it in switch_to_main_db and switch_to_shadow_db.

Comment 4

8 years ago
(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.
(Assignee)

Comment 5

8 years ago
Created attachment 360601 [details] [diff] [review]
V2
Attachment #360590 - Attachment is obsolete: true
Attachment #360601 - Flags: review?(mkanat)

Comment 6

8 years ago
(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 7

8 years ago
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-
(Assignee)

Comment 8

8 years ago
Created attachment 360732 [details] [diff] [review]
V3

I just copied and pasted without looking closely. Sorry. Fixed now.
Attachment #360601 - Attachment is obsolete: true
Attachment #360732 - Flags: review?(mkanat)

Comment 9

8 years ago
Comment on attachment 360732 [details] [diff] [review]
V3

Looks fine.
Attachment #360732 - Flags: review?(mkanat) → review+

Updated

8 years ago
Flags: approval3.2+
Flags: approval+
(Assignee)

Comment 10

8 years ago
    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
Last Resolved: 8 years ago
Resolution: --- → FIXED

Comment 11

8 years ago
Please also commit it on tip.
(Assignee)

Comment 12

8 years ago
    Checking in buglist.cgi;
    /cvsroot/mozilla/webtools/bugzilla/buglist.cgi,v  <--  buglist.cgi
    new revision: 1.393; previous revision: 1.392

Updated

8 years ago
Duplicate of this bug: 476884

Comment 14

8 years ago
Will be tested by test_bug_editing.t, see qa bug 3098.
Flags: testcase?
Keywords: selenium

Updated

6 years ago
Flags: testcase? → testcase+
You need to log in before you can comment on or make changes to this bug.