Skip to content

Migrate to pomelo MySQL provider#124

Merged
richardscull merged 6 commits into
version/0.2.0from
feat/migrate-to-pomelo-mysql-provider
Jun 8, 2026
Merged

Migrate to pomelo MySQL provider#124
richardscull merged 6 commits into
version/0.2.0from
feat/migrate-to-pomelo-mysql-provider

Conversation

@richardscull

@richardscull richardscull commented Jun 8, 2026

Copy link
Copy Markdown
Member

We are migrating from Oracle MySql.EntityFrameworkCore provider to Pomelo.EntityFrameworkCore.MySql.

One of the main reasons to do is the performance, since the Pomelo's provider using MySqlConnector which is far more superior to the Oracle's MySQL.Data.

image

I also added EntityFrameworkCore.Locking.MySq package, which is more native way to add DB locking for rows in EF Core, without writing custom raw query. Props to mnbuhl.

MySqlConnector is also more sensitive to any DB connections running in sync, this is why there is multiple code changes with fixing this.

As non related change, we also now check user authorisation before streaming replay data in osu! client endpoint.

Comment thread Sunrise.Shared/Database/Migrations/20250327193326_MigrateToMySQL.cs
@richardscull richardscull marked this pull request as ready for review June 8, 2026 23:08
Comment on lines 90 to +99
public async Task<IActionResult> GetReplay(
[FromQuery(Name = "u")] string username,
[FromQuery(Name = "h")] string passhash,
[FromQuery(Name = "c")] int scoreId, CancellationToken ct = default
)
{
var session = await sessions.TryGetSessionAsync(username, passhash);
if (session == null)
return Ok("error: pass");

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Non related change, but we also put the replay reading under authorization, as was intended.

Comment on lines +331 to 336
.FilterValidScores()
.FilterPassedScoreableScores()
.Where(s => s.UserId == userId && s.BeatmapHash == beatmapHash && s.GameMode == gameMode && s.Id != excludeId)
.AsNoTracking()
.ForUpdate()
.ToListAsync(ct);

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Generates the same SQL from my testing, with only addition to checking user account status.

@richardscull richardscull merged commit fd68eb9 into version/0.2.0 Jun 8, 2026
17 checks passed
@richardscull richardscull deleted the feat/migrate-to-pomelo-mysql-provider branch June 8, 2026 23:10
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.

1 participant