Open ZonkedCompanion opened 5 years ago
That's some good detective work you did there! Is there a way you can make an export of your database so I can import it into my local development environment? I want to investigate what is exactly increasing the values and which values are getting increased.
Also, got on you for working on a Web overview, that's really cool!
I have found quite a major bug with MySQL storage with Statz on spigot 1.14.4.
When attempting to create a web application to browse player stats I realised something is very wrong with the way it is logging.
The following query should return a total for all placed blocks and all broken blocks by simply doing a SUM of the respective columns:
SELECT SUM(statz_blocks_broken.value) AS broken, SUM(statz_blocks_placed.value) AS placed FROM statz_blocks_broken, statz_blocks_placed
My server is fairly small and only been running statz for a couple of months. Immediately I realised something was wrong when the query returned a combined total of over 350 million modified blocks. This cannot be correct.
So... I logged into the server and placed a single cobblestone block and ran the query again. It increased by a couple thousand blocks... Weird, I only placed a single block and no other player is online. I thought perhaps statz had inserted a bunch of cached records when I placed the block which subsequently caused such a dramatic increase in the query result. So I did it again. Restarted the server, ran the query, noted the values, joined the server, placed a single block expecting the query sum total to increment by 1, and ran the query again. The query then increased again by at least 1000 blocks.
I have now done this many times and I cannot get statz to log a single block change correctly. If i log on to the server with nobody online and place 10 blocks I have seen the sum increase by as much as 4000?
So why when I place 1 single block does statz log 1000s to MySQL? Is it just logging that same block many times over due to a loop in the code or something?
Please investigate.
(edit- typo, whoops)