Closed Bug 1093828 Opened 11 years ago Closed 10 years ago

Add a site-wide banner to warn users that the database is read-only

Categories

(Mozilla QA Graveyard :: MozTrap, defect, P2)

Version 2
defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: mbrandt, Assigned: bsilverberg)

Details

(Whiteboard: [data:consultative])

Attachments

(2 files)

In the event the database reverts to a read-only state a site-wide banner should be displayed to warns users of the problem, the message should include who to contact. Example scenario - recently an automated fail over in our data center occurred, the db failed over to a secondary master that defaults to read-only. From outward appearances the site appeared to be online but produced a 500 error when users tried to save test results.
Peter, might I cajole you somehow into looking into fixing this? :-) (For context, came out of a post-mortem, and was identified as being really helpful to both end-users and on-call/sys/DB-admins, alike.)
Flags: needinfo?(peterbe)
(Or, Bob, feel free to grab this and take a look, too!)
Flags: needinfo?(bob.silverberg)
I'm actually not familiar with the read-only mode. Is this a thing and all we need to do is build the banner or does it need the read-only mode functionality too?
Flags: needinfo?(peterbe)
I wouldn't know where to start with this either, but I could try if Peter doesn't have time (and has advice). Is there a way for us to know that the database has been put into read-only mode?
Flags: needinfo?(bob.silverberg)
Priority: -- → P2
cturra or sheeri, can you help with comment 3 / comment 4? Thanks!
Flags: needinfo?(scabral)
Flags: needinfo?(cturra)
you can query for "show variables like 'read_only' " and that will say ON or OFF - so, read_only=ON would be when the db is read only.
Flags: needinfo?(scabral)
Thanks Sheeri. I will give that a try.
Assignee: nobody → bob.silverberg
Peter, I have done most of what is required for this, but I'm not sure if it's suitable for Moztrap. I basically borrowed code from Kitsune, so the styling may need to be changed. Also, I haven't implemented the Javascript to close the dialog because I find the organization and implementation of the JS in Moztrap to be very confusing. I was hoping that you might have some familiarity with it and be able to collaborate with me on this patch to add the required JS.
Attachment #8522291 - Flags: review?(peterbe)
Matt, I have prepared a PR for this that mostly works and have asked Peter for review and some help. I think we may need to wordsmith the message as well. Right now it just says: "There is a temporary problem with the Moztrap database that has put it into a read-only state. You may browse information on the site but no changes will be saved." You mentioned including contact information. If you can provide a preferred paragraph I can change the code to display whatever you think is appropriate.
Flags: needinfo?(mbrandt)
Let's got with: "There is a temporary problem and Moztrap has been placed into a read-only state. You may browse information on the site but changes will not be saved. Please contact us in #moztrap for more information."
Comment on attachment 8522291 [details] [review] Link to Github pull-request: https://github.com/mozilla/moztrap/pull/77 let's use GitHub instead to review the code.
Attachment #8522291 - Flags: review?(peterbe)
Flags: needinfo?(mbrandt)
Flags: needinfo?(cturra)
With the changes now landed on master and pushed to dev, can we work with Sheeri, Peter/Bob, to test that the read-only banner shows up?
Flags: needinfo?(scabral)
Sure, just let me know when. I live in #data if you can't find me elsewhere on IRC. I am in Eastern time today and tomorrow and in Portland next week.
Flags: needinfo?(scabral)
(In reply to Sheeri Cabral [:sheeri] from comment #13) > Sure, just let me know when. I live in #data if you can't find me elsewhere > on IRC. I am in Eastern time today and tomorrow and in Portland next week. Sorry for the delay -- been a hectic few weeks :-( I or someone from my team will find you this week, and try to have this tested before we (all?) take off soon for the holidays!
Summary: Add a site wide banner to warn users that the database is read-only → Add a site-wide banner to warn users that the database is read-only
About testing - Right now, the moztrap DB is on a shared server with many other dbs (one mysql instance, many dbs). Also, "read_only" is a server-wide setting, so if we test by changing "read_only" we will affect others. Another way would be to point moztrap's "write" handlers to the RO VIP, and see what happens. That's what I'd recommend. (Conveniently there's no coordination with the data team needed either!)
camd/peterbe -- if you can find time, can we do this -- comment 15?
Flags: needinfo?(peterbe)
Flags: needinfo?(cdawson)
(In reply to Sheeri Cabral [:sheeri] from comment #15) > About testing - Right now, the moztrap DB is on a shared server with many > other dbs (one mysql instance, many dbs). Also, "read_only" is a server-wide > setting, so if we test by changing "read_only" we will affect others. > > > Another way would be to point moztrap's "write" handlers to the RO VIP, and > see what happens. That's what I'd recommend. (Conveniently there's no > coordination with the data team needed either!) If it's easy to do, let's do it. The dev server gets virtually no traffic.
Flags: needinfo?(peterbe)
Yep, sounds good to me. Sheeri-- would you be up for doing this sometime tomorrow or Friday, maybe? Dev is already running this code.
Flags: needinfo?(cdawson) → needinfo?(scabral)
I should clarify: please ping peter, matt or I on irc to help test it. :)
Oh, we can definitely do this whenever. But this is an app-level thing - changing the app's config file (or wherever it's stored) FROM "db-rw-virtualIP" to "db-ro-virtualIP". I'll see if I can figure out where this is stored so I can help you test it out, but I think this is a webops task usually.
Flags: needinfo?(scabral)
(In reply to Sheeri Cabral [:sheeri] from comment #20) > Oh, we can definitely do this whenever. But this is an app-level thing - > changing the app's config file (or wherever it's stored) FROM > "db-rw-virtualIP" to "db-ro-virtualIP". > > I'll see if I can figure out where this is stored so I can help you test it > out, but I think this is a webops task usually. I can change that easily, moztrap lives in the generic cluster, and the dev config is: genericadm.private.phx1.mozilla.com:/data/genericrhel6-dev/src/moztrap-dev.allizom.org/moz-trap/moztrap/settings/local.py Should I go ahead and make the change now ?
Just read back the comments, so I decided to go ahead and turn dev read-only by pointing it at: - dev-zeus-ro.db.phx1.mozilla.com
We tested it this morning, and the banner DOES show. But, for both sheeri and I, not until we did a shift-reload of the page. We may want to change the implementation so that it adds a suffix to the name like: ``MozTrap-dev - READ ONLY`` Where the read-only is red or something. Hovering tells you why? Just a thought.
fwiw: Sheeri and I decided to leave dev as read-only so it could be iterated on faster. She says we can just ping her in IRC when we want it changed back.
Regarding the caching, it seems to be in the browser only. When I run this: https://gist.github.com/peterbe/7060754a88c8d4aa07e9 it never fails. The banner is always there. If it got caught in Zeus that would not be so predictable. Grr! Why is the browser caching it?!
peterbe says it should be more like wikipedia's fundraiser that shows up on top and doesn't let you close it, but still lets you do work. Specifically for the scenario that if you close it but come back 5 mins later and it doesn't show up, you don't know if things are back to normal or if it's still read-only but it remembers you X'd it out.
Hey Bob-- Would you be up for making this modification?
Flags: needinfo?(bob.silverberg)
camd: I would, but I am on vacation until the new year, if it can wait until then. Leaving the needinfo on as a reminder.
This is a PR to address not permanently dismissing the banner
Flags: needinfo?(bob.silverberg)
Whiteboard: [data:consultative]
I believe the work for this was done and deployed. Can anyone comment on that? Camd? Peterbe?
Flags: needinfo?(peterbe)
Flags: needinfo?(cdawson)
We did land this in master after all. And even though there might be some imperfections I'm sure it's a bunch better than nothing and besides it rarely happens (that mysql goes into read-only mode). Feel free to re-open camd if you think it needs more work.
Status: NEW → RESOLVED
Closed: 10 years ago
Flags: needinfo?(peterbe)
Resolution: --- → FIXED
Agreed, yeah. This was landed. Sorry it was never resolved. Thanks peterbe!
Flags: needinfo?(cdawson)
Product: Mozilla QA → Mozilla QA Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: