CN115495436A - Database upgrading method and device - Google Patents
Database upgrading method and device Download PDFInfo
- Publication number
- CN115495436A CN115495436A CN202211160262.5A CN202211160262A CN115495436A CN 115495436 A CN115495436 A CN 115495436A CN 202211160262 A CN202211160262 A CN 202211160262A CN 115495436 A CN115495436 A CN 115495436A
- Authority
- CN
- China
- Prior art keywords
- data
- database
- temporary table
- module
- temporary
- 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
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/21—Design, administration or maintenance of databases
- G06F16/219—Managing data history or versioning
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/22—Indexing; Data structures therefor; Storage structures
- G06F16/2282—Tablespace storage structures; Management thereof
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/23—Updating
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/245—Query processing
- G06F16/2458—Special types of queries, e.g. statistical queries, fuzzy queries or distributed queries
- G06F16/2474—Sequence data queries, e.g. querying versioned data
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/27—Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/28—Databases characterised by their database models, e.g. relational or object models
- G06F16/284—Relational databases
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/60—Software deployment
- G06F8/65—Updates
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/70—Software maintenance or management
- G06F8/71—Version control; Configuration management
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Databases & Information Systems (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Software Systems (AREA)
- Data Mining & Analysis (AREA)
- Computer Security & Cryptography (AREA)
- Computing Systems (AREA)
- Fuzzy Systems (AREA)
- Mathematical Physics (AREA)
- Probability & Statistics with Applications (AREA)
- Computational Linguistics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The application provides a method and a device for upgrading a database, which relate to the field of database application and can be applied to the financial field and other fields, wherein the method comprises the following steps: acquiring version upgrading time of a database, constructing a temporary table at a preset period time point before the version upgrading time, and generating a replication rule according to the corresponding relation between the temporary table and an original table in the database; copying data in the original table to the temporary table according to the copying rule, intercepting a service request for accessing the original table at the version upgrading time, and checking the content consistency of the temporary table and the original table; and respectively modifying the table names of the temporary table and the original table according to the check result to replace the original table with the temporary table, and canceling the interception of the service request to finish the version upgrade of the database.
Description
Technical Field
The application relates to the field of database application, can be applied to the financial field and other fields, and particularly relates to a database upgrading method and device.
Background
The existing banking business is oriented to huge individual customer groups, and customers need banks to provide uninterrupted services. However, in the upgrading process of the bank system, the customer service needs to be stopped temporarily, and the contradiction between the upgrading of the bank system and the customer service of 7 × 24 hours is contradictory, so that the problem that the customer service is influenced by the version upgrading is urgently to be solved.
The existing bank system implements autonomous controllable engineering construction, and faces more and more business requirements and monitoring management requirements, version upgrading iteration is more and more frequent, version shutdown caused by updating of a database table structure cannot be avoided, business requirements of customer continuity cannot be provided, and certain influence is brought to the business continuity.
Disclosure of Invention
The application aims to provide a database upgrading method and a database upgrading device, aiming at the problems that shutdown is caused by upgrading of a database table structure during version upgrading of an existing distributed platform to influence service continuity, and a bank system cannot recover to provide service for the outside in a short time, migration of stock main table data, rapid copying of incremental host data and a one-key auxiliary table change-over mode are achieved by establishing a main and auxiliary data table mode through a database copying technology, service continuous providing is achieved, and influence of system upgrading on services and clients is avoided.
To achieve the above object, the present application provides a database upgrading method, comprising: acquiring version upgrading time of a database, constructing a temporary table at a preset period time point before the version upgrading time, and generating a replication rule according to the corresponding relation between the temporary table and an original table in the database; copying data in the original table to the temporary table according to the copying rule, intercepting a service request for accessing the original table at the version upgrading time, and checking the content consistency of the temporary table and the original table; and respectively modifying the table names of the temporary table and the original table according to the check result to replace the original table with the temporary table, and canceling the interception of the service request to finish the version upgrade of the database.
In the above database upgrading method, optionally, the copying the data in the original table to the temporary table according to the copy rule includes: acquiring a data type in an original table, copying stock data in the original table to the temporary table through the copying rule according to the data type, and pushing incremental data in the original table to a cache queue; and analyzing the incremental data in the buffer queue and synchronizing the incremental data to the temporary table through a back-up rule.
In the above database upgrading method, optionally, parsing the incremental data in the buffer queue and synchronizing the incremental data to the temporary table through a back-up rule includes: analyzing the incremental data in the cache queue into sql data, and calculating partition information of execution of the sql data; placing the sql data into a ring buffer area through atomicity according to the partition information, and placing the sql data in the ring buffer area into a queue to be executed; and synchronizing the incremental data to a temporary table through the queue to be executed.
In the above database upgrading method, optionally, synchronizing the incremental data to the temporary table through the queue to be executed includes: monitoring the storage quantity of the sql data in the queue to be executed, and executing the sql data in the queue to be executed in batch when the storage quantity reaches a preset value.
In the above database upgrading method, optionally, when the storage quantity reaches a preset value, executing the sql data in the queue to be executed in batch further includes: generating a failure record when the execution of the sql data fails; and saving the failure record to a preset execution error exception table.
In the above database upgrading method, optionally, the checking the consistency of the contents of the temporary table and the original table includes: and the content consistency of the temporary table and the original table is obtained by checking the execution error abnormal table, comparing the data quantity of the temporary table and the original table and comparing the data content consistency.
The present application further provides a database upgrading apparatus, the apparatus comprising: the system comprises a rule generation module, a data checking module, a data copying module, a service interception module and a temporary table correction module; the rule generating module is used for acquiring the version upgrading time of the database, constructing a temporary table at a preset period time point before the version upgrading time, and generating a replication rule according to the corresponding relation between the temporary table and an original table in the database; the data copying module is used for copying the data in the original table to the temporary table according to the copying rule; the service interception module is used for intercepting a service request for accessing an original table at the version upgrading time; the data checking module is used for checking the content consistency of the temporary table and the original table; and the temporary table correcting module is used for respectively modifying the table names of the temporary table and the original table according to the check result so as to replace the original table with the temporary table, and informing the service intercepting module of canceling the interception of the service request to finish the version upgrading of the database.
The present application further provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the computer program, the method is implemented.
The present application also provides a computer-readable storage medium storing a computer program for executing the above method.
The present application also provides a computer program product comprising computer programs/instructions which, when executed by a processor, implement the steps of the above-described method.
The beneficial technical effect of this application lies in: the universal system-level implementation scheme of the open platform is real-time copied and shut down in minutes, the shut down time of the core on-line service during production can be shortened, the influence of the shut down on customers is reduced, and the continuity of the core service is improved. The method has the advantages of simple flow, no relation to switching operation of different city standby libraries, guarantee of unchanged original architecture and reduction of manual intervention cost. The method has the advantages of uniform program, universality and configurable implementation, and only needs to configure the data table copying rule.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application, are incorporated in and constitute a part of this application, and are not intended to limit the application. In the drawings:
fig. 1 is a schematic flowchart of a database upgrading method according to an embodiment of the present application;
FIG. 2 is a schematic flow chart illustrating data replication provided by an embodiment of the present application;
FIG. 3 is a diagram illustrating incremental data replication provided by an embodiment of the present application;
FIG. 4 is a schematic diagram illustrating an application of a database upgrading method according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of a database upgrading apparatus according to an embodiment of the present application;
fig. 6 is a schematic application structure diagram of a database upgrading apparatus according to an embodiment of the present application;
FIG. 7 is a block diagram of a data replication module according to an embodiment of the present disclosure;
FIG. 8 is a block diagram of a data verification module according to an embodiment of the present application;
fig. 9 is a schematic structural diagram of a service interception module according to an embodiment of the present application;
fig. 10 is a schematic structural diagram of a temporary table rotation module according to an embodiment of the present application;
fig. 11 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The following detailed description will be provided with reference to the drawings and examples to explain how to apply the technical means to solve the technical problems and to achieve the technical effects. It should be noted that, as long as there is no conflict, the embodiments and the features of the embodiments in the present application may be combined with each other, and the technical solutions formed are all within the scope of the present application.
Additionally, the steps illustrated in the flowcharts of the figures may be performed in a computer system such as a set of computer-executable instructions, and while a logical order is illustrated in the flowcharts, in some cases, the steps illustrated or described may be performed in an order different than here.
Referring to fig. 1, a database upgrading method provided by the present application includes:
s101, acquiring version upgrading time of a database, constructing a temporary table at a preset period time point before the version upgrading time, and generating a replication rule according to a corresponding relation between the temporary table and an original table in the database;
s102, copying data in the original table to the temporary table according to the copying rule, intercepting a service request for accessing the original table at the version upgrading time, and checking the content consistency of the temporary table and the original table;
s103, respectively modifying the table names of the temporary table and the original table according to the check result to replace the original table with the temporary table, and canceling the interception of the service request to finish the version upgrade of the database.
Wherein checking the content consistency of the temporary table and the original table comprises: and the content consistency of the temporary table and the original table is obtained by checking the execution error abnormal table, comparing the data quantity of the temporary table and the original table and comparing the data content consistency. In the embodiment, the corresponding relation between the temporary table and the original table is established, the asynchronous migration of the original table data is realized based on the corresponding relation, and the one-key upgrading of the database can be realized only by modifying the name of the temporary table on the basis of finishing the consistency of the data of the temporary table and the original table; the process is simple on the basis of ensuring the continuity of database service, does not relate to the switching operation of different city standby databases, ensures the original architecture to be unchanged, and reduces the manual intervention cost. The method has the advantages of uniform program, universality and configurable implementation, and only needs to configure the data table copying rule.
Referring to fig. 2, in an embodiment of the present application, the copying data in the original table to the temporary table according to the copy rule includes:
s201, acquiring a data type in an original table, copying stock data in the original table to the temporary table through the copying rule according to the data type, and pushing incremental data in the original table to a cache queue;
s202, analyzing the incremental data in the buffer queue and synchronizing the incremental data to the temporary table through a back-up rule.
In this embodiment, the range of influence of the stock data and the range of influence of the incremental data are different, and therefore, the present application adopts two different ways to copy, where the buffer queue may be a card queue, and the specific back-filling rule will be described in detail in the following embodiments, and thus, detailed descriptions thereof are omitted. Referring to fig. 3 again, analyzing the incremental data in the buffer queue and synchronizing the incremental data to the temporary table according to the back-up rule includes:
s301, analyzing the incremental data in the cache queue into sql data, and calculating partition information where the sql data is executed;
s302, according to the partition information, the sql data are placed in a ring buffer by atomicity, and the sql data in the ring buffer are placed in a queue to be executed;
s303, the incremental data is synchronized to a temporary table through the queue to be executed.
In actual work, after the KAFKA cache queue message is pulled, data is analyzed into sql and a partition where the sql is executed is calculated, a KAFKA consumer performs atomic calculation and puts the calculation into a RingBuffer annular buffer area, the data is obtained from the RingBuffer and is put into a specified sql queue to be executed after Hash calculation, and the next pulling analysis is continued after the queue to be executed is distributed. When a large amount of data needs to be processed, all data cannot be stored due to limited memory capacity. The first treatment is performed, and the resources are released after the treatment and then the next treatment is performed, which causes insufficient resource utilization. The problem of poor processing efficiency between the kafka consumer and the analysis sql is solved through the buffer of the circular queue, the up-and-down connection does not need thread waiting, and the processing speed is improved.
In an embodiment of the present application, synchronizing the incremental data to a temporary table through the queue to be executed includes: and monitoring the storage quantity of the sql data in the queue to be executed, and executing the sql data in the queue to be executed in batch when the storage quantity reaches a preset value. Further, when the storage quantity reaches a preset value, executing the sql data in the queue to be executed in batch further comprises: generating a failure record when the execution of the sql data fails; and saving the failure record to a preset execution error exception table.
Specifically, in actual work, the limited-degree scraping SQL is executed, batch execution is carried out after the scraping is carried out for the specified number of SQL, if the execution is successful, the limited-degree scraping SQL is executed continuously, if the execution fails, split execution is carried out at a KAFKA recording level, after the split execution is successful, the limited-degree scraping SQL is executed continuously, and if the execution fails after the split execution, an abnormal data table is recorded; the exception table may record statistics sql execution count, KAFKA pull count, etc. If there is sql with failed execution, it will be saved in the table corresponding to the failure of execution sql, and the number of errors can be confirmed.
In order to make the foregoing embodiments provided in the present application more clearly understood, the following provides a general description of the database upgrading method provided in the present application in conjunction with the foregoing embodiments, and it should be understood by those skilled in the art that this description is only for assisting understanding of the application of the foregoing embodiments, and does not limit the application of the foregoing embodiments in any way.
Referring to fig. 4, the implementation flow of the database upgrading method is as follows:
step S401: creating a temporary table one week before version upgrading, creating a temporary table A 'in the master library, and establishing corresponding replication rules of the original table A and the new table A'.
Step S402: and synchronizing the stock data, and copying the stock data of the original table A to a temporary table A' through a data copying module.
Step S403: and (4) synchronizing incremental data, pushing the operation log of the original table A to KAFKA, consuming KAFKA information through a data analysis module, and synchronizing to the temporary table A' according to a back-up rule.
Step S404: and intercepting the service request for accessing the original table A by an interception module on the current date of version upgrading.
Step S405: and (4) confirming whether the copying of the original table A to the temporary table A' is completed or not, and checking the consistency of the total data and the field content.
Step S406: and (5) correcting the temporary table, namely renaming the original table A to be A.bak and renaming the temporary table to be A.
Step S407: and canceling service interception and recovering full-function service.
Referring to fig. 5, the present application further provides a database upgrading apparatus, including: the system comprises a rule generation module, a data checking module, a data copying module, a service interception module and a temporary table correction module; the rule generating module is used for acquiring the version upgrading time of the database, constructing a temporary table at a preset period time point before the version upgrading time, and generating a replication rule according to the corresponding relation between the temporary table and an original table in the database; the data copying module is used for copying the data in the original table to the temporary table according to the copying rule; the service interception module is used for intercepting a service request for accessing an original table at the version upgrading time; the data checking module is used for checking the content consistency of the temporary table and the original table; and the temporary table correcting module is used for respectively modifying the table names of the temporary table and the original table according to the check result so as to replace the original table with the temporary table, and informing the service intercepting module of canceling the interception of the service request to finish the version upgrade of the database.
Specifically, in actual operation, as shown in fig. 6, the database upgrading apparatus may include a stock quantity/incremental data copying operation 1, a data copying module 2, a data checking module 3, a service intercepting module 4, a temporary table correcting module 5, and a rule generating module (not shown). Stock/incremental data copy job 1: the application invokes the data copy module 2 through an instruction in a job mode to trigger data copy. And the data copying module 2 is used for pushing the old table operation records to a KAFKA queue by analyzing the binlog, and copying the old table operation records to a new table after processing the old table operation records according to the configured data table copying rule by consuming KAFKA queue information. And calling a data checking module 3 to check the data synchronization correctness, stopping table copying after the data synchronization correctness is checked, and starting a temporary table transfer operation 5. The data collation module 3: and checking the sql execution error exception table and checking the data quantity of the new and old tables and checking whether the data contents are consistent to confirm the synchronization result of the new table and the old table. Temporary watch correcting operation 5: and the application calls the service interception module 4 in an operation mode through an instruction, triggers service interception and intercepts service flow. And the service interception module 4 is used for invoking the data check module 3 to check the total data amount and the field content of the old table and the new table after the service interception is started. The temporary table correcting module 6 triggers the temporary table correcting after the data check is passed, triggers the service intercepting module 4 after the table renaming is finished, closes the interception and restores the application; the rule generating module may be separately configured in actual operation or may be disposed in the database upgrading apparatus, and the application is not limited herein.
Referring again to FIG. 7, in one embodiment of the present application, the data replication module 2 may comprise a data replication initiation interface 21, a parse binlog log module 22, a KAFKA message queue module 23, and a data write interface 24. The data copying starting interface 21 is an interactive interface opened to an application, and the application starts a data analysis end through a job command. Parse binlog log module 22: and pushing the operation log of the old table in the binlog log as a data source to KAFKA. KAFKA message queue module 23: after the database falling program draws the KAFKA message, the data is analyzed into sql and the partition where the sql is executed is calculated, the KAFKA consumer carries out atomic calculation and puts the data into RingBuffer, the data is obtained from the RingBuffer and is put into a specified sql queue to be executed after Hash calculation, and the next drawing analysis is continued after the queue to be executed is distributed. And then entering an SQL execution queue, performing limited-level SQL scraping, performing batch execution after scraping up enough SQL number, if the execution is successful, continuing to perform limited-level SQL scraping execution, if the execution fails, performing splitting execution at a KAFKA recording level, after the splitting execution is successful, continuing to perform limited-level SQL scraping execution, and if the execution fails, recording an abnormal data table. And synchronously monitoring the performance in the database falling process, wherein the performance comprises the statistics of sql execution number, KAFKA pulling number and the like. If the execution fails to execute the sql, the sql is saved in a table corresponding to the execution failure of the sql, and the number of errors can be confirmed. Data write interface module 24: and synchronizing the processed records of the old table to the new table according to the configured data table copy rule.
Referring to fig. 8, in an embodiment of the present application, the data checking module 3 may include an sql execution exception table checking module 31, a total data checking module 32, and a data content checking module 33. Check sql execution exception table module 31: if there is sql which fails to be executed in the data synchronization process, the standby sql is used for execution, if retry or failure occurs, the failed record is stored in an sql execution error table, if there is no data in the sql execution error table, it is indicated that the execution of sql is successful, and the data synchronization is successful. The check data total module 32: when the sql is not recorded in the error table, the total data amount and the field content are checked, and whether the total data amounts of the original table a and the temporary table a' are consistent or not is checked. The collation data content module 33: and checking whether the data is consistent with the data of each field of the original table A and the temporary table A' or not.
Referring to fig. 9, in an embodiment of the present application, the service interception module 4 may include a configuration interceptor module 51, an apollo configuration interception list module 52, an enable interception module 53, and a close interception module 54. And on the current date of version upgrading, starting a service interception module, intercepting the service flow, and suspending the operation of the database. Intercepting a service request accessing an original table, which is specifically realized as follows:
configuration interceptor module 51: configuring an interceptor in mybatis, specifically realizing pseudo codes as follows:
intercept list module 52: configuring interception table parameters in an Apollo configuration center, wherein the specific configuration is as follows:
1. and newly establishing a cmc namespace [ ] for storing a database interception table list.
2. The cmc interception table parameters are configured, and the specific configuration is described as follows:
(1) Intercept master switch ccps
(2) And newly adding a cmc parameter of a k-v type, wherein k is a name space of the mybatis mapper file, and v is random. If intercepting the operation of the A table, configuring Key as the name of the operation mapper of the table, value: the same as Key.
Enable intercept module 53: the operation of the intercepted table database is suspended, and when the service flow accesses the intercepted table, the operation can be directly prompted: persistence Exception: a during installation time, a lease ladder.
The intercept module 54 is turned off, the intercept master switch ccps.
Referring to fig. 10, in an embodiment of the present application, the temporary table correcting module 6 may include a temporary table correcting operation module 61 and a table renaming module 62.
Temporary watch correcting operation module 61: the application calls up the temporary table conversion operation through an instruction in a mode of operation to rename the table.
Table renaming module 62: and after the data check is passed, calling a database statement, renaming the original table A to be A.bak and the temporary table A' to be A, and realizing one-key correction of the temporary table. As follows:
RENAME TABLE`A`TO`A.bak`;
RENAME TABLE`A``TO`A`。
the beneficial technical effect of this application lies in: the universal system-level implementation scheme of the open platform is real-time copied and stopped in minutes, so that the core online service stopping time during production can be shortened, the influence of stopping on customers is reduced, and the core service continuity is improved. The method has the advantages of simple flow, no relation to switching operation of different city standby libraries, guarantee of unchanged original architecture and reduction of manual intervention cost. The method has the advantages of uniform program, universality and configurable implementation, and only needs to configure the data table copying rule.
The application also provides an electronic device, which comprises a memory, a processor and a computer program stored on the memory and capable of running on the processor, wherein the processor executes the computer program to realize the method.
The present application also provides a computer-readable storage medium storing a computer program for executing the above method.
The present application also provides a computer program product comprising computer programs/instructions which, when executed by a processor, implement the steps of the above-described method.
As shown in fig. 11, the electronic device 600 may further include: communication module 110, input unit 120, audio processing unit 130, display 160, power supply 170. It is noted that the electronic device 600 does not necessarily include all of the components shown in FIG. 11; in addition, the electronic device 600 may also include components not shown in fig. 11, which may be referred to in the prior art.
As shown in fig. 11, the central processor 100, sometimes referred to as a controller or operation control, may include a microprocessor or other processor device and/or logic device, the central processor 100 receiving input and controlling the operation of the various components of the electronic device 600.
The memory 140 may be, for example, one or more of a buffer, a flash memory, a hard drive, a removable media, a volatile memory, a non-volatile memory, or other suitable device. The information relating to the failure may be stored, and a program for executing the information may be stored. And the central processing unit 100 may execute the program stored in the memory 140 to realize information storage or processing, etc.
The input unit 120 provides input to the cpu 100. The input unit 120 is, for example, a key or a touch input device. The power supply 170 is used to provide power to the electronic device 600. The display 160 is used to display an object to be displayed, such as an image or a character. The display may be, for example, an LCD display, but is not limited thereto.
The memory 140 may be a solid state memory such as Read Only Memory (ROM), random Access Memory (RAM), a SIM card, or the like. There may also be a memory that holds information even when power is off, can be selectively erased, and is provided with more data, an example of which is sometimes called an EPROM or the like. The memory 140 may also be some other type of device. Memory 140 includes buffer memory 141 (sometimes referred to as a buffer). The memory 140 may include an application/function storage section 142, and the application/function storage section 142 is used to store application programs and function programs or a flow for executing the operation of the electronic device 600 by the central processing unit 100.
The memory 140 may also include a data store 143, the data store 143 for storing data, such as contacts, digital data, pictures, sounds, and/or any other data used by the electronic device. The driver storage portion 144 of the memory 140 may include various drivers of the electronic device for a communication function and/or for performing other functions of the electronic device (e.g., a messaging application, a directory application, etc.).
The communication module 110 is a transmitter/receiver 110 that transmits and receives signals via an antenna 111. The communication module (transmitter/receiver) 110 is coupled to the central processor 100 to provide an input signal and receive an output signal, which may be the same as in the case of a conventional mobile communication terminal.
Based on different communication technologies, a plurality of communication modules 110, such as a cellular network module, a bluetooth module, and/or a wireless local area network module, may be provided in the same electronic device. The communication module (transmitter/receiver) 110 is also coupled to a speaker 131 and a microphone 132 via an audio processor 130 to provide audio output via the speaker 131 and receive audio input from the microphone 132 to implement general telecommunications functions. Audio processor 130 may include any suitable buffers, decoders, amplifiers and so forth. In addition, an audio processor 130 is also coupled to the central processor 100, so that recording on the local can be enabled through a microphone 132, and so that sound stored on the local can be played through a speaker 131.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and so forth) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The above-mentioned embodiments are provided to further explain the objects, technical solutions and advantages of the present application in detail, and it should be understood that the above-mentioned embodiments are only examples of the present application and are not intended to limit the scope of the present application, and any modifications, equivalents, improvements and the like made within the spirit and principle of the present application should be included in the scope of the present application.
Claims (10)
1. A method for upgrading a database, the method comprising:
acquiring version upgrading time of a database, constructing a temporary table at a preset period time point before the version upgrading time, and generating a replication rule according to the corresponding relation between the temporary table and an original table in the database;
copying data in the original table to the temporary table according to the copying rule, intercepting a service request for accessing the original table at the version upgrading time, and checking the content consistency of the temporary table and the original table;
and respectively modifying the table names of the temporary table and the original table according to the check result to replace the original table with the temporary table, and canceling the interception of the service request to finish the version upgrade of the database.
2. The database upgrading method according to claim 1, wherein copying the data in the original table to the temporary table according to the copy rule comprises:
acquiring a data type in an original table, copying stock data in the original table to the temporary table through the copying rule according to the data type, and pushing incremental data in the original table to a cache queue;
and analyzing the incremental data in the buffer queue and synchronizing the incremental data to the temporary table through a back-up rule.
3. The database upgrading method according to claim 2, wherein parsing the incremental data in the buffer queue and synchronizing the incremental data to the temporary table by a back-filling rule comprises:
analyzing the incremental data in the cache queue into sql data, and calculating partition information of execution of the sql data;
according to the partition information, placing the sql data into a ring buffer area through atomicity, and placing the sql data in the ring buffer area into a queue to be executed;
and synchronizing the incremental data to a temporary table through the queue to be executed.
4. The database upgrading method according to claim 3, wherein synchronizing the incremental data to a temporary table through the queue to be executed comprises:
monitoring the storage quantity of the sql data in the queue to be executed, and executing the sql data in the queue to be executed in batch when the storage quantity reaches a preset value.
5. The database upgrading method according to claim 4, wherein executing the sql data in the queue to be executed in batch when the deposit quantity reaches a preset value further comprises:
generating a failure record when the execution of the sql data fails;
and saving the failure record to a preset execution error exception table.
6. The database upgrading method of claim 1, wherein checking the temporary table for consistency with the original table comprises:
and the content consistency of the temporary table and the original table is obtained by checking the execution error exception table, comparing the data quantity of the temporary table and the original table and comparing the data content consistency.
7. An apparatus for upgrading a database, the apparatus comprising: the system comprises a rule generation module, a data checking module, a data copying module, a service interception module and a temporary table correction module;
the rule generating module is used for acquiring the version upgrading time of the database, constructing a temporary table at a preset period time point before the version upgrading time, and generating a replication rule according to the corresponding relation between the temporary table and an original table in the database;
the data copying module is used for copying the data in the original table to the temporary table according to the copying rule;
the service interception module is used for intercepting a service request for accessing an original table at the version upgrading time;
the data checking module is used for checking the content consistency of the temporary table and the original table;
and the temporary table correcting module is used for respectively modifying the table names of the temporary table and the original table according to the check result so as to replace the original table with the temporary table, and informing the service intercepting module of canceling the interception of the service request to finish the version upgrade of the database.
8. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the method of any of claims 1 to 6 when executing the computer program.
9. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program for executing the method of any one of claims 1 to 6 by a computer.
10. A computer program product comprising computer program/instructions, characterized in that the computer program/instructions, when executed by a processor, implement the steps of the method of any of claims 1 to 6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211160262.5A CN115495436A (en) | 2022-09-22 | 2022-09-22 | Database upgrading method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211160262.5A CN115495436A (en) | 2022-09-22 | 2022-09-22 | Database upgrading method and device |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115495436A true CN115495436A (en) | 2022-12-20 |
Family
ID=84470360
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211160262.5A Pending CN115495436A (en) | 2022-09-22 | 2022-09-22 | Database upgrading method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115495436A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115827789A (en) * | 2023-02-21 | 2023-03-21 | 苏州浪潮智能科技有限公司 | Method, system, equipment and storage medium for optimizing file type database upgrading |
-
2022
- 2022-09-22 CN CN202211160262.5A patent/CN115495436A/en active Pending
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115827789A (en) * | 2023-02-21 | 2023-03-21 | 苏州浪潮智能科技有限公司 | Method, system, equipment and storage medium for optimizing file type database upgrading |
CN115827789B (en) * | 2023-02-21 | 2023-06-09 | 苏州浪潮智能科技有限公司 | File type database upgrading optimization method, system, equipment and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108628874B (en) | Method and device for migrating data, electronic equipment and readable storage medium | |
US20180336022A1 (en) | Upgrading systems with replicated data | |
CN110321339B (en) | Data migration method, device, equipment and storage medium | |
CN108614876B (en) | Redis database-based system and data processing method | |
CN111752901A (en) | Index creation method and device, electronic equipment and storage medium | |
CN112783868A (en) | Distributed database table structure gray scale upgrading method, device and system | |
CN112434008A (en) | Distributed database upgrading method, device and medium | |
CN111949614A (en) | Bank system file conversion method and device | |
CN115495436A (en) | Database upgrading method and device | |
CN112860697A (en) | Distributed database table structure changing method, device and system | |
CN112181723A (en) | Financial disaster recovery method and device, storage medium and electronic equipment | |
CN114942965A (en) | Method and system for accelerating synchronous operation of main database and standby database | |
CN115292408A (en) | Master-slave synchronization method, device, equipment and medium for MySQL database | |
CN113157670B (en) | Data migration method and system of database | |
CN105938446B (en) | The data supported based on RDMA and hardware transactional memory replicate fault-tolerance approach | |
CN111930843B (en) | Database-based data system and processing method | |
CN112069152A (en) | Database cluster upgrading method, device, equipment and storage medium | |
CN110377298B (en) | Distributed cluster upgrading method and distributed cluster | |
CN109376141A (en) | A kind of data migration method and device | |
CN110569231B (en) | Data migration method, device, equipment and medium | |
CN113934575A (en) | Big data backup system and method based on distributed copy | |
CN108733704B (en) | Multi-database data processing method and device, storage medium and electronic equipment | |
CN109446212B (en) | Dual-active host system switching method and system | |
CN113505177A (en) | Distributed system cluster online fragmentation and capacity expansion method and device | |
WO2021254280A1 (en) | Disk mounting method and device, storage medium, and electronic device |
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 |