sopel icon indicating copy to clipboard operation
sopel copied to clipboard

Handle DB failures better

Open RhinosF1 opened this issue 2 years ago • 4 comments

Description

Sopel should be able to degrade to handle short database issues better

  • don't throw exceptions when read only. Writes from things like seen could be thrown away or you could store in memory to run when back available
  • Be able to use a replica if the DB is unavailable for some reason.

Reproduction steps

  1. Setup sopel with MariaDB
  2. Blow MariaDB up by putting in RO or shutting it down
  3. See exceptions and issues

Expected behavior

Sopel attempts to do as much as possible

Relevant logs

11:04:56 <MirahezeBotBeta> [2022-06-11 10:04:55,747] sopel.bot            ERROR    - Unexpected error ((MySQLdb._exceptions.OperationalError) (1290, 'The MariaDB server is running with the --read-only option so it cannot execute this statement') [SQL: UPDATE nick_values SET value=%s WHERE nick_values.nick_id = %s AND nick_values.`key` = %s] [parameters: ('1654941895.595715', 579, 'seen_timestamp')] (Background on this error at: https://sqlalche.me/e/14

Notes

No response

Sopel version

master

Installation method

./setup.py install

Python version

3.9.2

Operating system

Debian Bullseye

IRCd

Libera

Relevant plugins

seen

RhinosF1 avatar Jun 11 '22 14:06 RhinosF1

Same thing when the disk fills up and sqlite errors. It sends a huge error message after every single IRC message, spamming the hell out of its channels.

half-duplex avatar Jun 11 '22 15:06 half-duplex

Sopel should degrade more gracefully with the changes in #2338, closing.

SnoopJ avatar Jun 09 '23 03:06 SnoopJ

I was going to unassign Rusty at some point no matter what, since he's generally too busy to work on this stuff these days. But are you sure about closing this, @SnoopJ? The linked PR only addresses seen, not the overall bot.db object. 🤔

dgw avatar Jun 09 '23 03:06 dgw

Hmm, that's a good point, it should stay open after all. Sorry for the noise :grimacing:

SnoopJ avatar Jun 09 '23 03:06 SnoopJ