ChangeSkinX

ChangeSkinX

446k Downloads

SQL bad insertion

FixedDev opened this issue ยท 3 comments

commented

try (Connection con = dataSource.getConnection()) {

As known by lots of previous issues, there's a data race when multiple saves are being done. This could be fixed by using INSERT... ON DUPLICATE KEY UPDATE on MySQL and INSERT OR REPLACE INTO in SQLite.

The downside of this is that MySQL and SQLite queries would be different, but that would solve the problem.

commented

Thanks for bringing this up, but the plugin acquires a lock on the data model. Outside of multiple BungeeCords this would be then safe to do.

commented

I guess you used an outdated version where this wasn't case. We had Replace INTO a while ago.

159da4c. However this would always create a new entry, which is not really great way to handle that. The motivation is missing from that commit (Nowadays I would be smarter), but it was that in combination with auto incrementing keys we potentially run out of entries faster for not really having any benefit. It's the same player, so we could use the same row entry.

commented

Closing due inactivity. The only point that it would still matter would be multiple BungeeCords. However I think using Replace INTO is more like a workaround instead of solution to that.