CN110879815A - Method, device, equipment and storage medium for upgrading game database server - Google Patents

Method, device, equipment and storage medium for upgrading game database server Download PDF

Info

Publication number
CN110879815A
CN110879815A CN201911174389.0A CN201911174389A CN110879815A CN 110879815 A CN110879815 A CN 110879815A CN 201911174389 A CN201911174389 A CN 201911174389A CN 110879815 A CN110879815 A CN 110879815A
Authority
CN
China
Prior art keywords
data
version number
target data
storage structure
original target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201911174389.0A
Other languages
Chinese (zh)
Inventor
郭小林
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Polytron Technologies Inc
Original Assignee
Shanghai Polytron Technologies Inc
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Polytron Technologies Inc filed Critical Shanghai Polytron Technologies Inc
Priority to CN201911174389.0A priority Critical patent/CN110879815A/en
Publication of CN110879815A publication Critical patent/CN110879815A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • G06F16/2379Updates performed during online database operations; commit processing
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/70Game security or game management aspects
    • A63F13/79Game security or game management aspects involving player-related data, e.g. identities, accounts, preferences or play histories
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • G06F16/2358Change logging, detection, and notification

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Multimedia (AREA)
  • Business, Economics & Management (AREA)
  • Computer Security & Cryptography (AREA)
  • General Business, Economics & Management (AREA)
  • Software Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses an upgrading method, a device, equipment and a storage medium of a game database server. When a user logs in by using an application terminal, under the condition that the current version number of target data corresponding to a target user is different from the version number of original target data, an upgrading function is called to upgrade the version number of the original target data to the current version number and store the target data to a game database in a form of a predetermined defined storage structure. Therefore, by adopting the scheme, the data storage does not depend on the traditional database table mode any more, when the structure of the player data changes, the database table does not need to be modified correspondingly, the service stopping operation is also not needed, and the problem of low user experience caused by overlong service stopping time is avoided.

Description

Method, device, equipment and storage medium for upgrading game database server
Technical Field
The invention relates to the technical field of computers, in particular to an upgrading method, device, equipment and storage medium of a game database server.
Background
After the online network game, more and more data are generated by the network game, the data mainly comprise player data, most of the player data of the network game are stored in a database at present, the player data are stored in the database by taking a database table as an organization unit, and the player data are stored in the database table in a subfield mode. The player data structure is in one-to-one correspondence with the columns in the database Table, so that when the player data structure changes, an Alter Table command needs to be executed to correspondingly modify the structure of the database Table, when the structure of the database Table is modified, a service stopping operation needs to be performed, and when the data volume of a player is large, the time consumed for modifying the structure of the database Table is extremely long, so that the service stopping time is too long, and the experience of a game player is reduced.
Disclosure of Invention
The invention aims to solve the problems that in the prior art, when a player data structure is changed, the structure of a database table needs to be modified, so that the service stopping time is too long, and the experience of a game player is reduced. Therefore, the invention provides an upgrading method, device, equipment and storage medium of a game database server, when the data structure of a player is changed, the structure of a database table does not need to be modified, the problem of overlong service halt time is avoided, and the experience of game players is improved.
In order to solve the above problem, an embodiment of the present invention discloses an upgrading method for data persistence of a game server, including:
defining a storage structure of original target data in a proto protocol file in advance, wherein the storage structure comprises a version number field of the original target data, serializing the original target data into binary data and storing the binary data in a game database in the form of the storage structure;
when a target user logs in from an application terminal, binary data corresponding to the target user is extracted from the game database, and the original target data and the version number field of the original target data contained in the storage structure are analyzed from the binary data based on a Protobuf protocol;
judging whether the version number corresponding to the version number field of the original target data is consistent with the current version number of the target data corresponding to the target user, and judging whether a data structure of the target data is increased or decreased by a new field;
if the version number is not consistent with the current version number and the data structure of the target data increases or decreases the new field, calling an upgrading function to upgrade the version number to the current version number, redefining the storage structure to obtain a new storage structure, and storing the target data corresponding to the current version number to the game database in the form of the new storage structure to upgrade the game database;
and if the version number is consistent with the current version number and the data structure of the target data is not added or reduced by the new field, the game database does not need to be upgraded and the storage structure is kept unchanged.
Further, in some embodiments of the present invention, the serializing the raw object data into binary data and storing the binary data in the form of the storage structure to a game database comprises:
based on a Protobuf protocol, calling a coding function to serialize the original target data to obtain binary data;
compressing the binary data to obtain compressed data;
decompressing the compressed data to obtain a decompressed file;
based on the Protobuf protocol, a decoding function is called to deserialize the decompressed file into binary data of an Erlang data structure, and the Erlang data structure is used as the form of the storage structure and is stored in the game database.
Further, in some embodiments of the invention, the data avatar of the storage structure defined in the proto protocol file includes: user ID, user name, and data version number.
Further, in some embodiments of the present invention, the parsing the original target data and the version number field of the original target data contained in the storage structure from the binary data based on a Protobuf protocol includes:
and calling a decoding function to decode the binary data to obtain the original target data of the Erlang data structure and the version number field of the original target data based on the Protobuf protocol.
Further, in some embodiments of the present invention, each data version number corresponds to an upgrade function, the upgrade function records a data version number and data corresponding to the data version number, and each data is stored in a storage structure of binary data of the Erlang data structure when being stored in the game database.
Further, the embodiment of the invention discloses an upgrading device for data persistence of a game server, comprising:
the first storage module is used for defining a storage structure of original target data in a proto protocol file in advance, wherein the storage structure comprises a version number field of the original target data, serializing the original target data into binary data and storing the binary data into a game database in the form of the storage structure;
the analysis module is used for extracting binary data corresponding to the target user from the game database when the target user logs in from an application terminal, and analyzing the original target data and the version number field of the original target data contained in the storage structure from the binary data based on a Protobuf protocol;
a judging module, configured to judge whether a version number corresponding to a version number field of the original target data is consistent with a current version number of target data corresponding to the target user, and judge whether a data structure of the target data increases or decreases a new field, if the version number is not consistent with the current version number, and the data structure of the target data increases or decreases the new field, enter a calling module, and if the version number is consistent with the current version number, and the data structure of the target data does not increase or decrease the new field, do not need to upgrade the game database and keep the storage structure unchanged;
the calling module is used for calling an upgrading function to upgrade the version number to the current version number, redefining the storage structure to obtain a new storage structure, and storing target data corresponding to the current version number to the game database in the form of the new storage structure to upgrade the game database.
Further, in some embodiments of the present invention, the first storage module comprises:
the serialization unit is used for calling a coding function to serialize the original target data based on a Protobuf protocol to obtain binary data;
the compression unit is used for compressing the binary data to obtain compressed data;
the decompression unit is used for decompressing the compressed data to obtain a decompressed file;
a first calling unit, configured to call a decoding function to deserialize the decompressed file into binary data of an Erlang data structure based on the Protobuf protocol, and store the Erlang data structure in the game database as the storage structure.
Further, in some embodiments of the invention, the parsing module comprises:
and a second calling unit, configured to call a decoding function to decode the binary data based on the Protobuf protocol to obtain the original target data of the Erlang data structure and a version number field of the original target data.
Further, an embodiment of the present invention discloses a computer apparatus, including:
a memory in which an upgrade program is stored;
a processor, which when executing the upgrade program, causes the processor to execute the steps of the upgrade method for data persistence of a game server as described in any one of the above.
Further, an embodiment of the present invention discloses a computer-readable storage medium having an upgrade program stored thereon, which, when executed by one or more processors, causes the one or more processors to perform the steps of the upgrade method for data persistence of a game server as described in any one of the above.
The embodiment of the invention discloses an upgrading method, a device, equipment and a storage medium of a game database server, which have the following beneficial effects:
when the player data is stored in the game database, the player data is not stored in a traditional database table manner, but a storage structure of the player data is defined in a proto protocol file, and then the player data is serialized into binary data and is stored in the game database in the form of the storage structure. When a user logs in by using an application terminal, the version number fields of original target data and original target data in binary data of the pre-stored original data are firstly analyzed, then the version numbers are compared with the current version number of the target data corresponding to the target user, and under the condition that the two version numbers are different, an upgrading function is called to upgrade the version number of the original target data to the current version number and store the target data to a game database in the form of a predetermined defined storage structure. Therefore, by adopting the scheme, the data storage does not depend on the traditional database table mode any more, when the structure of the player data changes, the database table does not need to be modified correspondingly, the service stopping operation is also not needed, and the problem of low user experience caused by overlong service stopping time is avoided.
Additional features and corresponding advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention.
Drawings
Fig. 1(a) is a schematic flowchart of an upgrade method for data persistence of a game server disclosed in embodiment 1 of the present invention;
fig. 1(b) is a schematic flowchart of a specific implementation of S10 in fig. 1(a) disclosed in embodiment 1 of the present invention;
fig. 2 is a schematic structural diagram of an upgrading apparatus for data persistence of a game server disclosed in embodiment 2 of the present invention;
fig. 3 is a schematic structural diagram of a computer device disclosed in embodiment 3 of the present invention.
Detailed Description
The following description of the embodiments of the present invention is provided for illustrative purposes, and other advantages and effects of the present invention will become apparent to those skilled in the art from the present disclosure. While the invention will be described in conjunction with the preferred embodiments, it is not intended that features of the invention be limited to these embodiments. On the contrary, the invention is described in connection with the embodiments for the purpose of covering alternatives or modifications that may be extended based on the claims of the present invention. In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present invention. The invention may be practiced without these particulars. Moreover, some of the specific details have been left out of the description in order to avoid obscuring or obscuring the focus of the present invention. It should be noted that the embodiments and features of the embodiments may be combined with each other without conflict.
It should be noted that in this specification, like reference numerals and letters refer to like items in the following drawings, and thus, once an item is defined in one drawing, it need not be further defined and explained in subsequent drawings.
The technical solutions of the present invention will be described clearly and completely with reference to the accompanying drawings, and it should be understood that the described embodiments are some, but not all embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicate orientations or positional relationships based on the orientations or positional relationships shown in the drawings, and are only for convenience of description and simplicity of description, but do not indicate or imply that the device or element being referred to must have a particular orientation, be constructed and operated in a particular orientation, and thus, should not be construed as limiting the present invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance.
In the description of the present invention, it should be noted that, unless otherwise explicitly specified or limited, the terms "mounted," "connected," and "connected" are to be construed broadly, e.g., as meaning either a fixed connection, a removable connection, or an integral connection; can be mechanically or electrically connected; they may be connected directly or indirectly through intervening media, or they may be interconnected between two elements. The specific meanings of the above terms in the present invention can be understood in specific cases to those skilled in the art.
After the online network game, more and more data are generated by the network game, the data mainly comprise player data, most of the player data of the network game are stored in a database at present, the player data are stored in the database by taking a database table as an organization unit, and the player data are stored in the database table in a subfield mode. The player data structure is in one-to-one correspondence with the columns in the database Table, so that when the player data structure changes, an Alter Table command needs to be executed to correspondingly modify the structure of the database Table, when the structure of the database Table is modified, a service stopping operation needs to be performed, and when the data volume of a player is large, the time consumed for modifying the structure of the database Table is extremely long, so that the service stopping time is too long, and the experience of a game player is reduced.
The problem that in the prior art, when a player data structure changes, the structure of a database table needs to be modified, so that the service stopping time is too long, and the experience of a game player is reduced is solved. The invention provides an upgrading method, device, equipment and storage medium of a game database server, when a data structure of a player is changed, the structure of a database table does not need to be modified, the problem of overlong service halt time is avoided, and the experience of the game player is improved.
In order to make the objects, technical solutions and advantages of the present invention more apparent, embodiments of the present invention will be described in detail with reference to the accompanying drawings.
Example 1
The following describes an upgrade method for data persistence of a game server disclosed in embodiment 1 of the present invention with reference to fig. 1(a) and fig. 1(b), where fig. 1(a) is a schematic flow chart of the upgrade method for data persistence of a game server disclosed in embodiment 1 of the present invention, and fig. 1(b) is a schematic flow chart of a specific implementation of S10 in fig. 1(a) disclosed in embodiment 1 of the present invention.
As shown in fig. 1(a), the upgrade method for data persistence of a game server includes:
s10: defining a storage structure of original target data in a proto protocol file in advance, wherein the storage structure comprises a version number field of the original target data, serializing the original target data into binary data and storing the binary data into a game database in a storage structure form.
Specifically, the proto protocol file may be defined as the following structure:
message pb_user{required uint32 uid=1;
optional string name=2;
optional uint32 version=3[default=1];}
wherein, uid represents the user ID of the game user, name represents the user name of the game user, and version represents the version number of the data structure.
It should be understood that the embodiment of the present invention only provides one structural embodiment of the proto protocol file, but does not mean that the structure of the proto protocol file is limited to the above structure, and the proto protocol file may also include other types of data corresponding to the change of the user data structure, so as to be embodied in other storage structures.
Further, as an alternative embodiment of the present invention, as shown in fig. 1(b), the serializing the original target data in S10 includes:
s110: based on a Protobuf protocol, calling a coding function to serialize original target data to obtain binary data;
specifically, the original target data may be serialized in the following manner:
encode_user(U=#pb_user{})->
code _ pb _ user (U)/serialized into binary according to protobuf protocol
Data;
namely, defining the encode function as the encoding function in the embodiment of the present invention to serialize the original target data.
S111, compressing the binary data to obtain compressed data;
the compression of binary data may be performed in the following manner:
zip _ util zip (Bin)// data compression
S112: decompressing the compressed data to obtain a decompressed file;
decompression of compressed data may be performed in the following manner:
bin1 (zip _ util) unzip (Bin)/data decompression
S113: based on the Protobuf protocol, a decoding function is called to deserialize the decompressed file into binary data of an Erlang data structure, and the Erlang data structure is used as a storage structure and is stored in a game database.
Deserializing the decompressed file may take the following form:
decode_user(Bin)when is_binary(Bin)->
decoder _ pb _ user (Bin1)// according to protobuf protocol, deserialized into Erlang
The data structure, i.e. defining the decode function as the decoding function in the embodiment of the present invention, deserializes the decompressed file.
Further, as an alternative embodiment of the present invention, the data embodiment defined by the storage structure in the proto protocol file includes: user ID, user name, and data version number.
It should be noted that the data embodiment defined in the storage structure may also include other types of data, and the embodiment of the present invention is not limited to the above storage structure.
S11: when a target user logs in from an application terminal, binary data corresponding to the target user is extracted from a game database, and original target data and a version number field of the original target data contained in a storage structure are analyzed from the binary data based on a Protobuf protocol.
Specifically, as an alternative embodiment of the present invention, S11 includes:
based on a Protobuf protocol, a decoding function is called to decode binary data to obtain original target data of an Erlang data structure and a version number field of the original target data.
S12: judging whether the version number corresponding to the version number field of the original target data is consistent with the current version number of the target data corresponding to the target user, and judging whether the data structure of the target data is increased or decreased by a new field; if the version number is not identical to the current version number and the data structure of the target data increases or decreases new fields, S13 is entered, and if the version number is identical to the current version number and the data structure of the target data does not increase or decrease new fields, S14 is entered.
Specifically, the target data corresponding to the target user is data pulled from the server when the target user logs in from the application terminal.
S13: and calling an upgrading function to upgrade the version number to the current version number, redefining the storage structure to obtain a new storage structure, and storing the target data corresponding to the current version number to the game database in the form of the new storage structure to upgrade the game database.
Further, as an optional embodiment of the present invention, each data version number corresponds to an upgrade function, the upgrade function records a data version number and data corresponding to the data version number, and each data is stored in a storage structure of binary data of an Erlang data structure when being stored in the game database.
Suitably, the upgrade function in the embodiment of the present invention may be defined by amend _ Data _ (Data, system.version), where Data represents Data corresponding to a Data version number, and system.version represents a Data version number of the Data.
Specifically, the data upgrading of the game database in the embodiment of the present invention is represented in two aspects:
in a first aspect, protocol level upgrade: when a new field needs to be added to a data structure of a game user (the data structure changes), only the proto protocol file needs to be redefined, so that the storage structure of the data is redefined.
And in the second aspect, the logic content is upgraded, the storage structure of the data defined by the proto protocol file is not changed, the logic content needs to be modified, and the automatic upgrade of the logic content is completed by making a difference between the version number of the data stored in the proto protocol file and the version number of the current server.
For example, it is assumed that the storage structure of the proto protocol file defined by the original target data is three fields of user { ID, name, ver ═ 1}, where ID represents the ID address of the game user, name represents the user name of the game user, and ver represents the data version number of the original target data. When the bag knapsack field is newly added to the user data in the later stage planning, the proto protocol file is changed into a user { id, name, ver ═ 2, bag }, the old player data reads the ver ═ 1 of the original target data from the game database, and the bag field is empty. At the moment, the upgrading of the data of the game user is completed only by upgrading from 1 to 2 through ver and initializing the bag,
s14: the game database does not need to be upgraded and the storage structure is kept unchanged.
In the method for upgrading data persistence of a game server disclosed in embodiment 1 of the present invention, when player data is stored in a game database, the player data is not stored in a traditional database table manner, but a storage structure of the data is defined in a proto protocol file, and then the data is serialized into binary data and stored in the game database in the form of the storage structure. When a user logs in by using an application terminal, the version number fields of original target data and original target data in binary data of the pre-stored original data are firstly analyzed, then the version numbers are compared with the current version number of the target data corresponding to the target user, and under the condition that the two version numbers are different, an upgrading function is called to upgrade the version number of the original target data to the current version number and store the target data to a game database in the form of a predetermined defined storage structure. Therefore, by adopting the scheme, the data storage does not depend on the traditional database table mode any more, when the structure of the player data changes, the database table does not need to be modified correspondingly, the service stopping operation is also not needed, and the problem of low user experience caused by overlong service stopping time is avoided.
Example 2
An upgrade device for data persistence of a game server disclosed in an embodiment of the present invention is described below with reference to fig. 2, and fig. 2 is a schematic structural diagram of an upgrade device for data persistence of a game server disclosed in an embodiment 2 of the present invention.
As shown in fig. 2, the upgrading apparatus for data persistence of the game server includes:
the first storage module 20 is configured to define a storage structure of original target data in a proto protocol file in advance, where the storage structure includes a version number field of the original target data, package the original target data into binary data, and store the binary data in a game database in a form of the storage structure;
the analysis module 21 is configured to extract binary data corresponding to the target user from the game database when the target user logs in from the application terminal, and analyze the original target data and a version number field of the original target data included in the storage structure from the binary data based on a Protobuf protocol;
the judging module 22 is configured to judge whether a version number corresponding to a version number field of the original target data is consistent with a current version number of target data corresponding to a target user, and judge whether a data structure of the target data increases or decreases a new field, if the version number is not consistent with the current version number and the data structure of the target data increases or decreases the new field, the calling module 23 is entered, and if the version number is consistent with the current version number and the data structure of the target data does not increase or decrease the new field, the game database does not need to be upgraded and the storage structure is kept unchanged.
And the calling module 23 is configured to call an upgrade function to upgrade the version number to a current version number, redefine the storage structure to obtain a new storage structure, and store the target data corresponding to the current version number in the game database in the form of the new storage structure to upgrade the game database.
Further, as an alternative embodiment of the present invention, the first storage module 20 includes:
the serialization unit is used for calling a coding function to serialize the original target data based on a Protobuf protocol to obtain binary data;
the compression unit is used for compressing the binary data to obtain compressed data;
the decompression unit is used for decompressing the compressed data to obtain a decompressed file;
the first calling unit is used for calling a decoding function to deserialize the decompressed file into binary data of an Erlang data structure based on a Protobuf protocol, and the Erlang data structure is used as a storage structure and is stored in a game database.
Further, as an alternative embodiment of the present invention, the parsing module 21 includes:
and the second calling unit is used for calling a decoding function to decode the binary data based on a Protobuf protocol to obtain the original target data of the Erlang data structure and the version number field of the original target data.
In the upgrade apparatus for data persistence of a game server disclosed in embodiment 2 of the present invention, when player data is stored in a game database, the player data is not stored in a traditional database table, but a storage structure of the data is defined in a proto protocol file, and then the data is serialized into binary data and stored in the game database in the form of the storage structure. When a user logs in by using an application terminal, the version number fields of original target data and original target data in binary data of the pre-stored original data are firstly analyzed, then the version numbers are compared with the current version number of the target data corresponding to the target user, and under the condition that the two version numbers are different, an upgrading function is called to upgrade the version number of the original target data to the current version number and store the target data to a game database in the form of a predetermined defined storage structure. Therefore, by adopting the scheme, the data storage does not depend on the traditional database table mode any more, when the structure of the player data changes, the database table does not need to be modified correspondingly, the service stopping operation is also not needed, and the problem of low user experience caused by overlong service stopping time is avoided.
Example 3
A computer device disclosed in embodiment 3 of the present invention is described below with reference to fig. 3, and fig. 3 is a schematic structural diagram of a computer device disclosed in embodiment 3 of the present invention.
As shown in fig. 3, the computer device 3 includes:
the memory 30, the memory 30 stores the upgrade program.
A processor 31, which when executing the upgrade program, causes the processor 31 to execute the steps of the upgrade method for data persistence of the game server as mentioned in the above embodiments.
The computer device 3 includes: a power supply 32, at least one wired or wireless network interface 33, at least one data input output interface 34.
The power supply 32 is connected to the memory 30 and the processor 31, respectively, for supplying power. The wired or wireless network interface 33 and the data input/output interface 34 are used for interfacing with external devices for data communication and transmission. The memory 30 may be transient or persistent.
Furthermore, embodiment 3 of the present invention also discloses a computer-readable storage medium, on which an upgrade program is stored, and when the upgrade program is executed by one or more processors, the one or more processors are caused to execute the steps of the upgrade method for data persistence of a game server as mentioned in the above embodiments.
The computer readable storage medium may be a read-only memory, a random access memory, a hard disk, or an optical disk, etc.
In the computer device and the computer-readable storage medium disclosed in embodiment 3 of the present invention, when player data is stored in the game database, the player data is not stored in a conventional database table, but a storage structure of the data is defined in a proto protocol file, and then the data is serialized into binary data and stored in the game database in the form of the storage structure. When a user logs in by using an application terminal, the version number fields of original target data and original target data in binary data of the pre-stored original data are firstly analyzed, then the version numbers are compared with the current version number of the target data corresponding to the target user, and under the condition that the two version numbers are different, an upgrading function is called to upgrade the version number of the original target data to the current version number and store the target data to a game database in the form of a predetermined defined storage structure. Therefore, by adopting the scheme, the data storage does not depend on the traditional database table mode any more, when the structure of the player data changes, the database table does not need to be modified correspondingly, the service stopping operation is also not needed, and the problem of low user experience caused by overlong service stopping time is avoided.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solution of the present invention, and not to limit the same; while the invention has been described in detail and with reference to the foregoing embodiments, it will be understood by those skilled in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.

Claims (10)

1. An upgrading method for data persistence of a game server is characterized by comprising the following steps:
defining a storage structure of original target data in a proto protocol file in advance, wherein the storage structure comprises a version number field of the original target data, serializing the original target data into binary data and storing the binary data in a game database in the form of the storage structure;
when a target user logs in from an application terminal, binary data corresponding to the target user is extracted from the game database, and the original target data and the version number field of the original target data contained in the storage structure are analyzed from the binary data based on a Protobuf protocol;
judging whether the version number corresponding to the version number field of the original target data is consistent with the current version number of the target data corresponding to the target user, and judging whether a data structure of the target data is increased or decreased by a new field;
if the version number is not consistent with the current version number and the data structure of the target data increases or decreases the new field, calling an upgrading function to upgrade the version number to the current version number, redefining the storage structure to obtain a new storage structure, and storing the target data corresponding to the current version number to the game database in the form of the new storage structure to upgrade the game database;
and if the version number is consistent with the current version number and the data structure of the target data is not added or reduced by the new field, the game database does not need to be upgraded and the storage structure is kept unchanged.
2. The method for upgrading data persistence of a game server according to claim 1, wherein the serializing the original target data into binary data and storing to a game database in the form of the storage structure comprises:
based on a Protobuf protocol, calling a coding function to serialize the original target data to obtain binary data;
compressing the binary data to obtain compressed data;
decompressing the compressed data to obtain a decompressed file;
based on the Protobuf protocol, a decoding function is called to deserialize the decompressed file into binary data of an Erlang data structure, and the Erlang data structure is used as the form of the storage structure and is stored in the game database.
3. The method for upgrading data persistence of a game server according to claim 2, wherein the data incarnations of the storage structure defined in the proto protocol file include: user ID, user name, and data version number.
4. The upgrading method for data persistence of a game server according to any one of claims 1 to 3, wherein the parsing the original target data and the version number field of the original target data contained in the storage structure from the binary data based on a Protobuf protocol includes:
and calling a decoding function to decode the binary data to obtain the original target data of the Erlang data structure and the version number field of the original target data based on the Protobuf protocol.
5. The method for upgrading data persistence of a game server according to claim 4, wherein each data version number corresponds to an upgrading function, the upgrading function records a data version number and data corresponding to the data version number, and each data is stored in a storage structure of binary data of the Erlang data structure when being stored in the game database.
6. An upgrade apparatus for data persistence of a game server, the upgrade apparatus comprising:
the first storage module is used for defining a storage structure of original target data in a proto protocol file in advance, wherein the storage structure comprises a version number field of the original target data, serializing the original target data into binary data and storing the binary data into a game database in the form of the storage structure;
the analysis module is used for extracting binary data corresponding to the target user from the game database when the target user logs in from an application terminal, and analyzing the original target data and the version number field of the original target data contained in the storage structure from the binary data based on a Protobuf protocol;
a judging module, configured to judge whether a version number corresponding to a version number field of the original target data is consistent with a current version number of target data corresponding to the target user, and judge whether a data structure of the target data increases or decreases a new field, if the version number is not consistent with the current version number, and the data structure of the target data increases or decreases the new field, enter a calling module, and if the version number is consistent with the current version number, and the data structure of the target data does not increase or decrease the new field, do not need to upgrade the game database and keep the storage structure unchanged;
the calling module is used for calling an upgrading function to upgrade the version number to the current version number, redefining the storage structure to obtain a new storage structure, and storing target data corresponding to the current version number to the game database in the form of the new storage structure to upgrade the game database.
7. The upgrading apparatus of data persistence of a game server according to claim 6, wherein the first storage module includes:
the serialization unit is used for calling a coding function to serialize the original target data based on a Protobuf protocol to obtain binary data;
the compression unit is used for compressing the binary data to obtain compressed data;
the decompression unit is used for decompressing the compressed data to obtain a decompressed file;
a first calling unit, configured to call a decoding function to deserialize the decompressed file into binary data of an Erlang data structure based on the Protobuf protocol, and store the Erlang data structure in the game database as the storage structure.
8. The apparatus for upgrading data persistence of a game server according to claim 6, wherein the parsing module includes:
and a second calling unit, configured to call a decoding function to decode the binary data based on the Protobuf protocol to obtain the original target data of the Erlang data structure and a version number field of the original target data.
9. A computer device, comprising:
a memory in which an upgrade program is stored;
a processor which, when executing the upgrade program, causes the processor to perform the steps of the upgrade method for data persistence of a game server according to any one of claims 1 to 5.
10. A computer-readable storage medium, having an upgrade program stored thereon, which, when executed by one or more processors, causes the one or more processors to perform the steps of the method for data-persisted upgrade of a game server as claimed in any one of claims 1 to 5.
CN201911174389.0A 2019-11-26 2019-11-26 Method, device, equipment and storage medium for upgrading game database server Pending CN110879815A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911174389.0A CN110879815A (en) 2019-11-26 2019-11-26 Method, device, equipment and storage medium for upgrading game database server

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911174389.0A CN110879815A (en) 2019-11-26 2019-11-26 Method, device, equipment and storage medium for upgrading game database server

Publications (1)

Publication Number Publication Date
CN110879815A true CN110879815A (en) 2020-03-13

Family

ID=69729680

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911174389.0A Pending CN110879815A (en) 2019-11-26 2019-11-26 Method, device, equipment and storage medium for upgrading game database server

Country Status (1)

Country Link
CN (1) CN110879815A (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112402983A (en) * 2020-08-03 2021-02-26 上海幻电信息科技有限公司 Game result verification method and system
CN112486546A (en) * 2020-12-18 2021-03-12 上海中通吉网络技术有限公司 SQLITE database upgrading method, device, terminal and system
CN112657193A (en) * 2020-12-24 2021-04-16 北京像素软件科技股份有限公司 Game equipment updating method, game equipment updating device, computer equipment and readable storage medium
CN113746842A (en) * 2021-09-03 2021-12-03 唯品会(广州)软件有限公司 Message sending method based on Protobuf protocol dynamic analysis
CN114564524A (en) * 2022-03-17 2022-05-31 维沃移动通信有限公司 Game data processing method and electronic equipment
CN117032765A (en) * 2023-10-10 2023-11-10 浙江大华技术股份有限公司 Model upgrading method, model upgrading device and computer storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105677805A (en) * 2015-12-31 2016-06-15 北京奇艺世纪科技有限公司 Data storing and reading method and device using protobuf
CN106708539A (en) * 2017-01-25 2017-05-24 腾讯科技(深圳)有限公司 Client updating method and device
CN107665227A (en) * 2017-04-10 2018-02-06 平安科技(深圳)有限公司 A kind of data version control method and versions of data controller
US20180084063A1 (en) * 2016-09-20 2018-03-22 Ciena Corporation Systems and methods for selecting efficient messaging between services
CN109542851A (en) * 2018-11-30 2019-03-29 北京金山云网络技术有限公司 File updating method, apparatus and system
CN109862095A (en) * 2019-01-30 2019-06-07 新华三大数据技术有限公司 Data processing method and device based on Web service

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105677805A (en) * 2015-12-31 2016-06-15 北京奇艺世纪科技有限公司 Data storing and reading method and device using protobuf
US20180084063A1 (en) * 2016-09-20 2018-03-22 Ciena Corporation Systems and methods for selecting efficient messaging between services
CN106708539A (en) * 2017-01-25 2017-05-24 腾讯科技(深圳)有限公司 Client updating method and device
CN107665227A (en) * 2017-04-10 2018-02-06 平安科技(深圳)有限公司 A kind of data version control method and versions of data controller
CN109542851A (en) * 2018-11-30 2019-03-29 北京金山云网络技术有限公司 File updating method, apparatus and system
CN109862095A (en) * 2019-01-30 2019-06-07 新华三大数据技术有限公司 Data processing method and device based on Web service

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112402983A (en) * 2020-08-03 2021-02-26 上海幻电信息科技有限公司 Game result verification method and system
CN112486546A (en) * 2020-12-18 2021-03-12 上海中通吉网络技术有限公司 SQLITE database upgrading method, device, terminal and system
CN112657193A (en) * 2020-12-24 2021-04-16 北京像素软件科技股份有限公司 Game equipment updating method, game equipment updating device, computer equipment and readable storage medium
CN113746842A (en) * 2021-09-03 2021-12-03 唯品会(广州)软件有限公司 Message sending method based on Protobuf protocol dynamic analysis
CN114564524A (en) * 2022-03-17 2022-05-31 维沃移动通信有限公司 Game data processing method and electronic equipment
CN117032765A (en) * 2023-10-10 2023-11-10 浙江大华技术股份有限公司 Model upgrading method, model upgrading device and computer storage medium
CN117032765B (en) * 2023-10-10 2024-01-16 浙江大华技术股份有限公司 Model upgrading method, model upgrading device and computer storage medium

Similar Documents

Publication Publication Date Title
CN110879815A (en) Method, device, equipment and storage medium for upgrading game database server
CN112861057B (en) Page rendering method, device, equipment and storage medium based on applet
CN110569250B (en) Management method and device for analysis library of Internet of things network element
CN112202751B (en) Animation processing method and device, electronic equipment and storage medium
CN112473144A (en) Game resource data processing method and device
CN108121556A (en) EMMC compatibilities upgrade method, intelligent terminal and readable storage medium storing program for executing
CN108600331A (en) Interactive interface rendering method, client, terminal and system
CN106484387A (en) The method that intelligent mobile terminal is used as game paddle and web game device
CN113742014A (en) Interface rendering method and device, electronic equipment and storage medium
CN116088882B (en) Function configuration method, system and medium based on intelligent wearable device
CN101136780A (en) Method, system to obtain user command information, and user command registered device
CN106886435A (en) The loading method and device of widget
CN111447219B (en) Image display method and device, storage medium and computer equipment
CN111061466A (en) Automatic conversion method, system, terminal and medium of behavior control scripting language
CN110851155A (en) Method and device for changing theme colors of set top box interface
CN114265606B (en) Firmware upgrading method, device, equipment and storage medium
CN114675912B (en) Theme skin switching method and device, computer equipment and computer storage medium
CN113064627B (en) Service access data processing method, platform, terminal, equipment and system
CN113568632A (en) Server power firmware updating method and device, computer equipment and storage medium
CN110109698B (en) Keypad configuration method, device, computer equipment and readable storage medium
CN115965227A (en) Workflow data processing method, device, equipment, storage medium and product
CN112433749A (en) Application gray level publishing method and device, server and client
CN108037740A (en) High speed mass production method, terminal device and storage medium
CN104572316A (en) Game program and running platform interaction method and system
CN110175150A (en) Guest-greeting machine personal data based on data compression stores monitoring system

Legal Events

Date Code Title Description
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20200313

RJ01 Rejection of invention patent application after publication