Zrips / CMI

117 stars 99 forks source link

CMI doesn't create MySQL/MariaDB tables. #5876

Open Terminal-Access opened 3 years ago

Terminal-Access commented 3 years ago

Update: Cause of this issue CMI Side.

Please see reply below: https://github.com/Zrips/CMI/issues/5876#issuecomment-882057508

Origional Report

Information below is relative to the folowing versions and server environment:

Minecraft Version:       1.17.1
Server Jar:              paper-1.17.1-103
CMI Version:             9.0.1.2 back to 9.0.0.8 are affeted.
CMI-Lib Version:         1.0.2.12
Database Engine:         MariaDB 5.5.5-10.4.20

Note: This could be due to the fact MariaDB is being used over MySQL.

CMI doesn't create the users table.

I have tested wiping the configure out completely, doing a run, letting it generate, then filling in the DB config file and running again, this is a consistant error for me.

[18:53:37 WARN]: java.sql.SQLSyntaxErrorException: Table 'wpdev.cmi_users' doesn't exist
[18:53:37 WARN]:        at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120)
[18:53:37 WARN]:        at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
[18:53:37 WARN]:        at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:953)
[18:53:37 WARN]:        at com.mysql.cj.jdbc.ClientPreparedStatement.executeQuery(ClientPreparedStatement.java:1003)
[18:53:37 WARN]:        at com.Zrips.CMI.Modules.DataBase.DBDAO.loadAllUsers(DBDAO.java:1207)
[18:53:37 WARN]:        at com.Zrips.CMI.PlayerManager.loadData(PlayerManager.java:585)
[18:53:37 WARN]:        at com.Zrips.CMI.CMI.onEnable(CMI.java:1486)
[18:53:37 WARN]:        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263)
[18:53:37 WARN]:        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370)
[18:53:37 WARN]:        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:500)
[18:53:37 WARN]:        at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugin(CraftServer.java:518)
[18:53:37 WARN]:        at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugins(CraftServer.java:432)
[18:53:37 WARN]:        at net.minecraft.server.MinecraftServer.loadWorld(MinecraftServer.java:639)
[18:53:37 WARN]:        at net.minecraft.server.dedicated.DedicatedServer.init(DedicatedServer.java:306)
[18:53:37 WARN]:        at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1126)
[18:53:37 WARN]:        at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:316)
[18:53:37 WARN]:        at java.base/java.lang.Thread.run(Thread.java:831)
[18:53:37 WARN]: java.sql.SQLSyntaxErrorException: Table 'wpdev.cmi_playtime' doesn't exist
[18:53:37 WARN]:        at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120)
[18:53:37 WARN]:        at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
[18:53:37 WARN]:        at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:953)
[18:53:37 WARN]:        at com.mysql.cj.jdbc.ClientPreparedStatement.executeQuery(ClientPreparedStatement.java:1003)
[18:53:37 WARN]:        at com.Zrips.CMI.Modules.DataBase.DBDAO.loadPlayTimes(DBDAO.java:1231)
[18:53:37 WARN]:        at com.Zrips.CMI.PlayerManager.loadData(PlayerManager.java:608)
[18:53:37 WARN]:        at com.Zrips.CMI.CMI.onEnable(CMI.java:1486)
[18:53:37 WARN]:        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263)
[18:53:37 WARN]:        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370)
[18:53:37 WARN]:        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:500)
[18:53:37 WARN]:        at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugin(CraftServer.java:518)
[18:53:37 WARN]:        at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugins(CraftServer.java:432)
[18:53:37 WARN]:        at net.minecraft.server.MinecraftServer.loadWorld(MinecraftServer.java:639)
[18:53:37 WARN]:        at net.minecraft.server.dedicated.DedicatedServer.init(DedicatedServer.java:306)
[18:53:37 WARN]:        at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1126)
[18:53:37 WARN]:        at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:316)
[18:53:37 WARN]:        at java.base/java.lang.Thread.run(Thread.java:831)
[18:53:37 WARN]: java.sql.SQLSyntaxErrorException: Table 'wpdev.cmi_playtimereward' doesn't exist
[18:53:37 WARN]:        at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120)
[18:53:37 WARN]:        at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
[18:53:37 WARN]:        at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:953)
[18:53:37 WARN]:        at com.mysql.cj.jdbc.ClientPreparedStatement.executeQuery(ClientPreparedStatement.java:1003)
[18:53:37 WARN]:        at com.Zrips.CMI.Modules.DataBase.DBDAO.loadPlayerPlayTimeRewards(DBDAO.java:1365)
[18:53:37 WARN]:        at com.Zrips.CMI.PlayerManager.loadData(PlayerManager.java:609)
[18:53:37 WARN]:        at com.Zrips.CMI.CMI.onEnable(CMI.java:1486)
[18:53:37 WARN]:        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263)
[18:53:37 WARN]:        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370)
[18:53:37 WARN]:        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:500)
[18:53:37 WARN]:        at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugin(CraftServer.java:518)
[18:53:37 WARN]:        at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugins(CraftServer.java:432)
[18:53:37 WARN]:        at net.minecraft.server.MinecraftServer.loadWorld(MinecraftServer.java:639)
[18:53:37 WARN]:        at net.minecraft.server.dedicated.DedicatedServer.init(DedicatedServer.java:306)
[18:53:37 WARN]:        at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1126)
[18:53:37 WARN]:        at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:316)
[18:53:37 WARN]:        at java.base/java.lang.Thread.run(Thread.java:831)
Terminal-Access commented 3 years ago
Minecraft Version:       1.17.1
Server Jar:              paper-1.17.1-112
CMI Version:             9.0.1.2 back to 9.0.0.8 are affeted.
CMI-Lib Version:         1.0.2.13
Database Engine:         MariaDB 5.5.5-10.4.20

Confirmation Generated a fresh install of PaperMC 1.17.1 build 112, as well as fresh config files for CMI - and sure enough as soon as you switch the database over to use MySQL/MariaDB im getting the errors above. I will copy this over to the PaperMC team so they can also investigate.

Update: This look to be a PaperMC server issue. (tables succesfully create when using a spigot jar)

Terminal-Access commented 3 years ago

Further Update - New Information

I beleive i have found the cause of this issue, at least on CMI's end, but still have no clue why this only happens when running the plugin with PaperMC, I have reported this to them however they simply closed the Issue statign

Not a Paper issue. The plugin doesn't ensure schemas actually exist.

So lets focus on the CMI side.

The Cause The table scheme lookup.

Details/Context If two databases exist, any one database (DB-A) alredy has CMI setup and tables created. and you then attempt to run a second server instance and setup a second dataabse (DB-B)

CMI's Schema lookup will under PaperMC find that the table Schema exists from DB-A and assums this is correct for DB-B so it skips the creation step and attempts to write data to DB-A tables using DB-B credetntials thus erroring when it dosent acctually find tables to write data to on DB-B.

I came to this conclusion by relaising i had another dev server setup that was using CMI under a MySQL/MariaDB setup so after backing up the tables and then wiping them from existance in DB-A i re-ran my setup that connect to DB-B

Resuts post wiping DB-A's CMI tables

[14:21:56] [Server thread/INFO]: [CMI] Enabling CMI v9.0.1.2
[14:21:57] [Server thread/INFO]: ┏━━━┓ ┏━┓┏━┓ ┏━━┓
[14:21:57] [Server thread/INFO]: ┃┏━┓┃ ┃ ┗┛ ┃ ┗┫┣┛
[14:21:57] [Server thread/INFO]: ┃┃ ┗┛ ┃┏┓┏┓┃  ┃┃ 
[14:21:57] [Server thread/INFO]: ┃┃ ┏┓ ┃┃┃┃┃┃  ┃┃ 
[14:21:57] [Server thread/INFO]: ┃┗━┛┃ ┃┃┃┃┃┃ ┏┫┣┓
[14:21:57] [Server thread/INFO]: ┗━━━┛ ┗┛┗┛┗┛ ┗━━┛
[14:21:57] [Server thread/INFO]: _______________________________________________________
[14:21:57] [Server thread/INFO]:   Integrating PaperSpigot async methods
[14:21:57] [Server thread/INFO]:   40 Enabled and 16 Disabled modules
[14:21:57] [Server thread/INFO]:   Initialized Cipher256 AES
[14:21:57] [Server thread/INFO]:   Loaded (56) regular alias into memory. Took 32ms
[14:21:57] [Server thread/INFO]:   Loaded (3) custom text's into memory. Took 2ms
[14:21:57] [Server thread/INFO]:   Detected Java16
[14:21:57] [Server thread/INFO]:   5.5.5-10.4.20-MariaDB data base type detected
[14:21:57] [Server thread/INFO]:   UserTable creating CREATE TABLE `CMI_users` (`id` int NOT NULL AUTO_INCREMENT PRIMARY KEY, `player_uuid` text, `username` text, `nickname` text, `LogOutLocation` text, `DeathLocation` text, `TeleportLocation` text, `teleportToggled` boolean, `Homes` text, `LastLoginTime` bigint, `LastLogoffTime` bigint, `TotalPlayTime` bigint, `tFly` bigint, `tGod` bigint, `Glow` text, `Ips` text, `Cuffed` boolean, `AlertUntil` bigint, `AlertReason` text, `JoinedCounter` boolean, `LockedIps` text, `pTime` bigint, `Kits` text, `Charges` text, `Cooldowns` longtext, `Balance` double, `Notes` text, `Rank` text, `TagSound` boolean, `SignShiftEdit` boolean, `Spy` boolean, `CommandSpy` boolean, `BannedUntil` bigint, `BannedAt` bigint, `BannedBy` text, `BanReason` text, `Ignores` text, `Vanish` text, `Economy` text, `Mail` text, `FlightCharge` double, `UserMeta` text, `Flying` boolean, `Votifier` int, `Jail` text, `JailedUntil` bigint, `FakeAccount` boolean, `PlaytimeOptimized` bigint, `flightChargeEnabled` boolean, `noPayToggled` boolean, `JailReason` text, `Skin` text, `SignSpy` boolean, `Collision` boolean, `NamePrefix` text, `NameSuffix` text, `Warnings` text, `msgToggle` boolean, `NameColor` text, `Muted` text, `ToggleBBCompassOff` boolean, `AFRecharge` text, `DisplayName` text);
[14:21:57] [Server thread/INFO]:   CREATE TABLE `CMI_users` (`id` int NOT NULL AUTO_INCREMENT PRIMARY KEY, `player_uuid` text, `username` text, `nickname` text, `LogOutLocation` text, `DeathLocation` text, `TeleportLocation` text, `teleportToggled` boolean, `Homes` text, `LastLoginTime` bigint, `LastLogoffTime` bigint, `TotalPlayTime` bigint, `tFly` bigint, `tGod` bigint, `Glow` text, `Ips` text, `Cuffed` boolean, `AlertUntil` bigint, `AlertReason` text, `JoinedCounter` boolean, `LockedIps` text, `pTime` bigint, `Kits` text, `Charges` text, `Cooldowns` longtext, `Balance` double, `Notes` text, `Rank` text, `TagSound` boolean, `SignShiftEdit` boolean, `Spy` boolean, `CommandSpy` boolean, `BannedUntil` bigint, `BannedAt` bigint, `BannedBy` text, `BanReason` text, `Ignores` text, `Vanish` text, `Economy` text, `Mail` text, `FlightCharge` double, `UserMeta` text, `Flying` boolean, `Votifier` int, `Jail` text, `JailedUntil` bigint, `FakeAccount` boolean, `PlaytimeOptimized` bigint, `flightChargeEnabled` boolean, `noPayToggled` boolean, `JailReason` text, `Skin` text, `SignSpy` boolean, `Collision` boolean, `NamePrefix` text, `NameSuffix` text, `Warnings` text, `msgToggle` boolean, `NameColor` text, `Muted` text, `ToggleBBCompassOff` boolean, `AFRecharge` text, `DisplayName` text);
[14:21:58] [Server thread/INFO]:   InvTable creating CREATE TABLE `CMI_inventories` (`id` int NOT NULL AUTO_INCREMENT PRIMARY KEY, `player_id` int, `inventories` longtext);
[14:21:58] [Server thread/INFO]:   CREATE TABLE `CMI_inventories` (`id` int NOT NULL AUTO_INCREMENT PRIMARY KEY, `player_id` int, `inventories` longtext);
[14:21:58] [Server thread/INFO]:   PlayTime creating CREATE TABLE `CMI_playtime` (`id` int NOT NULL AUTO_INCREMENT PRIMARY KEY, `player_id` int, `date` int, `h0` bigint, `h1` bigint, `h2` bigint, `h3` bigint, `h4` bigint, `h5` bigint, `h6` bigint, `h7` bigint, `h8` bigint, `h9` bigint, `h10` bigint, `h11` bigint, `h12` bigint, `h13` bigint, `h14` bigint, `h15` bigint, `h16` bigint, `h17` bigint, `h18` bigint, `h19` bigint, `h20` bigint, `h21` bigint, `h22` bigint, `h23` bigint);
[14:21:58] [Server thread/INFO]:   CREATE TABLE `CMI_playtime` (`id` int NOT NULL AUTO_INCREMENT PRIMARY KEY, `player_id` int, `date` int, `h0` bigint, `h1` bigint, `h2` bigint, `h3` bigint, `h4` bigint, `h5` bigint, `h6` bigint, `h7` bigint, `h8` bigint, `h9` bigint, `h10` bigint, `h11` bigint, `h12` bigint, `h13` bigint, `h14` bigint, `h15` bigint, `h16` bigint, `h17` bigint, `h18` bigint, `h19` bigint, `h20` bigint, `h21` bigint, `h22` bigint, `h23` bigint);
[14:21:59] [Server thread/INFO]:   PlayTimeReward creating CREATE TABLE `CMI_playtimereward` (`id` int NOT NULL AUTO_INCREMENT PRIMARY KEY, `player_id` int, `repeatable` text, `onetime` text);
[14:21:59] [Server thread/INFO]:   CREATE TABLE `CMI_playtimereward` (`id` int NOT NULL AUTO_INCREMENT PRIMARY KEY, `player_id` int, `repeatable` text, `onetime` text);
[14:21:59] [Server thread/INFO]:   Started MySQL data base. Took 1703ms
[14:21:59] [Server thread/INFO]:   Vault was not found, you will have limited economy support
[14:21:59] [Server thread/INFO]:   Loaded (5) warning categories into memory. Took 0ms
[14:21:59] [Server thread/INFO]:   Loaded (3) warning commands into memory. Took 0ms
[14:21:59] [Server thread/INFO]:   Loaded (134) custom mob heads into memory. Took 12ms
[14:21:59] [Server thread/INFO]:   Loaded (0) cooldowns into memory. Took 18ms
[14:21:59] [Server thread/INFO]:   Loaded (3) warmups into memory. Took 0ms
[14:21:59] [Server thread/WARN]: Initializing Legacy Material Support. Unless you have legacy plugins and/or data this is a bug!
[14:22:02] [Server thread/INFO]:   Loaded (5) kits into memory. Took 2599ms
[14:22:02] [Server thread/INFO]:   Loaded (7) ranks into memory. Took 7ms
[14:22:02] [Server thread/INFO]:   Loaded (8) playtime rewards into memory. Took 2ms
[14:22:02] [Server thread/INFO]:   Loaded (0) player data into memory. Took 1ms
[14:22:02] [Server thread/INFO]:   Loaded (0) playtime records into memory. Took 1ms
[14:22:02] [Server thread/INFO]:   Loaded (0) playtime reward records into memory. Took 0ms
[14:22:02] [Server thread/INFO]:   Loaded (18) custom alias into memory. Took 4ms
[14:22:02] [Server thread/INFO]:   Loaded (1) interactive commands into memory. Took 1ms
[14:22:02] [Server thread/INFO]:   Registered events. Took 88ms
[14:22:02] [Server thread/INFO]:   Loaded (0) event action commands into memory. Took 3ms
[14:22:02] [Server thread/INFO]:   Updated (EN) language file. Took 81ms
[14:22:02] [Server thread/INFO]:   Loaded (859) worth values into memory. Took 13ms
[14:22:02] [Server thread/INFO]:   Starting world timer.
[14:22:02] [Server thread/INFO]:   Initializing world manager.
[14:22:02] [Server thread/INFO]:   Loaded (5) schedules into memory. Took 5ms
[14:22:02] [Server thread/INFO]:   Loaded GeoLiteCity
[14:22:02] [Server thread/INFO]:   Loaded (0) skin cache entries into memory. Took 1ms
[14:22:02] [Server thread/INFO]:   Version 9.0.1.2 has been enabled
[14:22:02] [Server thread/INFO]: ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾

As we can see from this the tables have now been correct created for DB-A.