Skip to content
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

Database resets when gui is opened #1449

Closed
drazisil opened this issue Jul 8, 2020 · 8 comments
Closed

Database resets when gui is opened #1449

drazisil opened this issue Jul 8, 2020 · 8 comments
Assignees
Labels
Status: Done This issue has been completed or answered. This pull request has been merged. Type: Bug
Milestone

Comments

@drazisil
Copy link

drazisil commented Jul 8, 2020

Description

Describe the bug

I have an issue where when the user logs back in and does /is challanges their database player data record gets reset. It's completely fine as long as they don't relog, and relogging itse;lf doesn't clear it, watched it change in real time.

Steps to reproduce the behavior

1: complete challenges
2: relog
3: do is challenges
4: see that none are complete

Expected behavior

Database should not reset

Screenshots and videos (Optional)

Environment

Output of /bbox version (Mandatory)
[20:06:16] [Render thread/INFO]: [CHAT] Running PAPER 1.16.1.
[20:06:16] [Render thread/INFO]: [CHAT] BentoBox version: 1.14.0
[20:06:16] [Render thread/INFO]: [CHAT] Database: POSTGRESQL
[20:06:16] [Render thread/INFO]: [CHAT] Loaded Game Worlds:
[20:06:16] [Render thread/INFO]: [CHAT] bskyblock_world (BSkyBlock): Overworld, Nether, The End
[20:06:16] [Render thread/INFO]: [CHAT] Loaded Addons:
[20:06:16] [Render thread/INFO]: [CHAT] Biomes 1.7.0 (ENABLED)
[20:06:16] [Render thread/INFO]: [CHAT] BSkyBlock 1.14.0-SNAPSHOT-b665 (ENABLED)
[20:06:16] [Render thread/INFO]: [CHAT] Challenges 0.9.0-SNAPSHOT-b420 (ENABLED)
[20:06:16] [Render thread/INFO]: [CHAT] ControlPanel 1.13.0-SNAPSHOT-b34 (ENABLED)
[20:06:16] [Render thread/INFO]: [CHAT] DimensionalTrees 1.6.1-SNAPSHOT-b81 (ENABLED)
[20:06:16] [Render thread/INFO]: [CHAT] Greenhouses 1.0.0 (ENABLED)
[20:06:16] [Render thread/INFO]: [CHAT] Level 2.0.0 (ENABLED)
[20:06:16] [Render thread/INFO]: [CHAT] MagicCobblestoneGenerator 1.7.0.2 (ENABLED)
[20:06:16] [Render thread/INFO]: [CHAT] MagicSummon 1.5.0.0 (ENABLED)
[20:06:16] [Render thread/INFO]: [CHAT] TwerkingForTrees 1.4.1 (ENABLED)
[20:06:16] [Render thread/INFO]: [CHAT] Warps 1.9.7 (ENABLED)

Plugins (Optional)

[20:07:04] [Render thread/INFO]: [CHAT] Plugins (40): AdvancedTeleport, ArmorStandEditor, AsyncWorldEdit, AsyncWorldEditBossBar, AutoRestart, BanManager, BentoBox, BlocksHub, ChestCleaner, Crosstalk, DiscordSRV, Elevators, Flight, Graves, Harbor, HeadDatabase, HeadsPlus, LogBlock, LuckPerms, LWC, MailIt, MessageAnnouncer, ModReq, MultitoolPlus, Multiverse-Core, Multiverse-NetherPortals, Multiverse-Portals, Nicky, PlaceholderAPI, PlayerControlPlus, ProtocolLib, Sickle, StaffFacilities, TAB, Vault, VentureChat, VoxelSniper, WG-GUI, WorldEdit, WorldGuard

Additional context (Optional)

@BONNe
Copy link
Member

BONNe commented Jul 8, 2020

Hmm, are there any errors in log file when it happens?

Oh, it is POSTGRESQL database... hmm...

Does it happen when relogging is fast? or even after some minutes, it is still cleared?

BONNe referenced this issue in BentoBoxWorld/Challenges Jul 8, 2020
It is done due #246 reported that relog could be done faster than async saving.
@drazisil
Copy link
Author

drazisil commented Jul 8, 2020

No errors. It also does not happen on the relog, the database is fine then. It happens on the first gui load after relog. Amount of time doesn't matter. It will still do it after hours, and across server restarts.

@BONNe
Copy link
Member

BONNe commented Jul 9, 2020

I still cannot reproduce the issue.
Interesting.

However, I do not have a POSTGRESQL database.

Update... I setup POSTGRESQL and still cannot reproduce the issue.

@drazisil
Copy link
Author

drazisil commented Jul 9, 2020

@BONNe
Copy link
Member

BONNe commented Jul 9, 2020

Update...
Can reproduce...

:D Sorry...
@tastybento POSTGRESQL does not work with Database#objectExists() method. It returns false while the object clearly is inside the database.

@BONNe
Copy link
Member

BONNe commented Jul 9, 2020

This is a major bug in BentoBox with POSTGRESQL database.
@Poslovitch and @tastybento

@BONNe
Copy link
Member

BONNe commented Jul 9, 2020

Query that SQL Handler creates for checking if object exists:

SELECT EXISTS(SELECT * FROM "ChallengesPlayerData" WHERE uniqueid = '"c37dedcf-b3c8-4e5e-a577-fd8110c497cc"')

By looks of it, the issue is with extra " or '

Update

It must be only '. " is extra information that breaks the search via query.

Using MySQL I ended up with a request:

SELECT IF ( EXISTS( SELECT * FROM `ChallengesPlayerData` WHERE `uniqueId` = '"c37dedcf-b3c8-4e5e-a577-fd8110c497cc"'), 1, 0)

So it looks like that POSTGRESQL does not like extra "

@tastybento tastybento transferred this issue from BentoBoxWorld/Challenges Jul 11, 2020
@tastybento tastybento added Type: Bug Status: In progress Working on the issue. Status: Under investigation Investigating the interest and the feasability of the issue. and removed Status: In progress Working on the issue. Status: Under investigation Investigating the interest and the feasability of the issue. labels Jul 11, 2020
tastybento added a commit that referenced this issue Jul 11, 2020
Refactor code around using quotes for uniqueId's. It's required for
MYSQL but not for SQLITE or POSTGRESQL.

#1449
@tastybento tastybento added Status: Done This issue has been completed or answered. This pull request has been merged. and removed Status: In progress Working on the issue. labels Jul 11, 2020
@tastybento
Copy link
Member

LoadObject and DeleteObject were also broken.

@Poslovitch Poslovitch added this to the 1.14.1 milestone Jul 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Done This issue has been completed or answered. This pull request has been merged. Type: Bug
Projects
None yet
Development

No branches or pull requests

4 participants