andune / HomeSpawnPlus

Home/Spawn control plugin for Bukkit
GNU General Public License v3.0
13 stars 10 forks source link

Error on new user login #24

Closed SmallSansSerif closed 9 years ago

SmallSansSerif commented 9 years ago

Error on new player login.. See full error at pastebin link below:

http://pastebin.com/Vy1H896M

[17:05:46] [User Authenticator #25/INFO]: UUID of player MinerSquid410 is f649c527-5c9e-460d-bc5c-6e35d3cbc424

[17:05:46] [Server thread/ERROR]: Could not pass event PlayerJoinEvent to HomeSpawnPlus v2.0-beta2-SNAPSHOT-b572 org.bukkit.event.EventException

SmallSansSerif commented 9 years ago

Using the ebeans MySql setup btw..

Caused by: javax.persistence.PersistenceException: ERROR executing DML bindLog[] error[Field 'id' doesn't have a default value]

Caused by: java.sql.SQLException: Field 'id' doesn't have a default value

andune commented 9 years ago

I suspect this is due to differences between MySQL and Sqlite. When I coded the DB upgrade for 2.0, I tried to get around the fact that every previous version I had to detect whether it was MySQL or Sqlite and write and test separate upgrade code for each. I found what I thought was an elegant way to do the upgrade with common code.

Thinking about your error, I suspect this is because MySQL supports AUTO_INCREMENT while Sqlite calls it AUTOINCREMENT, and I'm not sure which one the upgrade code uses (probably neither), whereas the previous SQL schema for Mysql would have had this. As a result, the code that creates new rows is failing. If you are comfortable using SQL, you can fix this by adding AUTO_INCREMENT to the id column of hsp_player. You might also need to set your AUTO_INCREMENT count to your highest player id.

Here's the SQL that will do that for you:

ALTER TABLE hsp_player CHANGE id id integer auto_increment; select count(*) from hsp_player; ALTER TABLE hsp_player AUTO_INCREMENT = <the count number + 1>;

Which I give you because I don't have time to modify and test the SQL update scripts right now, it takes a lot of repeated DB upgrade testing to get all that just right. It is my highest priority bug at the moment so hopefully I will get to it here soon. Thanks for the report.

SmallSansSerif commented 9 years ago

Thanks for the MySql script. While familiar with MySQL, I'm not super comfortable tweaking things. I did run the first part and seemed to work fine but wondering how I would find the highest player id to run the next alter. Thanks in advance.

SmallSansSerif commented 9 years ago

Ah, the first bit returned the count number and then I inserted into the next bit.. like so:

ALTER TABLE hsp_player AUTO_INCREMENT = 143;

Sound correct?

SmallSansSerif commented 9 years ago

screen shot 2014-12-12 at 10 25 33 am

andune commented 9 years ago

Yes looks good. Problem fixed?

SmallSansSerif commented 9 years ago

Have to test with a new user I guess.. So I'll keep an eye on the log.

andune commented 9 years ago

Actually, thinking about it some more, here is the query for the AUTO_INCREMENT you should set:

select max(id) from hsp_player;

And add 1 to whatever number it returns. With the current query/max you have set, you will likely still get an error when the next new player logs in due to duplicate ids.

SmallSansSerif commented 9 years ago

screen shot 2014-12-12 at 10 47 51 am

Like this? set it to 144 now

andune commented 9 years ago

Yes looks good. Let me know what happens when a new player logs in On Dec 12, 2014 7:48 AM, "SmallSansSerif" notifications@github.com wrote:

[image: screen shot 2014-12-12 at 10 47 51 am] https://cloud.githubusercontent.com/assets/4984139/5414361/5875761c-81ec-11e4-86bf-72f3186adc09.png

Like this? set it to 144 now

— Reply to this email directly or view it on GitHub https://github.com/andune/HomeSpawnPlus/issues/24#issuecomment-66790084.

andune commented 9 years ago

Fixed in Jenkins build 573. Closing issue, thanks again for the report.

SmallSansSerif commented 9 years ago

Thanks!