Newbie Spellweaver
- Joined
- Jan 26, 2017
- Messages
- 19
- Reaction score
- 2
Hi ragezer, i create this topic to discuss about to find another ways to saving character data in odinms's server.
As almost everyone here already know, all the public source based on odinms currently still using a function called saveToDB() in MapleCharacter.java to save the character's data after player logout. This function work as well as DELETE all old records in database, after that rewrite/ INSERT new data into database. Yes, it still work good...but it have an disadvantage.
Assume that your server have 1000 characters created, and each character have average ~200 items in inventory equal with 1000*200 = 200,000 record in database, each record/item have an id at column/field (inventoryitemid), so assume that each player login and logout atleast 1 time, so 200,000 record will be deleted out of your database, and 200,000 new records will be inserted. The column/field 'inventoryitemid' with auto increasement property will generate a new id for each new record inserted, so 200,000 old id will no longer be used. This will cause the id column will increase very fast and number become bigger cause some issue for your database and server like:
- Out of rage of data type.
- Cannot use the field `id` because of value always change.
- Data Roll-back if your saveToDB() have a bug or server corrupted. (you are on DELETE query and the server corrupted, the INSERT command will never be run, all character data gone).
I have try to find another ways to save the character's data to database, like replace DELETE/INSERT query with UPDATE/INSERT query, but it still not seem optimzed, cause it still have a pre-check what item "is new for INSERT", "is modified for UPDATE" and "is removed for DELETE"
Anyone have an new idea to change the traditional character save???
As almost everyone here already know, all the public source based on odinms currently still using a function called saveToDB() in MapleCharacter.java to save the character's data after player logout. This function work as well as DELETE all old records in database, after that rewrite/ INSERT new data into database. Yes, it still work good...but it have an disadvantage.
Assume that your server have 1000 characters created, and each character have average ~200 items in inventory equal with 1000*200 = 200,000 record in database, each record/item have an id at column/field (inventoryitemid), so assume that each player login and logout atleast 1 time, so 200,000 record will be deleted out of your database, and 200,000 new records will be inserted. The column/field 'inventoryitemid' with auto increasement property will generate a new id for each new record inserted, so 200,000 old id will no longer be used. This will cause the id column will increase very fast and number become bigger cause some issue for your database and server like:
- Out of rage of data type.
- Cannot use the field `id` because of value always change.
- Data Roll-back if your saveToDB() have a bug or server corrupted. (you are on DELETE query and the server corrupted, the INSERT command will never be run, all character data gone).
I have try to find another ways to save the character's data to database, like replace DELETE/INSERT query with UPDATE/INSERT query, but it still not seem optimzed, cause it still have a pre-check what item "is new for INSERT", "is modified for UPDATE" and "is removed for DELETE"
Anyone have an new idea to change the traditional character save???
Last edited: