A data model switching method, device, server and storage medium
Through the method of automatically verifying and switching data models online, the problem of low efficiency and difficult to guarantee the switching of data models in the prior art is solved, and seamless switching and efficient verification are achieved.
Patent Information
- Application Number
- CN202111331095.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-11
- Publication Date
- 2025-01-14
- Estimated Expiration
- 2041-11-11
AI Technical Summary
The prior art is difficult to effectively verify and switch data models without affecting the operation of application software services, resulting in difficult to ensure data consistency and low switching efficiency.
By setting the data verification mode and data model switching mode, the data consistency between the original data model and the improved data model is automatically verified online, and if the preset conditions are met, the processing mode will be updated, thereby achieving seamless switching of the data model.
Without affecting existing services, automatic verification and switching of data models are realized, switching efficiency is improved, and data consistency is ensured.
Smart Images

Figure CN114036218B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to computer technology, and in particular to a data model switching method, device, server and storage medium. Background Art
[0002] With the rapid development of computer technology, various application software are being developed. When the user scale of application software is getting larger and larger or the business functions are expanding, the original data model used by the application software backend server cannot meet the current needs, so it is necessary to redesign the data model and switch the original data model to an improved data model to meet the software requirements.
[0003] At present, in order to avoid affecting the existing business operation of application software, the data consistency between the original data model and the improved data model is usually verified offline. However, this offline manual verification is difficult to ensure data consistency and reduces the switching efficiency. At the same time, it is also difficult to verify whether the improved data model is compatible with the existing business. Summary of the invention
[0004] The embodiments of the present invention provide a data model switching method, device, server and storage medium to perform online automatic verification of data of the original data model and the improved data model to ensure data consistency, and realize seamless switching of data models without affecting the operation of existing businesses, thereby improving switching efficiency.
[0005] In a first aspect, an embodiment of the present invention provides a data model switching method, including:
[0006] Receive the current data request sent by the client;
[0007] Based on the current processing mode, the current data request is processed, the current response data corresponding to the current data request is determined, and the current response data is returned to the client, wherein the initial mode of the current processing mode is a data verification mode, and the data verification mode is to perform data verification on the original data model and the improved data model, and determine the mode of the current response data corresponding to the current data request based on the data verification result;
[0008] If it is detected that the preset data verification success condition is currently met, the current processing mode is updated from the data verification mode to the data model switching mode, wherein the data model switching mode is a mode for determining the current response data corresponding to the current data request based on the improved data model.
[0009] In a second aspect, an embodiment of the present invention further provides a data model switching device, including:
[0010] A current data request receiving module is used to receive the current data request sent by the client;
[0011] A current response data determination module is used to process the current data request based on the current processing mode, determine the current response data corresponding to the current data request, and return the current response data to the client, wherein the initial mode of the current processing mode is a data verification mode, and the data verification mode is to perform data verification on the original data model and the improved data model, and determine the mode of the current response data corresponding to the current data request based on the data verification result;
[0012] The current processing mode update module is used to update the current processing mode from the data verification mode to the data model switching mode if it is detected that the preset data verification success condition is currently met, wherein the data model switching mode is a mode for determining the current response data corresponding to the current data request based on the improved data model.
[0013] In a third aspect, an embodiment of the present invention further provides a server, the server comprising:
[0014] one or more processors;
[0015] A memory for storing one or more programs;
[0016] When the one or more programs are executed by the one or more processors, the one or more processors implement the data model switching method provided in the embodiment of the present invention.
[0017] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the data model switching method provided in the embodiment of the present invention.
[0018] The embodiment of the present invention pre-sets the data verification mode and the data model switching mode, and uses the data verification mode as the initial mode of the current processing mode, so that in the data verification mode, the original data model and the improved data model can be verified, and the current response data corresponding to the current data request sent by the client can be determined based on the data verification result, so that the data of the original data model and the improved data model can be automatically verified online without human intervention, thereby ensuring data consistency. If it is detected that the preset data verification success condition is currently met, the current processing mode is updated from the data verification mode to the data model switching mode, so that in the data model switching mode, the current response data corresponding to the current data request sent by the client can be determined based on the improved data model, so that the original data model is switched to the improved data model, and the seamless switching of the data model is achieved without affecting the operation of the existing business, thereby improving the switching efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 is a flow chart of a data model switching method provided in Embodiment 1 of the present invention;
[0020] Figure 2 is a flow chart of a data model switching method provided by Embodiment 2 of the present invention;
[0021] Figure 3 is a structural diagram of a data model switching device provided in Embodiment 3 of the present invention;
[0022] Figure 4 It is a structural diagram of a server provided in Embodiment 4 of the present invention. DETAILED DESCRIPTION
[0023] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only parts related to the present invention, rather than all structures, are shown in the accompanying drawings.
[0024] Embodiment 1
[0025] Figure 1 This is a flow chart of a data model switching method provided in the first embodiment of the present invention. This embodiment can be applied to the case of switching data models with different structures, especially to the application scenario where the data model is relatively complex and the data switching process must ensure that the data is completely consistent and the existing business is running uninterrupted. The method can be executed by a data model switching device, which can be implemented by software and / or hardware and integrated into a server. Figure 1 As shown, the method specifically comprises the following steps:
[0026] S110: Receive a current data request sent by the client.
[0027] The client may refer to an application software program that provides local services to users. The current data request may refer to a currently received data request. The current data request may include a data read request, such as a data query request, or a data write request, such as a data registration request.
[0028] S120. Based on the current processing mode, the current data request is processed, the current response data corresponding to the current data request is determined, and the current response data is returned to the client, wherein the initial mode of the current processing mode is the data verification mode, the data verification mode performs data verification on the original data model and the improved data model, and determines the mode of the current response data corresponding to the current data request based on the data verification result.
[0029] Among them, the current processing mode may refer to the way of processing the current data request. The current response data may refer to the request processing result. The data model may refer to a database used to store data. The data model may include: a hierarchical model, a network model or a relational model. The fundamental difference between them lies in the different ways of expressing the connection between data. The original data model may refer to the data model originally used by the server. The improved data model is a data model obtained after redesign and improvement. The improved data model in this embodiment has a different data structure from the original data model, so it is necessary to verify the data consistency after data synchronization. The improved data model and the original data model can achieve a one-to-one correspondence through a single field and multiple joint fields, that is, a field mapping relationship, so as to perform data synchronization operations and data verification operations based on the field mapping relationship.
[0030] Specifically, when it is necessary to switch the data model, the data verification mode is used as the initial mode of the current processing mode, so that the data verification mode is used to verify the original data model and the improved data model, and the current response data corresponding to the current data request is determined based on the data verification result, thereby realizing online automatic verification of the data of the original data model and the improved data model. For example, the original request processing logic can be used to obtain the first field data corresponding to the current data request from the original data model, and the first field data is logically processed to obtain the first business data that can be returned to the client. At the same time, the improved request processing logic can also be used to obtain the second field data corresponding to the current data request from the improved data model, and the second field data is logically processed to obtain the second business data that can be returned to the client. This embodiment can synchronously perform data verification operations and response data return operations. For example, it can verify whether the first field data matches the second field data based on the field mapping relationship, and verify whether the first business data and the second business data are the same. When the verification is successful, that is, the first field data matches the second field data and the first business data and the second business data are the same, the second business data can be returned to the client as the current response data corresponding to the current data request, or, whether the verification is successful or failed, the first business data can be directly returned to the client as the current response data corresponding to the current data request to improve the response speed. If the verification fails, that is, the first field data does not match the second field data and / or the first business data and the second business data are not the same, an alarm message can be generated, and the alarm message can be reported to relevant personnel to promptly remind relevant personnel to check and maintain. This embodiment can also asynchronously perform data verification operations and response data return operations to further improve the response speed. For example, the first business data can be directly returned to the client as the current response data corresponding to the current data request, and at the same time, it can be asynchronously checked whether the first field data matches the second field data, and whether the first business data and the second business data are the same. When the verification fails, an alarm message can be generated, thereby further improving the response speed and ensuring that the data is completely consistent during the data model switching process.
[0031] S130. If it is detected that the preset data verification success condition is currently met, the current processing mode is updated from the data verification mode to the data model switching mode, wherein the data model switching mode is a mode for determining the current response data corresponding to the current data request based on the improved data model.
[0032] The preset data verification success condition may be a pre-set condition used to indicate that the current processing mode can be updated. For example, the preset data verification success condition may mean that no alarm information is generated within a preset time period, or that no alarm information is generated after a preset number of requests are processed.
[0033] Specifically, when it is detected that the current request processing situation meets the preset data verification success condition, it indicates that the data of the original data model is consistent with the data of the improved data model. At this time, the current processing mode can be updated from the data verification mode to the data model switching mode, and the operation of step S110 can be returned to execute, so that the data model switching mode can be used to switch the original data model to the improved data model, and the current response data corresponding to the current data request received subsequently can be directly determined based on the improved data model. By updating the current processing mode, the seamless switching of the data model can be achieved without affecting the operation of the existing business, improving the switching efficiency, and without the need for improvements at the business level, making the business unaware and reducing the switching cost.
[0034] The technical solution of this embodiment pre-sets the data verification mode and the data model switching mode, and uses the data verification mode as the initial mode of the current processing mode, so that in the data verification mode, the original data model and the improved data model can be verified, and the current response data corresponding to the current data request sent by the client is determined based on the data verification result, so that the data of the original data model and the improved data model can be automatically verified online without human intervention, thereby ensuring data consistency. If it is detected that the preset data verification success condition is currently met, the current processing mode is updated from the data verification mode to the data model switching mode, so that in the data model switching mode, the current response data corresponding to the current data request sent by the client can be determined based on the improved data model, so that the original data model is switched to the improved data model, and the seamless switching of the data model is achieved without affecting the operation of the existing business, thereby improving the switching efficiency.
[0035] Based on the above technical solution, step S120 may include: based on the current request identifier in the current data request, detecting whether the current data request is within the current verification request range, and the current verification request range is updated based on the current verification result; if so, based on the current processing mode, processing the current data request to determine the current response data corresponding to the current data request; if not, determining the current response data corresponding to the current data request based on the original data model.
[0036] The current verification request range can be a user-configured set of data request identifiers currently used for data verification. The current verification request range can be configured and updated based on the current verification result. For example, if all data requests within the current verification request range are successfully verified, the current verification request range can be increased to verify the processing of more data requests and ensure data consistency.
[0037] Specifically, when the amount of data is large, you can configure the current verification request range to give priority to verifying a small number of data requests, and then expand the verification range of the data request after there is no problem, so as to further avoid affecting the response speed. When the current processing mode is the data verification mode, you can detect whether the current data request is within the current verification request range. If so, it indicates that the current data request can be verified. At this time, based on the data verification mode, the original data model and the improved data model can be verified, and the current response data corresponding to the current data request can be determined based on the data verification result. If it is not within the current verification request range, it means that there is no need to verify the current data request. At this time, the original request processing logic can be used to determine the current response data corresponding to the current data request based on the original data model, so that the step-by-step verification of the data model can be achieved.
[0038] On the basis of the above technical solution, before step S110, the method may further include: based on the field mapping relationship between the original data model and the improved data model, synchronously storing the original field data in the original data model into the improved data model.
[0039] Specifically, after obtaining the improved data model, the improved field data corresponding to the original field data in the original data model can be determined based on the field mapping relationship between the original data model and the improved data model, and the improved field data can be stored in the improved data model, thereby realizing data synchronization, and performing data verification after data synchronization to ensure the accuracy and consistency of data synchronization.
[0040] Embodiment 2
[0041] Figure 2 A flowchart of a data model switching method provided in Embodiment 2 of the present invention. In this embodiment, based on the above embodiments, the data verification mode may include: field data verification mode and business data verification mode. Accordingly, the initial mode of the current processing mode is the field data verification mode. On this basis, the step "if it is detected that the preset data verification success condition is currently met, the current processing mode is updated from the data verification mode to the data model switching mode" is further optimized. The explanations of the terms that are the same or corresponding to the above embodiments are not repeated here.
[0042] See also Figure 2 The data model switching method provided in this embodiment specifically includes the following steps:
[0043] S210: Receive a current data request sent by the client.
[0044] S220. Based on the current processing mode, process the current data request, determine the current response data corresponding to the current data request, and return the current response data to the client, wherein the initial mode of the current processing mode is the field data verification mode.
[0045] The field data validation mode may refer to a mode for validating the field data of the original data model and the improved data model and determining the current response data corresponding to the current data request. The field data may refer to the original data stored in the data model, that is, the unprocessed underlying data.
[0046] Specifically, when the data model needs to be switched, the field data verification mode is used as the initial mode of the current processing mode, so that the field data verification mode is used to first verify the field data of the original data model and the improved data model to ensure the consistency of the field data. For example, during the field data verification process, the data verification operation and the response data return operation can be performed synchronously or asynchronously to ensure the response speed.
[0047] Exemplarily, when the current processing mode is the field data verification mode, S220 may include: obtaining first field data corresponding to the current data request from the original data model, and obtaining second field data corresponding to the current data request from the improved data model; determining the current response data corresponding to the current data request based on the first field data, and based on the field mapping relationship between the original data model and the improved data model, asynchronously verifying whether the first field data and the second field data match, and if they do not match, generating an alarm message.
[0048] Specifically, the original request processing logic can be used to obtain the first field data corresponding to the current data request from the original data model, and the improved request processing logic can also be used to obtain the second field data corresponding to the current data request from the improved data model. After obtaining the first field data, the first field data can be directly processed, and the obtained business data is returned to the client as the current response data. While determining the current response data, an asynchronous thread can be started, and the asynchronous thread can be used to verify whether the first field data and the second field data match based on the field mapping relationship. If they do not match, an alarm message can be generated, and the alarm message can be reported to relevant personnel to promptly remind relevant personnel to check and maintain. Therefore, through asynchronous operations, the response speed can be guaranteed while ensuring the accuracy of request processing, avoiding affecting the user experience.
[0049] For example, if the current data request is a data query request, the field data queried from the original data model can be used as the first field data, and the field data queried from the improved data model can be used as the second field data. The first field data is processed to obtain the query results to be displayed on the client, and the query results are returned to the client as the current response data. At the same time, the first field data and the second field data are asynchronously checked, that is, whether the correspondence between the first field data and the second field data conforms to the field mapping relationship. If not, an alarm message is generated.
[0050] For another example, if the current data request is a registration request, the registration information in the registration request can be written into the original data model, and the result of whether the writing is successful can be used as the first field data. The registration information in the registration request can be written into the improved data model, and the result of whether the writing is successful can be used as the second field data. The first field data is processed to obtain the registration result to be displayed on the client, and the registration result is returned to the client as the current response data. At the same time, the first field data and the second field data are asynchronously checked, that is, whether the correspondence between the first field data and the second field data conforms to the field mapping relationship. If not, an alarm message is generated.
[0051] S230. If it is detected that the preset data verification success conditions are currently met, the current processing mode is updated in sequence according to the order of field data verification mode, business data verification mode and data model switching mode, and the updating is stopped when the current processing mode is the data model switching mode.
[0052] Specifically, when it is detected that the current request processing situation meets the preset data verification success condition, it indicates that the field data of the original data model and the improved data model are consistent. At this time, the current processing mode can be updated from the field data verification mode to the business data verification mode, and the operation of step S110 can be returned to perform business data verification on the original data model and the improved data model again using the business data verification mode to ensure the consistency of the business data. Among them, the business data can refer to the data to be displayed by the client, that is, the data returned to the client through the interface.
[0053] Exemplarily, when the current processing mode is the business data verification mode, S220 may include: obtaining the third field data corresponding to the current data request from the original data model, and determining the first business data based on the third field data; obtaining the fourth field data corresponding to the current data request from the improved data model, and determining the second business data based on the fourth field data; performing data verification on the first business data and the second business data, and determining the current response data corresponding to the current data request based on the data verification result.
[0054] Specifically, the original request processing logic can be used to obtain the third field data corresponding to the current data request from the original data model, and the third field data can be processed to obtain the first business data that can be returned to the client. At the same time, the improved request processing logic can also be used to obtain the fourth field data corresponding to the current data request from the improved data model, and the fourth field data can be processed to obtain the second business data that can be returned to the client. This embodiment can determine whether the second business data after using the improved data model is consistent with the original first business data by verifying whether the first business data is the same as the second business data, thereby further ensuring that the data after the data model is switched is completely consistent.
[0055] Exemplarily, data verification is performed on the first business data and the second business data, and the current response data corresponding to the current data request is determined based on the data verification result, which may include: if the first business data and the second business data are verified to be the same, the second business data is used as the current response data corresponding to the current data request; if the first business data and the second business data are verified to be different, the first business data is used as the current response data corresponding to the current data request, and an alarm message is generated. When the first business data and the second business data are the same, the second business data after using the improved data model is returned to the client as the current response data, so that the data model can be gradually switched.
[0056] Specifically, when it is detected that the current request processing situation meets the preset data verification success condition, it indicates that the business data of the original data model and the improved data model are also consistent. At this time, the current processing mode can be updated from the business data verification mode to the data model switching mode, and the operation of step S110 can be returned to execute, so that the data model switching mode can be used to switch the original data model to the improved data model, and the current response data corresponding to the current data request received subsequently can be directly determined based on the improved data model. By updating the current processing mode, the seamless switching of the data model can be achieved without affecting the operation of the existing business, improving the switching efficiency, and without the need for improvements at the business level, making the business unaware and reducing the switching cost.
[0057] The technical solution of this embodiment utilizes the field data verification mode and the business data verification mode to perform field data verification and business data verification on the original data model and the improved data model respectively, thereby realizing step-by-step verification of the data model, so that problems can be discovered and solved in time, further improving switching efficiency.
[0058] The following is an embodiment of a data model switching device provided in an embodiment of the present invention. The device and the data model switching methods of the above-mentioned embodiments belong to the same inventive concept. For details not described in detail in the embodiment of the data model switching device, please refer to the embodiment of the above-mentioned data model switching method.
[0059] Embodiment 3
[0060] Figure 3 This is a schematic diagram of a data model switching structure provided by the third embodiment of the present invention. This embodiment is applicable to the case where data models with different structures are switched, such as Figure 3 As shown, the device includes: a current data request receiving module 310, a current response data determining module 320 and a current processing mode updating module 330.
[0061] Among them, the current data request receiving module 310 is used to receive the current data request sent by the client; the current response data determination module 320 is used to process the current data request based on the current processing mode, determine the current response data corresponding to the current data request, and return the current response data to the client, wherein the initial mode of the current processing mode is the data verification mode, the data verification mode is to perform data verification on the original data model and the improved data model, and determine the mode of the current response data corresponding to the current data request based on the data verification result; the current processing mode updating module 330 is used to update the current processing mode from the data verification mode to the data model switching mode if it is detected that the preset data verification success condition is currently met, wherein the data model switching mode is a mode for determining the current response data corresponding to the current data request based on the improved data model.
[0062] Optionally, the data verification mode includes: a field data verification mode and a business data verification mode; accordingly, the initial mode of the current processing mode is the field data verification mode;
[0063] The current processing mode update module 330 is specifically used to: if it is detected that the preset data verification success conditions are currently met, the current processing mode is updated in sequence according to the order of field data verification mode, business data verification mode and data model switching mode, until the current processing mode is the data model switching mode and the updating is stopped.
[0064] Optionally, the current response data determination module 320 is specifically configured to:
[0065] When the current processing mode is the field data verification mode, the first field data corresponding to the current data request is obtained from the original data model, and the second field data corresponding to the current data request is obtained from the improved data model; the current response data corresponding to the current data request is determined based on the first field data, and based on the field mapping relationship between the original data model and the improved data model, whether the first field data and the second field data match is asynchronously verified, and if they do not match, an alarm message is generated.
[0066] Optionally, the current response data determination module 320 is also specifically used to: when the current processing mode is the business data verification mode, obtain the third field data corresponding to the current data request from the original data model, and determine the first business data based on the third field data; obtain the fourth field data corresponding to the current data request from the improved data model, and determine the second business data based on the fourth field data; perform data verification on the first business data and the second business data, and determine the current response data corresponding to the current data request based on the data verification result.
[0067] Optionally, the current response data determination module 320 is also specifically used to: if it is verified that the first business data and the second business data are the same, then the second business data is used as the current response data corresponding to the current data request; if it is verified that the first business data and the second business data are not the same, then the first business data is used as the current response data corresponding to the current data request, and an alarm message is generated.
[0068] Optionally, the current response data determination module 320 is specifically configured to:
[0069] Based on the current request identifier in the current data request, detect whether the current data request is within the current verification request range, which is updated based on the current verification result; if so, process the current data request based on the current processing mode to determine the current response data corresponding to the current data request; if not, determine the current response data corresponding to the current data request based on the original data model.
[0070] Optionally, the device further comprises:
[0071] The data synchronization module is used to synchronize and store the original field data in the original data model into the improved data model based on the field mapping relationship between the original data model and the improved data model before receiving the current data request sent by the client.
[0072] The data model switching device provided in the embodiment of the present invention can execute the data model switching method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects for executing the data model switching method.
[0073] It is worth noting that in the embodiment of the above-mentioned data model switching device, the various units and modules included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention.
[0074] Embodiment 4
[0075] Figure 4 A schematic diagram of the structure of a server provided in Embodiment 4 of the present invention. Figure 4 A block diagram of an exemplary server 12 suitable for use in implementing embodiments of the present invention is shown. Figure 4 The server 12 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0076] like Figure 4 As shown, the server 12 is in the form of a general purpose computing device. The components of the server 12 may include, but are not limited to: one or more processors or processing units 16, a system memory 28, and a bus 18 that connects various system components (including the system memory 28 and the processing unit 16).
[0077] Bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor or a local bus using any of a variety of bus architectures. By way of example, these architectures include, but are not limited to, an Industry Standard Architecture (ISA) bus, a Micro Channel Architecture (MAC) bus, an Enhanced ISA bus, a Video Electronics Standards Association (VESA) local bus, and a Peripheral Component Interconnect (PCI) bus.
[0078] The server 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the server 12, including volatile and non-volatile media, removable and non-removable media.
[0079] The system memory 28 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 30 and / or cache memory 32. The server 12 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the storage system 34 may be used to read and write non-removable, non-volatile magnetic media ( Figure 4 not shown, usually called a "hard drive"). Although Figure 4Not shown in the figure, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk"), and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, a DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to the bus 18 via one or more data medium interfaces. The system memory 28 may include at least one program product having a set (e.g., at least one) of program modules that are configured to perform the functions of the various embodiments of the present invention.
[0080] A program / utility 40 having a set (at least one) of program modules 42 may be stored, for example, in system memory 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment. Program modules 42 generally perform the functions and / or methods of the embodiments described herein.
[0081] The server 12 may also communicate with one or more external devices 14 (e.g., keyboards, pointing devices, displays 24, etc.), may communicate with one or more devices that enable a user to interact with the server 12, and / or may communicate with any device that enables the server 12 to communicate with one or more other computing devices (e.g., network cards, modems, etc.). Such communication may be performed via an input / output (I / O) interface 22. In addition, the server 12 may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via a network adapter 20. As shown, the network adapter 20 communicates with other modules of the server 12 via a bus 18. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the server 12, including, but not limited to, microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0082] The processing unit 16 executes various functional applications and data processing by running the program stored in the system memory 28, for example, implementing a data model switching method provided by the embodiment of the present invention, the method comprising:
[0083] Receive the current data request sent by the client;
[0084] Based on the current processing mode, the current data request is processed, the current response data corresponding to the current data request is determined, and the current response data is returned to the client, wherein the initial mode of the current processing mode is the data verification mode, the data verification mode is to verify the original data model and the improved data model, and determine the mode of the current response data corresponding to the current data request based on the data verification result;
[0085] If it is detected that the preset data verification success condition is currently met, the current processing mode is updated from the data verification mode to the data model switching mode, wherein the data model switching mode is a mode for determining the current response data corresponding to the current data request based on the improved data model.
[0086] Of course, those skilled in the art can understand that the processor can also implement the technical solution of the data model switching method provided by any embodiment of the present invention.
[0087] Embodiment 5
[0088] This embodiment provides a computer-readable storage medium, on which a computer program is stored. When the program is executed by a processor, the steps of the data model switching method provided in any embodiment of the present invention are implemented. The method includes:
[0089] Receive the current data request sent by the client;
[0090] Based on the current processing mode, the current data request is processed, the current response data corresponding to the current data request is determined, and the current response data is returned to the client, wherein the initial mode of the current processing mode is the data verification mode, the data verification mode is to verify the original data model and the improved data model, and determine the mode of the current response data corresponding to the current data request based on the data verification result;
[0091] If it is detected that the preset data verification success condition is currently met, the current processing mode is updated from the data verification mode to the data model switching mode, wherein the data model switching mode is a mode for determining the current response data corresponding to the current data request based on the improved data model.
[0092] The computer storage medium of the embodiment of the present invention can adopt any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to: an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, 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 disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, a computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, device or device or used in combination with it.
[0093] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, which carry computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0094] The program code embodied on the computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
[0095] Computer program code for performing the operations of the present invention may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0096] It should be understood by those skilled in the art that the modules or steps of the present invention described above can be implemented by a general-purpose computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, optionally, they can be implemented by a program code executable by a computer device, so that they can be stored in a storage device and executed by the computing device, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.
[0097] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.
Claims
1. A data model switching method, characterized in that: include: Receive the current data request sent by the client; Based on the current processing mode, the current data request is processed, the current response data corresponding to the current data request is determined, and the current response data is returned to the client, wherein the initial mode of the current processing mode is a data verification mode, and the data verification mode is to perform data verification on the original data model and the improved data model, and determine the mode of the current response data corresponding to the current data request based on the data verification result; If it is detected that the preset data verification success condition is currently met, the current processing mode is updated from the data verification mode to the data model switching mode, wherein the data model switching mode is a mode for determining the current response data corresponding to the current data request based on the improved data model; Wherein, the data verification mode includes: field data verification mode and business data verification mode; The processing of the current data request based on the current processing mode to determine the current response data corresponding to the current data request includes: When the current processing mode is the field data verification mode, obtaining first field data corresponding to the current data request from the original data model, and obtaining second field data corresponding to the current data request from the improved data model; Based on the first field data, the current response data corresponding to the current data request is determined, and based on the field mapping relationship between the original data model and the improved data model, whether the first field data matches the second field data is asynchronously verified, and if they do not match, an alarm message is generated.
2. The method according to claim 1, characterized in that If it is detected that the preset data verification success condition is currently met, updating the current processing mode from the data verification mode to the data model switching mode includes: If it is detected that the preset data verification success conditions are currently met, the current processing mode is updated in sequence according to the order of the field data verification mode, the business data verification mode and the data model switching mode, and the updating is stopped when the current processing mode is the data model switching mode.
3. The method according to claim 1, characterized in that The processing of the current data request based on the current processing mode to determine the current response data corresponding to the current data request also includes: When the current processing mode is the business data verification mode, obtaining third field data corresponding to the current data request from the original data model, and determining the first business data based on the third field data; Acquire fourth field data corresponding to the current data request from the improved data model, and determine second business data based on the fourth field data; Data verification is performed on the first business data and the second business data, and current response data corresponding to the current data request is determined based on the data verification result.
4. The method according to claim 3, characterized in that The performing data verification on the first business data and the second business data, and determining current response data corresponding to the current data request based on the data verification result, includes: If it is verified that the first service data is the same as the second service data, using the second service data as current response data corresponding to the current data request; If it is verified that the first business data is different from the second business data, the first business data is used as current response data corresponding to the current data request, and an alarm message is generated.
5. The method according to any one of claims 1 to 4, characterized in that: The processing of the current data request based on the current processing mode to determine the current response data corresponding to the current data request includes: Based on a current request identifier in a current data request, detecting whether the current data request is within a current verification request range, wherein the current verification request range is updated based on a current verification result; If yes, the current data request is processed based on the current processing mode to determine the current response data corresponding to the current data request; If not, the current response data corresponding to the current data request is determined based on the original data model.
6. The method according to any one of claims 1 to 4, characterized in that: Before receiving the current data request sent by the client, the method further includes: Based on the field mapping relationship between the original data model and the improved data model, the original field data in the original data model is synchronously stored in the improved data model.
7. A data model switching device, characterized in that: include: A current data request receiving module is used to receive the current data request sent by the client; A current response data determination module is used to process the current data request based on the current processing mode, determine the current response data corresponding to the current data request, and return the current response data to the client, wherein the initial mode of the current processing mode is a data verification mode, and the data verification mode is to perform data verification on the original data model and the improved data model, and determine the mode of the current response data corresponding to the current data request based on the data verification result; A current processing mode updating module, configured to update the current processing mode from the data verification mode to a data model switching mode if it is detected that the preset data verification success condition is currently met, wherein the data model switching mode is a mode for determining the current response data corresponding to the current data request based on the improved data model; Wherein, the data verification mode includes: field data verification mode and business data verification mode; Wherein, the current response data determination module is specifically used to: When the current processing mode is the field data verification mode, obtaining first field data corresponding to the current data request from the original data model, and obtaining second field data corresponding to the current data request from the improved data model; Based on the first field data, the current response data corresponding to the current data request is determined, and based on the field mapping relationship between the original data model and the improved data model, whether the first field data matches the second field data is asynchronously verified, and if they do not match, an alarm message is generated.
8. A server, characterized in that: The server comprises: one or more processors; A memory for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the data model switching method as described in any one of claims 1-6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the data model switching method as described in any one of claims 1-6 is implemented.
Citation Information
Patent Citations
Method and system for monitoring data consistency between plurality of databases
CN101625686A
Database switching method and device
CN108920563A