Replies: 14 comments
-
I will copy my reply I gave in discord to here so it don't get lost :)
|
Beta Was this translation helpful? Give feedback.
-
@Kitzunu the GUID field is an auto_increment primary key, it means that when you create an item and you delete it later, the GUID of that item won't be reused again. These "gaps" are a known behaviour of auto_increment fields. That's why GUID + auto_increment shouldn't be used for user-generated content IMHO. |
Beta Was this translation helpful? Give feedback.
-
the process of "filling" the gaps is called realignment but it can break associated data. |
Beta Was this translation helpful? Give feedback.
-
maybe check this and implement it globally for all guid auto increment tables? |
Beta Was this translation helpful? Give feedback.
-
@BarbzYHOOL thank you for your reply :) I think it's a good solution for certain cases, however, a GUID normally is not designed to be re-used for 2 reasons:
It's weird that it's an INT(10) actually, should be a BIGINT or a VARCHAR, dunno if the client can support it or if is there any way to create a conversion from BIGINT <-> in-game GUID |
Beta Was this translation helpful? Give feedback.
-
I have a solution for it, I'll prepare the details and I'll show you them to discuss it together. |
Beta Was this translation helpful? Give feedback.
-
First of all, based on our code: An in-game GUID is universal and used by all kind of entities and, as many of you already know, is an uint64 composed by 3 parts: high, middle and low part. The high part is used to identify the entity type (player,gobject,creature etc.), the mid part is the entry of the entity (used only for gobject), and the low part is the guid that we're currently saving to db, but it's essentially used in-game to globally identify an entity of the same kind. For example, for an item owned by a player:
After some research I've noticed that the client doesn't save anything inside the cache about this GUID. You can check it here: https://wowdev.wiki/WDB It means that the in-game GUID is used essentially to identify an entity between the temporary memory space of the client and of course of the server. But it doesn't mean that must be also the same GUID saved inside the DB. The solution to any kind of overflow would be the usage of a GUID inside the DB that can be bigger that the one used by the server/client (BIG INT, VARCHAR etc.). Generally, an UUID/GUID should be a VARCHAR https://www.guidgenerator.com/ . In fact, all services that manage user-contents use a 128 bit GUID to identify all their resources (photo, users, documents etc.), such as google, facebook, firebase ... This GUID saved inside the db can be easily associated to an uint32 low-guid generated at server runtime that is not needed to be stored anywhere. And if you think about it, it makes sense and could be the blizzlike way to handle it, because of the following reasons:
That's why we can create something like this:
NOTES:
Let me know what you think about it :) |
Beta Was this translation helpful? Give feedback.
-
Thank you for your reply! Very complete and satisfying :) I've asked the same on cmangos forum (and on trinity too but the forum is private) and apparently the common solution is to "manually fix the GUIDs" periodically. @Warlockbugs said that on retail happens the same: cmangos/issues#2169 (comment) However, thinking of external resource such as a web app (I.E. armory), if you cache the item GUIDs to speed up the website, or even worst, save them somewhere. The re-arranging of the db guids could break everything on those external apps. If your solution really works @Yehonal, would be great! |
Beta Was this translation helpful? Give feedback.
-
i didn't get everything but did you suggest to store the guid in varchar??? What about speed? |
Beta Was this translation helpful? Give feedback.
-
in our case BIGINT maybe it's better, but VARCHAR is more common for GUID because generally they are alphanumeric values. However, you can use any kind of field type that is not affected by overflow, because in the end it will be associated to an uint32 value when loaded from the server. |
Beta Was this translation helpful? Give feedback.
-
Speed? What kind of speed? In game you won't see any differences because uint32 will be still used internally. About queries, you can have some drawbacks on:
|
Beta Was this translation helpful? Give feedback.
-
yes, so just change to big int, right? |
Beta Was this translation helpful? Give feedback.
-
Uhm, I deleted the @AlterEvo. Just noticed. I was editing it. Sorry @AlterEvo However, he replied to @BarbzYHOOL saying that we should change the field and implement the previously explained feature inside the server ofc. |
Beta Was this translation helpful? Give feedback.
-
on an almost similar subject, for the account IDs, they are stored in "int unsigned" in mysql, but when the core tries to insert "-1", the function Now let's have a look at https://dev.mysql.com/doc/refman/8.0/en/integer-types.html |
Beta Was this translation helpful? Give feedback.
-
Hello everyone!
First of all, congrats for this great community!
I've followed the developing of mangos based cores for years and I've also collaborated to some private projects during these years. Based on AC wiki, mostly all tables of the char database are using a
GUID INT(10)
, That, as stated here: http://www.bajb.net/2008/10/mysql-int1-or-int10/, can contain4294967295
elements. I always asked to my self: Is it possible for such tables having an overflow of data?There are some discussions on several forums talking about creature guid overflow: https://www.getmangos.eu/forums/topic/1895-efficient-guid-generation/?tab=comments#comment-51131
https://www.ownedcore.com/forums/world-of-warcraft/world-of-warcraft-emulator-servers/wow-emu-questions-requests/431702-creature-guid-overflow.html
However, I'm more afraid about the
item_instance
table instead. Because if you think about it, a single player could potentially create hundreds of thousands of item GUIDs inside that table in a single year of activity, and I'm not talking about the items that they own, but those ones that a player loots and then sells or destroys (creating huge GUID gaps inside the table itself).A realistic case for medium-big international servers: Suppose that you've 2000 players online that are farming, they are looting and destroying 5 items each minute. So in a year:
2000
(average online players) x5
(average items destroyed per player per minute) x525600
(minutes in a year) = it's5 billion
! OVERFLOWYou can play a bit with the numbers but it's still a realistic situation, so,
4 billions
are not enough and your server with 2000 players is going to die after 1-2 years? Isn't it?Am I missing something?
Beta Was this translation helpful? Give feedback.
All reactions