Ban Management

Ban Management

193k Downloads

MySQL Duplicate Entry

t0mmyxbl opened this issue · 8 comments

commented

Server software: Spigot
Server Version: 1.9.4
BanManager Version: 5.8
Online/Offline mode: Online
Bungeecoord online/offline mode (if applicable): Online

We've been running v4 of Ban Manager and it's getting to a point where we need to update and convert the data to v5. I followed the conversion steps and there is an issue where the bans table is showing a duplicate error (i'm guessing due to player name changes) and then cancelling the conversion for that table then continuing to the other tables. This means that currently we are having to re-run the test every time and seeing what player is a duplicate and deleting them from the table. This is pretty lengthy as there are just short of 2000 bans. Primarily i'm wondering if there would be a faster way around this, such as sorting the duplicates in the mySQL database and then deleting them from there. The following is the console output error:

[20:37:19] [Server thread/WARN]: java.sql.SQLException: Unable to run insert stmt on object me.confuser.banmanager.data.PlayerBanData@452573cc: INSERT INTO bm_player_bans (player_id ,reason ,actor_id ,created ,updated ,expires ) VALUES (?,?,?,?,?,?)
[20:37:19] [Server thread/WARN]: at me.confuser.banmanager.internal.ormlite.misc.SqlExceptionUtil.create(SqlExceptionUtil.java:22)
[20:37:19] [Server thread/WARN]: at me.confuser.banmanager.internal.ormlite.stmt.mapped.MappedCreate.insert(MappedCreate.java:135)
[20:37:19] [Server thread/WARN]: at me.confuser.banmanager.internal.ormlite.stmt.StatementExecutor.create(StatementExecutor.java:450)
[20:37:19] [Server thread/WARN]: at me.confuser.banmanager.internal.ormlite.dao.BaseDaoImpl.create(BaseDaoImpl.java:310)
[20:37:19] [Server thread/WARN]: at me.confuser.banmanager.storage.conversion.converters.BanConverter.run(BanConverter.java:55)
[20:37:19] [Server thread/WARN]: at me.confuser.banmanager.storage.conversion.UUIDConvert.executeConverter(UUIDConvert.java:98)
[20:37:19] [Server thread/WARN]: at me.confuser.banmanager.storage.conversion.UUIDConvert.(UUIDConvert.java:28)
[20:37:19] [Server thread/WARN]: at me.confuser.banmanager.BanManager.setupConversion(BanManager.java:196)
[20:37:19] [Server thread/WARN]: at me.confuser.banmanager.BanManager.onEnable(BanManager.java:140)
[20:37:19] [Server thread/WARN]: at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:292)
[20:37:19] [Server thread/WARN]: at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:340)
[20:37:19] [Server thread/WARN]: at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:405)
[20:37:19] [Server thread/WARN]: at org.bukkit.craftbukkit.v1_9_R2.CraftServer.loadPlugin(CraftServer.java:362)
[20:37:19] [Server thread/WARN]: at org.bukkit.craftbukkit.v1_9_R2.CraftServer.enablePlugins(CraftServer.java:322)
[20:37:19] [Server thread/WARN]: at net.minecraft.server.v1_9_R2.MinecraftServer.t(MinecraftServer.java:416)
[20:37:19] [Server thread/WARN]: at net.minecraft.server.v1_9_R2.MinecraftServer.l(MinecraftServer.java:381)
[20:37:19] [Server thread/WARN]: at net.minecraft.server.v1_9_R2.MinecraftServer.a(MinecraftServer.java:336)
[20:37:19] [Server thread/WARN]: at net.minecraft.server.v1_9_R2.DedicatedServer.init(DedicatedServer.java:268)
[20:37:19] [Server thread/WARN]: at net.minecraft.server.v1_9_R2.MinecraftServer.run(MinecraftServer.java:532)
[20:37:19] [Server thread/WARN]: at java.lang.Thread.run(Thread.java:745)
[20:37:19] [Server thread/WARN]: Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry 'D\x8F\xFB\x18\xB5\xDDD5\xA1\x14a-M\x15%\x95' for key 'bm_player_bans_player_idx'

As I said the conversion for this table pretty much just cancels after this point and doesn't finish the conversion for the other players in this table.

commented

Doesn't matter now, i've done what i think is enough

commented

when installing ban manager on a new server now, linking to the same table it produces a similar error still. I just want to know a way that I can find the user that is causing the error so i can remove it manually

commented

using both local and global under the same database. All of the servers are linked to the same place to sync bans and mutes etc across all servers

commented
commented

honestly, i'm not sure, this is just how it was setup when I became a server admin. The table names are definitely all the same.

commented
commented

alright so the error has gone after disabling global

commented

With the new server, are you using the same local or global option? Ensure your schedules.yml file is generated from scratch, or at the very least, set all lastChecked values to 0 on the new server first.