Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   SQLite Rollback (https://forums.graalonline.com/forums/showthread.php?t=85780)

cbk1994 05-27-2009 09:43 PM

SQLite Rollback
 
When I restarted Era's NPC-server last night, the SQLite database seemed to roll back, causing a few problems, and a ton of people to get unjailed who were previously unjailed (it's searching WHERE release_on < timevar2).

Why did this happen, and how can we prevent it?

fowlplay4 05-28-2009 04:46 AM

Hope someone could shed some light on this, because it kinda makes me reconsider using it to store player and item data.

cbk1994 05-28-2009 04:48 AM

Quote:

Originally Posted by fowlplay4 (Post 1494797)
Hope someone could shed some light on this, because it kinda makes me reconsider using it to store player and item data.

Indeed, I was thinking the same thing. We store use SQL to store bank accounts on Era Dev, and this of course has to be completely flawless.

Inverness 05-28-2009 06:23 AM

Are you starting and committing your transactions?

cbk1994 05-28-2009 06:29 AM

Quote:

Originally Posted by Inverness (Post 1494814)
Are you starting and committing your transactions?

I thought that using a requestsql(query, true) would automatically open then close a transaction, no?

I'm not opening any elsewhere.

Pelikano 05-28-2009 11:35 AM

I don't know, but in MYSQL you have to always start and end it

fowlplay4 05-28-2009 05:29 PM

Quote:

Originally Posted by http://www.sqlite.org/lang_transaction.html
No changes can be made to the database except within a transaction. Any command that changes the database (basically, any SQL command other than SELECT) will automatically start a transaction if one is not already in effect. Automatically started transactions are committed when the last query finishes.

Would make believe that it begins, and commits automatically.

Gambet 05-28-2009 05:53 PM

Perhaps it's a problem with the timevar2 value? You should run some debug tests to isolate the problem (set up a similar test database where you track different actions and restart the server and see how that affects your database).

salesman 05-28-2009 08:04 PM

Quote:

Originally Posted by Gambet (Post 1494927)
Perhaps it's a problem with the timevar2 value? You should run some debug tests to isolate the problem (set up a similar test database where you track different actions and restart the server and see how that affects your database).

No, because I have a system dealing with a 10 column table, but after the restart, the database rolled back to when the table only had 9 colums (I added a value) and was causing all kinds of problems. It was definitely a rollback and not just the jail system that experienced the problem.

cbk1994 05-28-2009 11:17 PM

For now I will add a system to automatically back up the SQLite database every hour or so, and have it automatically update the file on server restart, but this definitely needs to be fixed before we can start using it for more important things (bank accounts, for example).

fowlplay4 05-30-2009 10:06 PM

Hope we can get Stefan to shed some light on this situation.

Admins 05-31-2009 12:47 AM

Hmmm normally it should update the database file each time you insert, modify or delete data. We have disabled file locking because only one npcserver is accessing the database file at a time, and also because file-locking is not working with several file systems that we use. But may be that is causing problems with data not written back to the file, only kept in memory or so. Normally that can easily be checked by downloading the file and opening it with some sqlite database editor.

Inverness 05-31-2009 12:59 AM

Quote:

Originally Posted by fowlplay4 (Post 1494921)
Would make believe that it begins, and commits automatically.

Quote:

Originally Posted by cbk1994 (Post 1494815)
I thought that using a requestsql(query, true) would automatically open then close a transaction, no?

I'm not opening any elsewhere.

Maybe you people should learn how SQLite works before you start complaining about it on the forums. :\

http://www.sqlite.org/lang_transaction.html
http://www.sqlite.org/speed.html

I suggest you read those.


All times are GMT +2. The time now is 04:20 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.