CN111782235A - Data upgrading and querying method and device - Google Patents

Data upgrading and querying method and device Download PDF

Info

Publication number
CN111782235A
CN111782235A CN201910924810.9A CN201910924810A CN111782235A CN 111782235 A CN111782235 A CN 111782235A CN 201910924810 A CN201910924810 A CN 201910924810A CN 111782235 A CN111782235 A CN 111782235A
Authority
CN
China
Prior art keywords
change
data
data structure
structure change
updating
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
CN201910924810.9A
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.)
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
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 Beijing Jingdong Century Trading Co Ltd, Beijing Wodong Tianjun Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN201910924810.9A priority Critical patent/CN111782235A/en
Publication of CN111782235A publication Critical patent/CN111782235A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • 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
    • 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/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management

Abstract

The invention discloses a data upgrading and querying method and device, and relates to the technical field of computers. One embodiment of the method comprises: receiving a change registration request and corresponding change detail information thereof, and generating a data structure change table; receiving a full change request, and executing data structure change on a source table according to the data structure change table; and synchronizing the dynamic structure table to the source table after the data structure change is performed according to the data structure change table and the corresponding dynamic structure table. The embodiment can solve the technical problem of data structure conflict caused by parallel gray-period multi-version programs.

Description

Data upgrading and querying method and device
Technical Field
The invention relates to the technical field of computers, in particular to a data upgrading method and device.
Background
Gray scale distribution (aka gold sparrow distribution) refers to a distribution method that can smoothly transition between black and white. On which a/B testing may be performed, i.e. having a part of users continue to use product property a and a part of users start to use product property B, if the users have no objection to B, the scope is gradually expanded, and all users are migrated to B. The stability of the whole system can be ensured by gray scale release, and problems can be found and adjusted in the initial gray scale so as to ensure the influence degree of the gray scale.
The problem of data structure conflict exists when multiple versions of application programs in the gray scale period run simultaneously, and the data structure conflict is generally processed by adopting a data isolation technology. Data isolation creates different data sources for different versions of an application to resolve conflicts between different versions of data structures. The implementation modes mainly include two types: first, library isolation, i.e., the use of different databases; secondly, the table is isolated, namely different tables are used. Both of these ways are configured to enable routing of different versions of a request to the correct data source to access the data.
Furthermore, before the gray scale is released, the program and data need to be changed after the gray scale period is over, and the whole change or rollback implementation scheme needs to be customized. At present, the process is mostly based on business rules and scene customization schemes, and has strong business pertinence, high coupling, high cost and no mature general solution.
In the process of implementing the invention, the inventor finds that at least the following problems exist in the prior art:
1) the data isolation mode brings extra maintenance cost and has the problem of data synchronization, and is not flexible enough; 2) the change backspacing scheme is customized, each change is independently customized, and the scheme is not universal, so that the efficiency is low.
Disclosure of Invention
In view of this, embodiments of the present invention provide a data upgrading method and apparatus, so as to solve the technical problem of data structure conflict caused by parallel multi-version programs in a gray scale period.
To achieve the above object, according to an aspect of an embodiment of the present invention, there is provided a data upgrade method including:
receiving a change registration request and corresponding change detail information thereof, and generating a data structure change table;
receiving a full change request, and executing data structure change on a source table according to the data structure change table;
and synchronizing the dynamic structure table to the source table after the data structure change is performed according to the data structure change table and the corresponding dynamic structure table.
Optionally, the data structure change table stores a new version name, a source table name, a change field, a change value, a change type and a change state;
the dynamic structure table stores a source table primary key value, a change column name and a change column value.
Optionally, receiving a full change request, and performing a data structure change on a source table according to the data structure change table, including:
receiving a full change request, and updating the change state in the data structure change table into a change structure;
acquiring change information from the data structure change table according to the change type in the data structure change table, and executing data structure change on a source table;
and updating the change state in the data structure change table into data migration.
Optionally, synchronizing the dynamic structure table to the source table after the data structure change is performed according to the data structure change table and the corresponding dynamic structure table thereof, including:
judging whether the change type in the data structure change table is newly increased or modified;
if so, searching a dynamic structure table corresponding to the data structure change table, and synchronizing a change column value into the source table after executing data structure change according to a source table primary key value in the dynamic structure table;
and updating the change state in the data structure change table to be changed and completed.
In addition, according to another aspect of the embodiments of the present invention, there is provided a data query method including:
acquiring a data structure change table corresponding to the version of the application program according to the version environment of the application program;
receiving a data query request sent by the application program, and acquiring first data from a source table and/or acquiring second data from a dynamic structure table according to the data structure change table;
and returning the integrated first data and/or second data to the application program.
Optionally, the method further comprises:
and receiving a data updating request sent by the application program, and updating data in a source table and/or a dynamic structure table according to the change state in the data structure change table.
Optionally, updating data in the source table and/or the dynamic structure table according to the change status in the data structure change table includes:
judging whether the change state in the data structure change table is changed completely;
if yes, updating the updating data carried by the data updating request into a source table;
and if not, updating the updating data carried by the data updating request into a source table and/or a dynamic structure table according to the changing type of the data structure changing table.
In addition, according to another aspect of the embodiments of the present invention, there is provided a data upgrade apparatus including:
the registration module is used for receiving the change registration request and the corresponding change detail information thereof and generating a data structure change table;
the change module is used for receiving a full change request and executing data structure change on the source table according to the data structure change table;
and the synchronization module is used for synchronizing the dynamic structure table to the source table after the data structure is changed according to the data structure change table and the corresponding dynamic structure table.
Optionally, the data structure change table stores a new version name, a source table name, a change field, a change value, a change type and a change state;
the dynamic structure table stores a source table primary key value, a change column name and a change column value.
Optionally, the changing module is further configured to:
receiving a full change request, and updating the change state in the data structure change table into a change structure;
acquiring change information from the data structure change table according to the change type in the data structure change table, and executing data structure change on a source table;
and updating the change state in the data structure change table into data migration.
Optionally, the synchronization module is further configured to:
judging whether the change type in the data structure change table is newly increased or modified;
if so, searching a dynamic structure table corresponding to the data structure change table, and synchronizing a change column value into the source table after executing data structure change according to a source table primary key value in the dynamic structure table;
and updating the change state in the data structure change table to be changed and completed.
In addition, according to another aspect of the embodiments of the present invention, there is provided a data query apparatus including:
the system comprises an acquisition module, a storage module and a processing module, wherein the acquisition module is used for acquiring a data structure change table corresponding to the version of an application program according to the version environment of the application program;
the query module is used for receiving a data query request sent by the application program, acquiring first data from a source table according to the data structure change table, and/or acquiring second data from a dynamic structure table;
and the return module is used for returning the integrated first data and/or second data to the application program.
Optionally, the method further comprises:
and the updating module is used for receiving a data updating request sent by the application program and updating data in the source table and/or the dynamic structure table according to the changing state in the data structure changing table.
Optionally, the update module is further configured to:
judging whether the change state in the data structure change table is changed completely;
if yes, updating the updating data carried by the data updating request into a source table;
and if not, updating the updating data carried by the data updating request into a source table and/or a dynamic structure table according to the changing type of the data structure changing table.
According to another aspect of the embodiments of the present invention, there is also provided an electronic device, including:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any of the embodiments described above.
According to another aspect of the embodiments of the present invention, there is also provided a computer readable medium, on which a computer program is stored, which when executed by a processor implements the method of any of the above embodiments.
One embodiment of the above invention has the following advantages or benefits: because the technical means of executing data structure change to the source table according to the data structure change table and synchronizing the dynamic structure table to the source table according to the data structure change table and the corresponding dynamic structure table is adopted, the technical problem of data structure conflict caused by parallel gray-scale period multi-version programs in the prior art is solved. The embodiment of the invention realizes the smooth upgrade of the data structure and the service data by storing the data of the gray period through the two data tables, can ensure the compatibility of the data structure and the data sharing and intercommunication when a plurality of versions run simultaneously, avoids the problems of data synchronization and consistency caused by sub-database and sub-table, and reduces the complexity of service development, the online cost and the operation and maintenance cost. In addition, the gray scale release does not need to customize a data structure and business data change or rollback scheme for the business, the change of the data structure and the business data can be automatically effective or rolled back through the system, a large amount of research and development time spent on customizing an online/rollback scheme for each data structure change is avoided, and the research and development efficiency can be effectively improved.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
FIG. 1 is a schematic diagram of a main flow of a data upgrade method according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of a main flow of a data upgrade method according to a referential embodiment of the present invention;
FIG. 3 is a schematic diagram of a main flow of a data upgrade method according to another referenceable embodiment of the present invention;
FIG. 4 is a schematic diagram of a main flow of a data upgrade method according to still another referential embodiment of the present invention;
FIG. 5 is a schematic diagram of a main flow of a data query method according to an embodiment of the invention;
FIG. 6 is a diagram showing a main flow of a data query method according to a referential embodiment of the present invention;
FIG. 7 is a diagram showing a main flow of a data query method according to another referential embodiment of the present invention;
FIG. 8 is a schematic diagram of the main modules of a data upgrade apparatus according to an embodiment of the present invention;
FIG. 9 is a schematic diagram of the main modules of a data query device according to an embodiment of the present invention;
FIG. 10 is an exemplary system architecture diagram in which embodiments of the present invention may be employed;
fig. 11 is a schematic structural diagram of a computer system suitable for implementing a terminal device or a server according to an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
The data upgrading method provided by the embodiment of the invention provides temporary storage of the data structure and the service data during the gray scale period through the data structure change table and the dynamic structure table, and updates the changed data structure and the corresponding service data into the source table after the gray scale is finished, thereby realizing smooth upgrading of the data structure and the service data.
Fig. 1 is a schematic diagram of a main flow of a data upgrading method according to an embodiment of the present invention. As an embodiment of the present invention, as shown in fig. 1, the data upgrading method may include:
step 101, receiving a change registration request and its corresponding change detail information, and generating a data structure change table.
And the server receives a change registration request initiated by a research and development personnel and the corresponding change detail information thereof, thereby generating a data structure change table. And before each version is released, a new version name is created, and the change detail information related to the new version is recorded into the system, so that a data structure change table is generated, wherein the data structure change table stores detailed change information and is used for storing the change detail information of a certain version.
Optionally, the data structure change table stores a new version name, a source table name, a change field, a change value, a change type, and a change status. The new version name is the new version name of the application program, the changed field refers to the field to be changed, and the changed value refers to the changed value corresponding to the changed field. For example, if field a in the source table is changed to field B, the changed field is field a and the changed value is field B. For example, if a new field a is needed, the changed field is empty, and the changed value is the field a. For example, if the length of the field a needs to be modified, the modified field is the field a, and the modified value is the field a with the modified length.
The change type can be adding field, modifying field, deleting field, changing field length, type, meaning, etc., and can be expanded according to the need. The change state may be an initial state, a change structure, data migration, change completion, and rollback changes.
After the data structure change table is generated, the change state is set to the initial state, on one hand, the unknown problem caused by misoperation is prevented, and on the other hand, the flow control is facilitated (the change of the initial state is similar to the draft state, and the data change is not effective).
And 102, receiving a full change request, and executing data structure change on the source table according to the data structure change table.
And when the gray period is finished, executing the full change operation of the new version application program. And the server receives a full change request initiated by research personnel and changes the source table font data structure in the database according to the data structure change table. And if the server receives the rollback operation initiated by the research and development personnel, updating the change state in the data structure change table into the rollback change without performing any synchronous operation on the source table.
Optionally, step 102 comprises: receiving a full change request, and updating the change state in the data structure change table into a change structure; acquiring change information from the data structure change table according to the change type in the data structure change table, and executing data structure change on a source table; and updating the change state in the data structure change table into data migration. In the process of changing the data structure, the change state in the data structure change table is continuously updated, so that the unknown problem caused by misoperation is prevented, and the process control is facilitated.
Step 103, synchronizing the dynamic structure table to the source table after the data structure change is executed according to the data structure change table and the corresponding dynamic structure table.
Optionally, the data structure change table and the corresponding dynamic structure table may be stored in a database where the source table is located, so as to facilitate data synchronization and data query. The dynamic structure table is used for storing service data of a change structure, and optionally, the dynamic structure table stores a source table primary key value, a change column name and a change column value. For example, if field a in the source table is changed to field B, the changed column name is field B, and the changed column value is the column value of field B in the dynamic configuration table.
Optionally, step 103 comprises: judging whether the change type in the data structure change table is newly increased or modified; if so, searching a dynamic structure table corresponding to the data structure change table, and synchronizing a change column value into the source table after executing data structure change according to a source table primary key value in the dynamic structure table; and updating the change state in the data structure change table to be changed and completed. If the change type in the data structure change table is newly added or modified, the service data is also changed, so that the service data in the corresponding dynamic structure table needs to be synchronized into the source table; otherwise, it indicates that the service data is not changed, and directly updates the changed state in the data structure change table to changed completion without synchronizing the service data.
According to the various embodiments described above, it can be seen that the technical problem of data structure conflict caused by parallel multi-version programs in the gray scale period in the prior art is solved by the technical means of performing data structure change on the source table according to the data structure change table and synchronizing the dynamic structure table into the source table according to the data structure change table and the corresponding dynamic structure table. The embodiment of the invention stores the data of the gray period through the two data tables, realizes the smooth upgrade of the data structure and the service data, can ensure the compatibility of the data structure and the data sharing and intercommunication when a plurality of versions run simultaneously, avoids the problems of data synchronization and consistency caused by sub-database and sub-table, and reduces the complexity of service development, the online cost and the operation and maintenance cost. In addition, the gray scale release does not need to customize a data structure and business data change or rollback scheme for the business, the change of the data structure and the business data can be automatically effective or rolled back through the system, a large amount of research and development time spent on customizing an online/rollback scheme for each data structure change is avoided, and the research and development efficiency can be effectively improved.
Fig. 2 is a schematic diagram of a main flow of a data upgrade method according to a referential embodiment of the present invention. In this embodiment, the management module mainly provides management functions of registration, change execution, rollback, and the like of the data structure change, and as shown in fig. 2, the data upgrading method may include the following steps:
the research and development personnel submit a change registration request to the management module and submit all change detail information related to the new version, such as the name of the new version, the name of a source table, a change field, a change value, a change type, a change state and the like.
The management module receives a change registration request submitted by a research and development worker and corresponding change detail information thereof, so as to generate a data structure change table, set the change state as an initial state, and then store the data structure change table in a database.
And after the data structure change table is successfully stored, the database returns a confirmation response to the management module, and the management module returns a confirmation response to the research and development personnel.
The management module receives a request for receiving the total change submitted by the research and development personnel.
And the management module confirms whether the change state in the data structure change table is an initial state.
The database returns a confirmation response to the management module.
And the management module executes data structure change on the source table according to the data structure change table.
The database returns a confirmation response to the management module.
And the management module synchronizes the dynamic structure table to the source table after the data structure change is executed according to the data structure change table and the corresponding dynamic structure table.
The database returns a confirmation response to the management module.
And the management module returns a response of confirming the end to the research and development personnel.
As shown in fig. 3, if the management module receives a rollback request submitted by a developer, the change state in the data structure change table is updated to a rollback change, and no synchronization operation is performed on the source table.
The embodiment of the invention realizes smooth upgrade of the data structure and the service data in the gray scale process through the management module, realizes temporary storage of the data structure and the service data in the gray scale process through the data structure change table and the dynamic structure table, and synchronizes the change of the data structure and the gray scale period service data to the source table after the gray scale is finished. The data structure change table records detailed information of the data structure change and is used for realizing tracking of the data structure change and enabling or backing the change automatically. The dynamic structure table records the business data generated by the changed data structure in the gray scale period, and the business data is automatically validated or backed up through the change validation or backing-up strategy defined by the data structure change table after the gray scale period is finished.
Fig. 4 is a schematic diagram of a main flow of a data upgrade method according to still another referential embodiment of the present invention. As shown in fig. 4, the data upgrading method may specifically include the following steps:
step 401 receives a change registration request and its corresponding change specification information, and generates a data structure change table.
Step 402, setting the change state in the data structure change table to an initial state, and storing the data structure change table in a database.
Step 403, receiving the request of changing the total amount, and updating the changed state in the data structure change table to the changed structure.
Step 404, obtaining change information from the data structure change table according to the change type in the data structure change table, and executing data structure change on the source table.
Step 405, updating the change state in the data structure change table to data migration.
Step 406, determining whether the change type in the data structure change table is new or modified; if yes, go to step 407; if not, go to step 408.
Step 407, searching a dynamic structure table corresponding to the data structure change table, and synchronizing a change column value to the source table after the data structure change is performed according to the source table primary key value in the dynamic structure table.
Step 408, updating the changed state in the data structure change table to changed completion.
In addition, in another embodiment of the present invention, the details of the implementation of the data upgrading method are described in detail above, and therefore the repeated descriptions are not repeated here.
Fig. 5 is a schematic diagram of a main flow of a data query method according to an embodiment of the present invention. As an embodiment of the present invention, as shown in fig. 5, the data query method may include:
step 501, acquiring a data structure change table corresponding to the version of the application program according to the version environment of the application program.
After the change registration request is successful, a data manipulation module (DataSdk) may be embedded in the application, providing the ability for different versions of the application to query/update data during the grayscale. And acquiring the version environment of the application program through the data operation module, and then acquiring a data structure change table consistent with the version of the application program from a database. Generally, after the application program is started, the data operation module is triggered to acquire the change detail information in the data structure change table.
Step 502, receiving a data query request sent by the application program, and obtaining first data from a source table and/or obtaining second data from a dynamic structure table according to the data structure change table.
After receiving the data query request sent by the client, the application program sends the data query request, and the data operation module receives the data query request, and accesses the source table and/or the dynamic structure table in the database according to the data structure change table obtained in step 501, so as to obtain the first data and/or the second data.
It should be noted that data is obtained from different tables according to the type of change. The change type in the data structure change table is firstly inquired, and if the change type is newly added or modified, it indicates that the change column value (i.e. the service data) in the dynamic structure table is also changed, so the change column value needs to be acquired from the dynamic structure table. Specifically, whether the change type of the inquired field is newly added or modified is judged, if yes, second data corresponding to the field is obtained from the dynamic structure table, and if not, first data corresponding to the field is obtained from the source table. If both the change type is a new or modified field and the change type is not a new or modified field, then both the first data from the source table and the second data from the dynamic structure table are obtained.
Step 503, returning the integrated first data and/or second data to the application program.
After the first data and/or the second data are obtained, the first data and/or the second data are integrated and then returned to the application program, and the application program returns the data to the client.
According to the various embodiments described above, it can be seen that the technical problem of data structure conflict caused by parallel gray-scale period multi-version programs in the prior art is solved by the technical means of acquiring the first data from the source table and/or acquiring the second data from the dynamic structure table according to the data structure change table, integrating the first data and/or the second data, and returning the integrated first data and/or second data to the application program. According to the embodiment of the invention, the data can be acquired from different tables by inquiring the change type of the data structure change table, and the data is integrated and returned to the application program, so that the acquisition of the service data of different data structures is realized, and the problem of data structure conflict caused by the parallel of multiple versions of programs in the gray period is avoided.
Fig. 6 is a schematic diagram of a main flow of a data query method according to a referential embodiment of the present invention. As shown in fig. 6, the data query method may specifically include the following steps:
step 601, acquiring a data structure change table corresponding to the version of the application program according to the version environment of the application program.
Step 602, receiving a data query request sent by the application program.
Step 603, judging whether the change type of the inquired field is newly increased or modified according to the change type in the data structure change table; if yes, go to step 604; if not, go to step 605.
Step 604, obtain second data from the dynamic configuration table.
Step 605, obtain the first data from the source table.
Step 606, integrating the first data and/or the second data.
Step 607, return the integrated data to the application.
It should be noted that, if the change status in the data structure change table is change complete or rollback change, which indicates that the version has no change or is finished, the data processing module directly obtains the data in the source table after receiving the data query request of the application program.
In addition, in another embodiment of the present invention, the detailed implementation of the data query method is described in detail above, so that the repeated content is not described again.
Fig. 7 is a schematic diagram of a main flow of a data query method according to a referential embodiment of the present invention. As shown in fig. 7, the data query method may specifically include the following steps:
step 701, acquiring a data structure change table corresponding to the version of the application program according to the version environment of the application program.
Step 702, a data update request sent by an application program is received.
Step 703, determining whether the change state in the data structure change table is changed completely; if yes, go to step 704; if not, go to step 705.
Step 704, updating the update data carried by the data update request into a source table.
Step 705, updating the update data carried by the data update request to a source table and/or a dynamic structure table according to the change type of the data structure change table.
In step 705, the data is updated to a different table according to the type of change. The change type in the data structure change table is firstly inquired, and if the change type is newly added or modified, the change column value (namely the service data) in the dynamic structure table needs to be updated. Specifically, whether the change type of the field needing to be updated is newly added or modified is judged, if yes, the update data carried by the data update request is updated into the dynamic structure table, and if not, the update data carried by the data update request is updated into the source table. In addition, it is also possible to update both the source table and the dynamic configuration table, depending on the actual business requirements.
It should be noted that, if the change status in the data structure change table is change complete or rollback change, which indicates that the version has no change or has ended, the data processing module directly updates the data in the source table after receiving the data update request of the application program.
The embodiment of the invention can update the data in different tables by inquiring the change type of the data structure change table, realizes the update of the service data of different data structures, avoids the problem of data structure conflict caused by the parallel of multiple versions of programs in the gray scale period, and can ensure that the data in the database is up to date after the gray scale period is finished.
In addition, in another embodiment of the present invention, the detailed implementation of the data query method is described in detail above, so that the repeated content is not described again.
Fig. 8 is a schematic diagram of main modules of a data upgrading apparatus according to an embodiment of the present invention, and as shown in fig. 8, the data upgrading apparatus 800 includes a registration module 801, a change module 802, and a synchronization module 803. The registration module 801 is configured to receive a change registration request and corresponding change detail information thereof, and generate a data structure change table; the change module 802 is configured to receive a full change request, and perform data structure change on a source table according to the data structure change table; the synchronization module 803 is configured to synchronize the dynamic structure table to the source table after the data structure change is performed according to the data structure change table and the corresponding dynamic structure table.
Optionally, the data structure change table stores a new version name, a source table name, a change field, a change value, a change type and a change state;
the dynamic structure table stores a source table primary key value, a change column name and a change column value.
Optionally, the changing module 802 is further configured to:
receiving a full change request, and updating the change state in the data structure change table into a change structure;
acquiring change information from the data structure change table according to the change type in the data structure change table, and executing data structure change on a source table;
and updating the change state in the data structure change table into data migration.
Optionally, the synchronization module 803 is further configured to:
judging whether the change type in the data structure change table is newly increased or modified;
if so, searching a dynamic structure table corresponding to the data structure change table, and synchronizing a change column value into the source table after executing data structure change according to a source table primary key value in the dynamic structure table;
and updating the change state in the data structure change table to be changed and completed.
According to the various embodiments described above, it can be seen that the technical problem of data structure conflict caused by parallel multi-version programs in the gray scale period in the prior art is solved by the technical means of performing data structure change on the source table according to the data structure change table and synchronizing the dynamic structure table into the source table according to the data structure change table and the corresponding dynamic structure table. The embodiment of the invention realizes the smooth upgrade of the data structure and the service data by storing the data of the gray period through the two data tables, can ensure the compatibility of the data structure and the data sharing and intercommunication when a plurality of versions run simultaneously, avoids the problems of data synchronization and consistency caused by sub-database and sub-table, and reduces the complexity of service development, the online cost and the operation and maintenance cost. In addition, the gray scale release does not need to customize a data structure and business data change or rollback scheme for the business, the change of the data structure and the business data can be automatically effective or rolled back through the system, a large amount of research and development time spent on customizing an online/rollback scheme for each data structure change is avoided, and the research and development efficiency can be effectively improved.
Fig. 9 is a schematic diagram of main modules of a data query apparatus according to an embodiment of the present invention, and as shown in fig. 9, the data upgrade apparatus 900 includes an obtaining module 901, a query module 902, and a return module 903. The obtaining module 901 is configured to obtain a data structure change table corresponding to the version of the application program according to the version environment of the application program; the query module 902 is configured to receive a data query request sent by the application program, and obtain first data from a source table and/or obtain second data from a dynamic structure table according to the data structure change table; the return module 903 is configured to return the integrated first data and/or second data to the application program.
Optionally, the method further comprises:
and the updating module is used for receiving a data updating request sent by the application program and updating data in the source table and/or the dynamic structure table according to the changing state in the data structure changing table.
Optionally, the update module is further configured to:
judging whether the change state in the data structure change table is changed completely;
if yes, updating the updating data carried by the data updating request into a source table;
and if not, updating the updating data carried by the data updating request into a source table and/or a dynamic structure table according to the changing type of the data structure changing table.
According to the various embodiments described above, it can be seen that the technical problem of data structure conflict caused by parallel gray-scale period multi-version programs in the prior art is solved by the technical means of acquiring the first data from the source table and/or acquiring the second data from the dynamic structure table according to the data structure change table, integrating the first data and/or the second data, and returning the integrated first data and/or second data to the application program. The embodiment of the invention can acquire/update data from different tables by inquiring/updating the change type of the data structure change table, realizes the acquisition/update of the service data with different data structures, and avoids the problem of data structure conflict caused by the parallel of multiple versions of programs in the gray period.
Fig. 10 shows an exemplary system architecture 1000 to which the data upgrade method or the data upgrade apparatus of the present invention may be applied.
As shown in fig. 10, the system architecture 1000 may include terminal devices 1001, 1002, 1003, a network 1004, and a server 1005. The network 1004 is used to provide a medium for communication links between the terminal devices 1001, 1002, 1003 and the server 1005. Network 1004 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
A user may use terminal devices 1001, 1002, 1003 to interact with a server 1004 via a network 1004 to receive or send messages or the like. The terminal devices 1001, 1002, 1003 may have installed thereon various messenger client applications such as shopping applications, web browser applications, search applications, instant messenger, mailbox clients, social platform software, etc. (by way of example only).
The terminal devices 1001, 1002, 1003 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 1005 may be a server that provides various services, such as a backend management server (for example only) that supports shopping websites browsed by users using the terminal devices 1001, 1002, 1003. The background management server may analyze and otherwise process the received data such as the item information query request, and feed back a processing result (for example, target push information, item information — just an example) to the terminal device.
It should be noted that the data upgrading method provided by the embodiment of the present invention is generally executed by the server 1005, and accordingly, the data upgrading apparatus is generally disposed in the server 1005. The data query method provided by the embodiment of the present invention is generally executed by the server 1005, and accordingly, the data query apparatus is generally disposed in the server 1005.
It should be understood that the number of terminal devices, networks, and servers in fig. 10 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 11, shown is a block diagram of a computer system 1100 suitable for use with a terminal device implementing an embodiment of the present invention. The terminal device shown in fig. 11 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
As shown in fig. 11, the computer system 1100 includes a Central Processing Unit (CPU)1101, which can perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)1102 or a program loaded from a storage section 1108 into a Random Access Memory (RAM) 1103. In the RAM1103, various programs and data necessary for the operation of the system 1100 are also stored. The CPU 1101, ROM 1102, and RAM1103 are connected to each other by a bus 1104. An input/output (I/O) interface 1105 is also connected to bus 1104.
The following components are connected to the I/O interface 1105: an input portion 1106 including a keyboard, mouse, and the like; an output portion 1107 including a signal output unit such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and a speaker; a storage section 1108 including a hard disk and the like; and a communication section 1109 including a network interface card such as a LAN card, a modem, or the like. The communication section 1109 performs communication processing via a network such as the internet. A driver 1110 is also connected to the I/O interface 1105 as necessary. A removable medium 1111 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 1110 as necessary, so that a computer program read out therefrom is mounted into the storage section 1108 as necessary.
In particular, according to the embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program article comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication portion 1109 and/or installed from the removable medium 1111. The above-described functions defined in the system of the present invention are executed when the computer program is executed by a Central Processing Unit (CPU) 1101.
It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present invention, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program articles according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules described in the embodiments of the present invention may be implemented by software or hardware. The described modules may also be provided in a processor, which may be described as: a processor includes a registration module, a change module, and a synchronization module, where the names of the modules do not in some cases constitute a limitation on the modules themselves.
The modules described in the embodiments of the present invention may be implemented by software or hardware. The described modules may also be provided in a processor, which may be described as: a processor includes an acquisition module, a query module, and a return module, where the names of the modules do not in some cases constitute a limitation on the module itself.
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to comprise: receiving a change registration request and corresponding change detail information thereof, and generating a data structure change table; receiving a full change request, and executing data structure change on a source table according to the data structure change table; and synchronizing the dynamic structure table to the source table after the data structure change is performed according to the data structure change table and the corresponding dynamic structure table.
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to comprise: acquiring a data structure change table corresponding to the version of the application program according to the version environment of the application program; receiving a data query request sent by the application program, and acquiring first data from a source table and/or acquiring second data from a dynamic structure table according to the data structure change table; and returning the integrated first data and/or second data to the application program.
According to the technical scheme of the embodiment of the invention, the technical means that the data structure change is carried out on the source table according to the data structure change table and the dynamic structure table corresponding to the data structure change table is synchronized into the source table is adopted, so that the technical problem of data structure conflict caused by parallel multi-version programs in the gray period in the prior art is solved. The embodiment of the invention realizes the smooth upgrade of the data structure and the service data by storing the data of the gray period through the two data tables, can ensure the compatibility of the data structure and the data sharing and intercommunication when a plurality of versions run simultaneously, avoids the problems of data synchronization and consistency caused by sub-database and sub-table, and reduces the complexity of service development, the online cost and the operation and maintenance cost. In addition, the gray scale release does not need to customize a data structure and business data change or rollback scheme for the business, the change of the data structure and the business data can be automatically effective or rolled back through the system, a large amount of research and development time spent on customizing an online/rollback scheme for each data structure change is avoided, and the research and development efficiency can be effectively improved.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (11)

1. A method for upgrading data, comprising:
receiving a change registration request and corresponding change detail information thereof, and generating a data structure change table;
receiving a full change request, and executing data structure change on a source table according to the data structure change table;
and synchronizing the dynamic structure table to the source table after the data structure change is performed according to the data structure change table and the corresponding dynamic structure table.
2. The method of claim 1, wherein the data structure change table stores a new version name, a source table name, a change field, a change value, a change type, and a change status;
the dynamic structure table stores a source table primary key value, a change column name and a change column value.
3. The method of claim 2, wherein receiving a full volume change request and performing a data structure change to a source table according to the data structure change table comprises:
receiving a full change request, and updating the change state in the data structure change table into a change structure;
acquiring change information from the data structure change table according to the change type in the data structure change table, and executing data structure change on a source table;
and updating the change state in the data structure change table into data migration.
4. The method of claim 3, wherein synchronizing the dynamic structure table to the source table after performing the data structure change according to the data structure change table and the corresponding dynamic structure table comprises:
judging whether the change type in the data structure change table is newly increased or modified;
if so, searching a dynamic structure table corresponding to the data structure change table, and synchronizing a change column value into the source table after executing data structure change according to a source table primary key value in the dynamic structure table;
and updating the change state in the data structure change table to be changed and completed.
5. A method for querying data, comprising:
acquiring a data structure change table corresponding to the version of the application program according to the version environment of the application program;
receiving a data query request sent by the application program, and acquiring first data from a source table and/or acquiring second data from a dynamic structure table according to the data structure change table;
and returning the integrated first data and/or second data to the application program.
6. The method of claim 5, further comprising:
and receiving a data updating request sent by the application program, and updating data in a source table and/or a dynamic structure table according to the change state in the data structure change table.
7. The method of claim 6, wherein updating data in a source table and/or a dynamic structure table according to the change status in the data structure change table comprises:
judging whether the change state in the data structure change table is changed completely;
if yes, updating the updating data carried by the data updating request into a source table;
and if not, updating the updating data carried by the data updating request into a source table and/or a dynamic structure table according to the changing type of the data structure changing table.
8. A data upgrade apparatus, comprising:
the registration module is used for receiving the change registration request and the corresponding change detail information thereof and generating a data structure change table;
the change module is used for receiving a full change request and executing data structure change on the source table according to the data structure change table;
and the synchronization module is used for synchronizing the dynamic structure table to the source table after the data structure is changed according to the data structure change table and the corresponding dynamic structure table.
9. A data query apparatus, comprising:
the system comprises an acquisition module, a storage module and a processing module, wherein the acquisition module is used for acquiring a data structure change table corresponding to the version of an application program according to the version environment of the application program;
the query module is used for receiving a data query request sent by the application program, acquiring first data from a source table according to the data structure change table, and/or acquiring second data from a dynamic structure table;
and the return module is used for returning the integrated first data and/or second data to the application program.
10. An electronic device, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-7.
11. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-7.
CN201910924810.9A 2019-09-27 2019-09-27 Data upgrading and querying method and device Pending CN111782235A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910924810.9A CN111782235A (en) 2019-09-27 2019-09-27 Data upgrading and querying method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910924810.9A CN111782235A (en) 2019-09-27 2019-09-27 Data upgrading and querying method and device

Publications (1)

Publication Number Publication Date
CN111782235A true CN111782235A (en) 2020-10-16

Family

ID=72755600

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910924810.9A Pending CN111782235A (en) 2019-09-27 2019-09-27 Data upgrading and querying method and device

Country Status (1)

Country Link
CN (1) CN111782235A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112783868A (en) * 2021-02-10 2021-05-11 中国工商银行股份有限公司 Distributed database table structure gray scale upgrading method, device and system
CN112860697A (en) * 2021-02-10 2021-05-28 中国工商银行股份有限公司 Distributed database table structure changing method, device and system
CN113868231A (en) * 2021-12-03 2021-12-31 南昌龙旗信息技术有限公司 Data structure updating method and device
CN116401262A (en) * 2023-03-06 2023-07-07 安芯网盾(北京)科技有限公司 Database upgrading method and device

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105335204A (en) * 2014-07-29 2016-02-17 株式会社日立制作所 Grey level distribution control method and grey level distribution control device of software program
CN105824745A (en) * 2015-01-04 2016-08-03 中国移动通信集团湖南有限公司 Grey level launch method and device
CN105827873A (en) * 2015-01-04 2016-08-03 中国移动通信集团江苏有限公司 Method and device for solving limitation in service handling of nonlocal customers
CN107872334A (en) * 2016-09-23 2018-04-03 中兴通讯股份有限公司 The method and device that gray scale upgrades in a kind of micro services architecture system
CN107957888A (en) * 2016-10-14 2018-04-24 北京国双科技有限公司 The gray scale upgrade method and device of application program
CN109284312A (en) * 2018-08-27 2019-01-29 山东威尔数据股份有限公司 A kind of heterogeneous database change real-time informing method
CN109725928A (en) * 2018-06-15 2019-05-07 平安普惠企业管理有限公司 Gray scale dissemination method, device, equipment and readable storage medium storing program for executing
CN109885581A (en) * 2019-03-14 2019-06-14 苏州达家迎信息技术有限公司 Synchronous method, device, equipment and the storage medium of database

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105335204A (en) * 2014-07-29 2016-02-17 株式会社日立制作所 Grey level distribution control method and grey level distribution control device of software program
CN105824745A (en) * 2015-01-04 2016-08-03 中国移动通信集团湖南有限公司 Grey level launch method and device
CN105827873A (en) * 2015-01-04 2016-08-03 中国移动通信集团江苏有限公司 Method and device for solving limitation in service handling of nonlocal customers
CN107872334A (en) * 2016-09-23 2018-04-03 中兴通讯股份有限公司 The method and device that gray scale upgrades in a kind of micro services architecture system
CN107957888A (en) * 2016-10-14 2018-04-24 北京国双科技有限公司 The gray scale upgrade method and device of application program
CN109725928A (en) * 2018-06-15 2019-05-07 平安普惠企业管理有限公司 Gray scale dissemination method, device, equipment and readable storage medium storing program for executing
CN109284312A (en) * 2018-08-27 2019-01-29 山东威尔数据股份有限公司 A kind of heterogeneous database change real-time informing method
CN109885581A (en) * 2019-03-14 2019-06-14 苏州达家迎信息技术有限公司 Synchronous method, device, equipment and the storage medium of database

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
李晓毅;: "电子银行系统灰度发布的研究与实现", 金融电子化, no. 01 *

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112783868A (en) * 2021-02-10 2021-05-11 中国工商银行股份有限公司 Distributed database table structure gray scale upgrading method, device and system
CN112860697A (en) * 2021-02-10 2021-05-28 中国工商银行股份有限公司 Distributed database table structure changing method, device and system
CN113868231A (en) * 2021-12-03 2021-12-31 南昌龙旗信息技术有限公司 Data structure updating method and device
CN113868231B (en) * 2021-12-03 2022-03-18 南昌龙旗信息技术有限公司 Data structure updating method and device
CN116401262A (en) * 2023-03-06 2023-07-07 安芯网盾(北京)科技有限公司 Database upgrading method and device
CN116401262B (en) * 2023-03-06 2024-02-02 安芯网盾(北京)科技有限公司 Database upgrading method and device

Similar Documents

Publication Publication Date Title
CN111782235A (en) Data upgrading and querying method and device
US9336291B2 (en) Message based synchronization for mobile business objects
US10311077B2 (en) Database table conversion
US11449470B2 (en) Patching JSON documents that contain arrays undergoing concurrent modification
CN107656748B (en) Application publishing method and device
CN108011949B (en) Method and apparatus for acquiring data
CN110858194A (en) Method and device for expanding database
CN112948498A (en) Method and device for generating global identification of distributed system
CN112947992A (en) Method and device for managing code version
CN113760948A (en) Data query method and device
CN112084254A (en) Data synchronization method and system
CN113076343B (en) Data query method, device, equipment and storage medium
CN113783916B (en) Information synchronization method and device
CN114385570A (en) Data synchronization method and device, electronic equipment and readable medium
CN108833147B (en) Configuration information updating method and device
CN113742321A (en) Data updating method and device
CN113761074A (en) Rich text information storage method, device and system
CN114817276A (en) Method, system, equipment and storage medium for updating file
CN112948494A (en) Data synchronization method and device, electronic equipment and computer readable medium
CN113760860B (en) Data reading method and device
CN111984686A (en) Data processing method and device
CN112579615A (en) Method and device for realizing distributed lock
CN113377795A (en) Message processing method and device
US20220179879A1 (en) Systems and methods for intermittent synchronizing of customer relationship management local application clients
CN115185966A (en) Method and device for processing data consistency in distributed cluster

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination