Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename MySQL error to use a more generic name #1619

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Eragonfr
Copy link

@Eragonfr Eragonfr commented Oct 29, 2024

Description

The MysqlError and related types can be reused by other SQL based backends. See PR #1520

Testing

Test that everything still works like on master

Issue(s)

Not really an issue but here's the review about splitting this from #1520

@jrconlin
Copy link
Member

jrconlin commented Nov 5, 2024

For additional context:

eragonfr is working on the sqlite backend for syncstorage. One of the refactoring changes she would like to make is to qualify the mysql errors from general SQL errors so that she can introduce sqlite errors. Since hers will be the third storage engine, the refactor makes sense to me.

I'd like to get y'all's opinion as well.

_ => true,
}
}

fn metric_label(&self) -> Option<String> {
Some(
match self.kind {
MysqlErrorKind::DieselQuery(_) => "storage.mysql.error.diesel_query",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These metric changes do not impact our dashboards.

@jrconlin
Copy link
Member

I'll poke the other two to get another review before I land this. (Sorry, things have been a bit chaotic over here.)

@@ -5,17 +5,17 @@ use http::StatusCode;
use syncserver_common::{from_error, impl_fmt_display, ReportableError};
use thiserror::Error;

/// Error specific to any MySQL database backend. These errors are not related to the syncstorage
/// Error specific to any SQL database backend. These errors are not related to the syncstorage
/// or tokenserver application logic; rather, they are lower-level errors arising from diesel.
Copy link
Member

@pjenvey pjenvey Nov 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment still stands, "lower-level errors arising from diesel" and I think suggests a clearer name for this: DieselError, how does that sound?

Copy link
Author

@Eragonfr Eragonfr Nov 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That seems like a good name too. As all errors are from diesel or it's dependencies (r2d2 or diesel_migrations).

But if we use SqlError that means that we could replace diesel with an other ORM.
If someone wants to support a database that's not supported by Diesel. But maybe in that case they'll need to do something similar to the spanner backend.

Idk. If @jrconlin and @taddes prefer DieselError I can change it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly, I'm fine either way, but I do appreciate the concept of having a more generic SqlError for the reason that @Eragonfr notes. I don't really see us replacing diesel any time soon, but the sources of the error being reported are coming from the underlying SQL system. DieselError type should be reserved for errors arising from the diesel system directly (e.g. failure to connect to the data store, or some configuration break).

Copy link
Contributor

@taddes taddes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants