ericgrandt / TotalEconomy

All in one economy plugin for Minecraft.
https://ericgrandt.github.io/TotalEconomy/
31 stars 33 forks source link

Customized jobs.conf + jobsets.conf seems to cause MySQL problems #315

Closed Krater107a closed 5 years ago

Krater107a commented 5 years ago

Sponge Version: spongeforge-1.12.2-2768-7.1.4 Forge Version: FTBserver-1.12.2-14.23.5.2772-universal Total Economy Version: TotalEconomy-1.8.1

Description of issue

The issue occurs when a player is breaking any block; killing any mob; performing any task that is hooked to a job. I am very new to using MySQL so probably some database not configured correctly on my end? When this error occurs numerous times, Minecraft server will hang and ultimately crash.

Console errors

This is just a snippet from the server log where the error occurs. https://gist.github.com/Krater107a/0a79ea2425c74463b79a9869e6645718

Steps to reproduce

Replace the default jobs.conf and jobsets.conf with the customized ones; result is error as described above.

Related Configuration Files

Create a Gist (https://gist.github.com/) for each configuration file related to this issue my customized JOBS.CONF https://gist.github.com/Krater107a/3327a5ee9af6cf0d860e39d49fa13909 my customized JOBSETS.CONF https://gist.github.com/Krater107a/93c7433b5a3ddd7d09a00d973f03cbde my customized TOTALECONOMY.CONF https://gist.github.com/Krater107a/66feba4a831cb5293503577fff31b06b

Thank you for the creation of this handy mod; and for your time & consideration of this matter.

MarkL4YG commented 5 years ago

With the current SQL implementation, this error will appear with every new job added after the first database initialization. The reason for that being the lack of code to update the table schema upon changed configuration files.
There is a rework of the implementation being done which will be much more stable and will be able to handle such changes. However this will take some time as the changes are not trivial and @Erigitic correctly reviews each incremental step.


At the moment you can do either of the following:

Re-create the database

The easier solution is to clear the database, resetting all account information stored and let Totaleconomy initialize the database with the new jobs.
Account data can be exported using tools like PHPMyAdmin and re-imported afterwards.

Alter the table schema manually

By altering the table, the issue can be resolved without dropping any data. This is what TE should be doing was support for altering jobs properly implemented with the current schema. The command you'd need should be something like this:

use <your database>;
ALTER TABLE experience ADD COLUMN `employed` INT(10) NOT NULL DEFAULT 0;
ALTER TABLE levels ADD COLUMN `employed` INT(10) UNSIGNED NOT NULL DEFAULT 1;

Everytime you add new jobs, this will have to be done until the SQL refactor is through.

Krater107a commented 5 years ago

Hello and thank you very much for your reply. "Alter the table schema manually" worked like a charm for my problem. Again, thank you for the solution.