New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed MySQL database backend/Region_Storage.sql files for new installations, converts db automatically for old installations #197
Conversation
@@ -65,7 +65,7 @@ CREATE TABLE IF NOT EXISTS `region_flag` ( | |||
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT , | |||
`region_id` VARCHAR(128) NOT NULL , | |||
`flag` VARCHAR(64) NOT NULL , | |||
`value` VARCHAR(256) NOT NULL , |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This just changes the MySQL table format from a VARCHAR to a BLOB which is basically a byte array as far as Java is concerned.
Fixed region_storage.sql and mysql backend for new installations; old installations being prepped for conversion to new MySQL format. fixed formatting and tabs More work on formatting/indentations more work on indentations and general formatting. I will get this code pulled one way or another... More formatting/indentation work. THIS. WILL. GET. PULLED. Updated "InvalidStreamHeader" exception code, correctly parses doubles from the database now Trying to squash commits. Added an auto-converter for MySQL installations. Attempts to recover flags that may have been irrecoverable on worldguard reload. Recovers ALL previously functional flags. Allows MySQL to contain ALL region flags correctly. Fixed some formatting.
@@ -112,6 +120,59 @@ public MySQLDatabase(ConfigurationManager config, String world, Logger logger) t | |||
} | |||
} | |||
|
|||
private void convertTables() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method is an automatic converter for the MySQL tables. There is no reason whatsoever that previous MySQL installations should be allowed to remain on the old format. It doesn't store many flags on a server reload. This update code will automatically recover more flags than the current worldguard setup will even allow to be parsed on server reload, such as Double and Integer flags.
It can't recover ALL the flags, but it does NOT drop any flags that work under the current mysql setup, and it DOES recover more flags than would be present on a reload.
It leaves the old region_flag table in legacy_flag as a backup.
This is run AUTOMATICALLY if the code detects that the current region_flag table is NOT the new region_flag format.
This looks like a good addition to me. I really overlooked flags when I wrote the original code (I made a very poor assumption that they were all being serialized correctly) |
This should be updated for any fixes it has that are still relevant after @narthollis 's changes |
it'll be updated. have narthollis's updates gone through yet? |
Yes, about 2 minutes ago :) |
coo'. I'll get cracking then. Gotta j0b to focus on as of last friday so it may take a day or two to get stuff fully re-haxx'd |
Doesn't look like this has been updated for 6 months, closing. |
Fixed the MySQL backend to actually store the correct flags in the mysql db.
Most important for anything that wasn't a State flag or a String flag, i.e. feed-max-health, or price, etc etc etc.
Automatically detects if the mySQL region_flags table is in the correct format; if not,it tries to parse as many flags as it can and update the table to the new format.. If it is, it adds any flags as a byte array from an object output stream, i.e. no more issues with the "Couldn't parse flag" etc etc for non-State or -String flags.
Next up: a WorldGuard command to convert the old table format to the new table format. /wg fixtables, etc etc.
Should pull in old flags, parse the data correctly, and add it to the new table format.