[go: up one dir, main page]

CN120215994A - A database upgrade method - Google Patents

A database upgrade method Download PDF

Info

Publication number
CN120215994A
CN120215994A CN202510271984.5A CN202510271984A CN120215994A CN 120215994 A CN120215994 A CN 120215994A CN 202510271984 A CN202510271984 A CN 202510271984A CN 120215994 A CN120215994 A CN 120215994A
Authority
CN
China
Prior art keywords
engine
transaction
old
database
version
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.)
Granted
Application number
CN202510271984.5A
Other languages
Chinese (zh)
Other versions
CN120215994B (en
Inventor
刘超
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Qianze Technology Co ltd
Original Assignee
Beijing Qianze Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Qianze Technology Co ltd filed Critical Beijing Qianze Technology Co ltd
Priority to CN202510271984.5A priority Critical patent/CN120215994B/en
Publication of CN120215994A publication Critical patent/CN120215994A/en
Application granted granted Critical
Publication of CN120215994B publication Critical patent/CN120215994B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • G06F8/656Updates while running
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/21Design, administration or maintenance of databases
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • G06F16/2308Concurrency control
    • G06F16/2336Pessimistic concurrency control approaches, e.g. locking or multiple versions without time stamps
    • G06F16/2343Locking methods, e.g. distributed locking or locking implementation details
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • G06F16/2358Change logging, detection, and notification
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • G06F16/2365Ensuring data consistency and integrity
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • G06F16/2379Updates performed during online database operations; commit processing
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • G06F16/273Asynchronous replication or reconciliation
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5016Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • G06F9/505Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the load
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/544Buffers; Shared memory; Pipes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0803Configuration setting
    • H04L41/0823Configuration setting characterised by the purposes of a change of settings, e.g. optimising configuration for enhancing reliability
    • H04L41/0836Configuration setting characterised by the purposes of a change of settings, e.g. optimising configuration for enhancing reliability to enhance reliability, e.g. reduce downtime
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0894Policy-based network configuration management
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0896Bandwidth or capacity management, i.e. automatically increasing or decreasing capacities
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/22Traffic shaping
    • H04L47/225Determination of shaping rate, e.g. using a moving window
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/30Flow control; Congestion control in combination with information about buffer occupancy at either end or at transit nodes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/70Admission control; Resource allocation
    • H04L47/76Admission control; Resource allocation using dynamic resource allocation, e.g. in-call renegotiation requested by the user or requested by the network in response to changing network conditions
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1095Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
    • H04L67/63Routing a service request depending on the request content or context

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Software Systems (AREA)
  • Signal Processing (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Data Mining & Analysis (AREA)
  • Computer Security & Cryptography (AREA)
  • Computing Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention relates to the technical field of database analysis, in particular to a database upgrading method, which comprises the steps of establishing a dual-engine parallel environment, starting new and old version database engines, constructing a cross-version communication channel, responding to the established communication channel, carrying out parallel routing on a client request to the new and old engines through a transaction distributor, analyzing data change characteristics in real time and generating an increment synchronous instruction set based on a transaction operation log generated by the old engine, carrying out version coordinated transaction lock management when the new engine carries out data replay according to the generated increment synchronous instruction set, switching the transaction route to the new engine and closing the old engine writing channel after the data consistency verification of a preset period is completed, and realizing the aims of uninterrupted service and strong data consistency in the database version upgrading process through dual-engine parallel processing, increment data synchronization and cross-version lock coordination mechanisms.

Description

Database upgrading method
Technical Field
The invention relates to the technical field of database analysis, in particular to a database upgrading method.
Background
Conventional database version upgrade schemes generally face the dual challenges of poor service continuity and data consistency risks. In the prior art, the adoption of the shutdown migration mode can cause interruption of key business, and particularly in the scenes with high real-time requirements such as financial transactions, the internet of things and the like, the shutdown per hour can cause millions of economic losses. Although the online hot upgrading method reduces the downtime, the online hot upgrading method is limited by a serial processing mechanism of a single engine architecture, and still has the problems of long data migration window period, poor cross-version transaction compatibility and the like, and is extremely easy to cause data loss or inconsistent state. When large-scale data table structure changes or storage engine replacement are involved, the traditional scheme lacks an effective concurrency control means, and service response delay is often caused by too coarse lock granularity or inter-version deadlock is generated during fine-granularity lock management.
In addition, the static resource allocation strategy is difficult to cope with dynamic fluctuation of new and old engine loads in the upgrading process, and resource idling and bottleneck coexistence are easy to cause. In the prior art, data verification mostly adopts post-hoc full-quantity comparison, and incremental difference cannot be captured in real time, so that rollback decision is lagged. These drawbacks severely limit the usability and upgrade reliability of critical business systems.
Disclosure of Invention
The present invention is directed to a method for upgrading a database, so as to solve the problems set forth in the background art.
In order to achieve the above purpose, the invention provides a method for upgrading a database, comprising the following steps:
s1, establishing a dual-engine parallel environment, starting an engine of a new version database and an old version database, and constructing a cross-version communication channel;
S2, responding to the communication channel established in the step S1, and parallelly routing the client request to the new engine and the old engine for execution through the transaction distributor;
s3, analyzing data change characteristics in real time based on the transaction operation log generated by the old engine in the step S2 and generating an increment synchronization instruction set;
s4, implementing version coordinated transaction lock management when the new engine performs data replay according to the increment synchronous instruction set generated in the step S3;
S5, switching transaction routes to a new engine and closing an old engine writing channel after finishing data consistency verification of a preset period in the step S4, wherein the steps S1 to S5 realize the aims of uninterrupted service and strong data consistency in the process of upgrading the database version through double-engine parallel processing, incremental data synchronization and cross-version lock coordination mechanisms.
As a further improvement of the present technical solution, the process of S1 specifically includes:
The method comprises the steps of deploying new and old version database examples in parallel in a computing cluster, distributing initial computing resources, setting a load sensing probe, and acquiring performance indexes of double engines according to the load sensing probe, wherein the performance indexes of the double engines comprise CPU utilization rate;
Establishing a bidirectional data pipeline comprising a multi-stage buffer queue, wherein the buffer queue comprises urgent, common and batch three-stage queues;
And triggering resource rebalancing according to the CPU utilization difference threshold value, and dynamically adjusting network bandwidth allocation based on the buffer filling rate.
As a further improvement of the present technical solution, the performing operation by the transaction distributor in S2 includes:
And performing double-engine synchronous execution and result comparison on the write operation, triggering the transaction rollback and recording the exception when the difference exceeds a preset threshold value.
As a further improvement of the present technical solution, the process of S3 specifically includes:
Analyzing the transaction operation log into an atomization data changing unit;
and merging according to the table dimension to generate a batch operation instruction set containing operation sequence constraint as an increment synchronization instruction set.
As a further improvement of the present technical solution, the transaction lock management in S4 includes dynamically selecting a lock policy according to an operation feature in the incremental synchronization instruction set, and specifically includes:
Dynamically selecting a table level lock and a row level lock according to the operation characteristics;
setting a lock timeout mechanism dynamically matched with the instruction execution time;
the dual engine lock state is synchronized through the cross-version communication channel.
As a further improvement of the present technical solution, the synchronous dual engine lock state includes:
when the double engines request the exclusive lock on the same resource, the old version lock is automatically released according to the preset priority;
allowing dual engines to simultaneously lock the same resource, supporting parallel reads.
As a further improvement of the present technical solution, the data consistency verification of the preset period includes:
Executing full data comparison and incremental change real-time comparison in a preset period;
Setting a fault tolerance threshold of consistency, and terminating the verification process when the fault tolerance threshold of consistency is exceeded.
As a further improvement of the present technical solution, the process of S5 specifically includes:
Suspending writing operation, switching transaction route and closing writing authority of old engine by stages;
Retaining an old engine reading function for monitoring verification after the switching;
and releasing the related network bandwidth of the old engine and performing new engine performance tuning.
As a further improvement of the present technical solution, the process of triggering resource rebalancing according to CPU utilization difference threshold specifically includes:
The method comprises the steps of acquiring CPU utilization rate indexes of the dual engines in real time, periodically calculating the difference value of the two indexes and comparing the difference value with a preset CPU utilization rate difference threshold, dynamically calculating a resource redistribution proportion by using a feedback control model based on the load weight coefficient of the current dual engines and the transaction priority when the difference value exceeds the CPU utilization rate difference threshold, and sending a quota adjustment instruction to a resource scheduler according to the distribution proportion, wherein the resource redistribution proportion is used for guaranteeing basic resource supply of the high-load engine preferentially.
As a further improvement of the present technical solution, the process of dynamically adjusting network bandwidth allocation based on the buffer filling rate specifically includes:
And monitoring the filling rate of the buffer area in real time, dynamically calculating the bandwidth allocation proportion according to the current load and the increasing trend when the filling rate threshold value of the buffer area is reached, optimizing the transmission parameters by utilizing a sliding window algorithm, and adjusting the bandwidth weight of each channel in real time by a flow controller to form a dynamic adaptation mechanism of the capacity of the buffer area and the network resources.
Compared with the prior art, the invention has the beneficial effects that:
The method for upgrading the database realizes zero business interruption in the process of upgrading the database through a dual-engine parallel processing architecture, combines a cross-version communication channel and an intelligent transaction distribution mechanism, ensures compatibility and integrity of a new version engine and a old version engine for cooperatively executing a transaction, generates a synchronous instruction set based on a transaction operation log analyzed in real time by an incremental data synchronization technology, cooperates with dynamic lock policy management, effectively reduces the risk of data conflict between versions, and ensures stable system throughput during upgrading by dynamically adapting network bandwidth and computing resources through a multistage buffer queue and a load-aware resource distribution mechanism.
In addition, through the consistency verification flow combining the full quantity and the increment, the data difference is rapidly identified in a preset period, the fault tolerance processing is triggered, the old engine reading function is reserved for abnormal rollback verification, and the whole scheme obviously improves the resource utilization efficiency and the system reliability in the upgrading process on the basis of ensuring the strong consistency of the data, and provides smooth upgrading guarantee for the key business system.
Drawings
FIG. 1 is a schematic diagram of the method steps of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are only some, but not all embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Referring to fig. 1, the present invention provides a method for upgrading a database, comprising the following steps:
s1, a dual-engine parallel environment is established, an new version database engine and an old version database engine are started, and a cross-version communication channel is constructed, and the method specifically comprises the following steps:
the method comprises the steps of deploying new and old version database examples in parallel in a computing cluster, distributing initial computing resources (CPU core number, memory quota and storage volume) for the double engines, starting a load sensing probe, and collecting performance indexes of the double engines in real time, wherein the double engines represent the new and old version database engines;
establishing a bidirectional data pipeline, realizing cross-version data interaction between double engines, and setting a multi-level buffer queue, wherein the multi-level buffer queue comprises emergency, common and batch three-level queues;
Dynamically monitoring channel key indexes according to a bidirectional data pipeline, wherein the channel key indexes comprise buffer area filling rate, and the buffer area filling rate directly reflects quantization indexes of channel load states and is used for triggering dynamic bandwidth adjustment;
Periodically calculating the CPU utilization difference of the dual engines, triggering resource rebalancing when the difference exceeds a set threshold, and adjusting the resource quota of each engine according to a dynamic algorithm, wherein the resource rebalancing is triggered according to the CPU utilization difference threshold, and the method specifically comprises the following steps:
Periodically calculating the difference value of the two CPU utilization indexes by acquiring the double-engine CPU utilization index in real time and comparing the difference value with a preset CPU utilization difference value threshold; when the difference value exceeds the CPU utilization ratio difference value threshold value, dynamically calculating a resource redistribution proportion by using a feedback control model based on the current load weight coefficient and transaction processing priority of the dual engine, and using the feedback control model to preferentially ensure the basic resource supply of the high-load engine;
when the buffer filling rate of the bidirectional data pipeline is increased to a preset level, the network bandwidth allocation is automatically and proportionally increased, the self-adaptive supply capacity of channel resources is embodied, and the method specifically comprises the following steps:
By monitoring the change of the filling rate of the data buffer area in real time, when the filling rate is detected to exceed a preset buffer area filling rate threshold value, dynamically constructing a bandwidth allocation model based on the current network load state and the buffer area growth trend, and preferentially increasing the bandwidth quota for the high-filling rate buffer area channel;
And simultaneously, by combining historical transmission efficiency data, calculating the optimal bandwidth proportion by utilizing a sliding window algorithm, and adjusting the bandwidth allocation weight of each channel in real time by a flow controller to form a dynamic balance mechanism of buffer capacity and network resource supply, so that overflow or idle state of the buffer is effectively prevented, and the data transmission efficiency is continuously optimized.
The established communication channel realizes real-time data interaction and resource dynamic coordination between new and old engines through the bidirectional data pipeline and the multi-stage buffer queue, ensures that the double engines keep cooperative working capacity under load fluctuation, and provides infrastructure support for bidirectional flow control and data consistency guarantee in the subsequent stage.
S2, responding to the communication channel established in the step S1, and routing the client request to the new and old engines for execution through the transaction distributor, wherein the method specifically comprises the following steps:
Identifying the transaction type (query, update or structure change) of the client request, and extracting key characteristics (such as SQL operation mode and table object version dependence);
The real-time service capability index of the double engines is calculated by combining the CPU utilization rate and buffer filling rate of the double engines monitored in the S1 stage;
The write operation is simultaneously sent to the double engine for execution, the results returned by the double engines are compared field by field, when the time consumption difference of the double engine execution exceeds a preset threshold value, the transaction rollback is triggered and the exception is recorded, and the consistency of the operation is ensured through the result comparison;
In older versions of database engines, a log of transactional operations is recorded whenever a transactional operation (such as a query, update, or structure change) occurs. The log contains detailed information of the transaction, and the log collector such as Fluentd, logstash can read and forward the log file in real time by collecting the transaction operation log from the old version database engine in real time through the log collecting tool or agent program.
S3, analyzing the data change characteristics in real time and generating an increment synchronization instruction set based on the transaction operation log generated by the old engine in the step S2, wherein the method specifically comprises the following steps:
Continuously collecting a transaction operation log generated by an old version in the double engine, and analyzing log entries in the transaction operation log into an atomization data change unit;
Merging the analyzed atomization data change units into batch operation instructions according to the table dimension, and marking operation sequence constraint in the generated synchronous instruction set to serve as an increment synchronous instruction set.
S4, according to the increment synchronous instruction set generated in the step S3, implementing version coordination transaction lock management when the new engine performs data replay, and specifically comprising the following steps:
s4.1, dynamically selecting a lock strategy according to operation characteristics (such as batch writing and single-row updating) marked in the increment synchronous instruction set generated in the S3, wherein:
the table level lock is suitable for structure change or whole table data migration, and locks the whole table to ensure the atomicity of operation;
a row-level lock, which is used for locking only a target data row aiming at single-row data operation and maximizing concurrency performance;
And a lock timeout mechanism, namely setting the upper limit of the holding time of the lock, and dynamically matching with the estimated execution time of the instruction to prevent deadlock or long-term blockage.
S4.2, synchronizing the lock state (such as lock type, lock range and holding time) held by the old version in the double engine to the new version in real time through the cross-version communication channel established in the S1 stage, wherein:
When the dual engines request mutual exclusion locks on the same resource, the old version locks are automatically released according to preset priority (new version priority);
allowing the double engines to simultaneously add a shared lock to the same resource, and supporting parallel reading;
S4.3, defining a preset time period (such as 24 hours, 48 hours and the like), continuously verifying data consistency in the period, and performing full data comparison once when the verification period starts to ensure that all tables and data in the new and old engines are completely consistent;
in the verification period, continuously monitoring and recording incremental data changes of the new engine and the old engine, and performing real-time comparison, including transaction log analysis, data synchronization instruction set generation, real-time comparison and consistency judgment, wherein:
transaction log analysis, namely continuously collecting transaction operation logs generated by old versions in the double engines, and analyzing log entries into an atomization data change unit;
Merging the analyzed atomization data change units into batch operation instructions according to the table dimension, and marking operation sequence constraint in the generated synchronization instruction set;
real-time comparison, namely comparing the increment synchronous instruction executed by the new engine with the actual data of the old engine in real time to ensure that each change is correct and error-free;
Consistency determination defining a fault tolerance threshold for data consistency, such as a maximum allowable number or proportion of inconsistencies, continuously monitoring the number or proportion of inconsistencies during a verification period, and stopping the verification process immediately upon exceeding a set threshold.
S5, after finishing data consistency verification of a preset period in the step S4, switching a transaction route to a new engine and closing an old engine writing channel, namely executing write operation suspension, transaction route switching and old engine writing authority closing in stages, reserving an old engine reading function for monitoring verification after switching, releasing the related network bandwidth of the old engine and performing new engine performance tuning, wherein the specific steps comprise:
suspending write operation requests of all clients to ensure that no new data change occurs;
stopping sending the write operation to the operation modes executed by the two new and old engines simultaneously, wherein all read-write requests are temporarily suspended;
Modifying the configuration of the transaction distributor so that it only routes all subsequent transaction requests (including reads and writes) to the new version database engine;
after confirming that the new engine can independently process all types of operation requests, setting the new engine into an exclusive mode, wherein the new engine bears all workloads;
The write permission of the old engine is cut off to prevent any accidental data writing, but still retain its read function for a period of time to facilitate monitoring and verification.
The part of the bidirectional data pipeline relevant to the old engine is removed, network bandwidth and other resources which are not used any more are released, and simultaneously, the new engine is subjected to performance tuning.
The foregoing has shown and described the basic principles, principal features and advantages of the invention. It will be understood by those skilled in the art that the present invention is not limited to the above-described embodiments, and that the above-described embodiments and descriptions are only preferred embodiments of the present invention, and are not intended to limit the invention, and that various changes and modifications may be made therein without departing from the spirit and scope of the invention as claimed. The scope of the invention is defined by the appended claims and equivalents thereof.

Claims (10)

1.一种数据库的升级方法,其特征在于,其方法步骤如下:1. A method for upgrading a database, characterized in that the method steps are as follows: S1、建立双引擎并行环境,启动新旧版本数据库引擎并构建跨版本通信通道;S1. Establish a dual-engine parallel environment, start the old and new versions of the database engine, and build a cross-version communication channel; S2、响应于步骤S1建立的通信通道,通过事务分发器将客户端请求并行路由至新旧引擎执行;S2, in response to the communication channel established in step S1, routing the client request to the new and old engines for execution in parallel through the transaction distributor; S3、基于步骤S2中旧引擎产生的事务操作日志,实时解析数据变更特征并生成增量同步指令集;S3. Based on the transaction operation log generated by the old engine in step S2, the data change characteristics are analyzed in real time and an incremental synchronization instruction set is generated; S4、根据步骤S3生成的增量同步指令集,在新引擎执行数据重放时实施版本协调的事务锁管理;S4. According to the incremental synchronization instruction set generated in step S3, version coordinated transaction lock management is implemented when the new engine executes data replay; S5、当步骤S4完成预设周期的数据一致性验证后,切换事务路由至新引擎并关闭旧引擎写入通道;所述步骤S1至S5通过双引擎并行处理、增量数据同步和跨版本锁协调机制,使数据库版本升级过程中服务能够不中断且数据保持强一致性。S5. After step S4 completes the data consistency verification for the preset period, switch the transaction routing to the new engine and close the old engine write channel; steps S1 to S5 use dual-engine parallel processing, incremental data synchronization and cross-version lock coordination mechanism to ensure that the service is not interrupted and the data maintains strong consistency during the database version upgrade process. 2.根据权利要求1所述的数据库的升级方法,其特征在于,所述S1的过程具体包括:2. The database upgrade method according to claim 1, characterized in that the process of S1 specifically includes: 在计算集群中并行部署新旧版本数据库实例,分配初始计算资源并设置负载感知探针,根据负载感知探针采集双引擎的性能指标,其中双引擎的性能指标包括CPU利用率;Deploy the old and new versions of database instances in parallel in the computing cluster, allocate initial computing resources and set up load-aware probes. Collect the performance indicators of the dual engines based on the load-aware probes, including CPU utilization. 建立包含多级缓冲队列的双向数据管道,所述缓冲队列包括紧急、普通和批量三级队列;根据双向数据管道动态监控通道关键指标,其中通道关键指标包括缓冲区填充率;Establishing a bidirectional data pipeline including a multi-level buffer queue, wherein the buffer queue includes three levels of queues: emergency, ordinary, and batch; dynamically monitoring channel key indicators according to the bidirectional data pipeline, wherein the channel key indicators include a buffer fill rate; 根据CPU利用率差异阈值触发资源再平衡,基于缓冲区填充率动态调整网络带宽分配。Resource rebalancing is triggered based on CPU utilization difference thresholds, and network bandwidth allocation is dynamically adjusted based on buffer fill rates. 3.根据权利要求1所述的数据库的升级方法,其特征在于,所述S2中事务分发器执行操作包括:3. The database upgrade method according to claim 1, wherein the transaction distributor in S2 performs the following operations: 对写操作进行双引擎同步执行及结果比对,差异超过预设阈值时触发事务回滚并记录异常。The write operation is executed synchronously by two engines and the results are compared. When the difference exceeds the preset threshold, the transaction is rolled back and the exception is recorded. 4.根据权利要求1所述的数据库的升级方法,其特征在于,所述S3的过程具体包括:4. The database upgrade method according to claim 1, characterized in that the process of S3 specifically includes: 将事务操作日志解析为原子化数据变更单元;Parse transaction operation logs into atomic data change units; 按表维度合并生成包含操作顺序约束的批量操作指令集,作为增量同步指令集。A batch operation instruction set containing operation order constraints is generated by merging table dimensions as an incremental synchronization instruction set. 5.根据权利要求1所述的数据库的升级方法,其特征在于,所述S4中事务锁管理包括根据增量同步指令集中的操作特征动态选择锁策略,具体包括:5. The database upgrade method according to claim 1, characterized in that the transaction lock management in S4 includes dynamically selecting a lock strategy according to the operation characteristics in the incremental synchronization instruction set, specifically including: 根据操作特征动态选择表级锁和行级锁;Dynamically select table-level locks and row-level locks based on operation characteristics; 设置与指令执行时间动态匹配的锁超时机制;Set a lock timeout mechanism that dynamically matches the instruction execution time; 通过跨版本通信通道同步双引擎锁状态。The dual-engine lock status is synchronized through the cross-version communication channel. 6.根据权利要求5所述的数据库的升级方法,其特征在于,所述同步双引擎锁状态包括:6. The database upgrade method according to claim 5, characterized in that the synchronous dual-engine lock state includes: 当双引擎对同一资源请求互斥锁时,依据预设优先级自动释放旧版本锁;When two engines request a mutex lock for the same resource, the old version lock is automatically released according to the preset priority; 允许双引擎同时对同一资源加共享锁,支持并行读取。Allows dual engines to add shared locks to the same resource at the same time, supporting parallel reading. 7.根据权利要求1所述的数据库的升级方法,其特征在于,所述预设周期的数据一致性验证包括:7. The database upgrade method according to claim 1, wherein the data consistency verification of the preset period comprises: 在预设周期内执行全量数据对比和增量变更实时比对;Perform full data comparison and real-time comparison of incremental changes within a preset period; 设置一致性的容错阈值,超过一致性的容错阈值时终止验证流程。Set a consistency tolerance threshold and terminate the verification process when the consistency tolerance threshold is exceeded. 8.根据权利要求1所述的数据库的升级方法,其特征在于,所述S5的过程具体包括:8. The database upgrade method according to claim 1, characterized in that the process of S5 specifically includes: 分阶段执行写操作挂起、事务路由切换和旧引擎写入权限关闭;Suspending write operations, switching transaction routing, and shutting down old engine write permissions are performed in stages; 在切换后保留旧引擎读取功能用于监控验证;Keep the old engine reading function for monitoring verification after switching; 释放旧引擎相关网络带宽并进行新引擎性能调优。Release the network bandwidth related to the old engine and perform performance tuning for the new engine. 9.根据权利要求2所述的数据库的升级方法,其特征在于,所述根据CPU利用率差异阈值触发资源再平衡的过程具体包括:9. The database upgrade method according to claim 2, wherein the process of triggering resource rebalancing according to the CPU utilization difference threshold specifically comprises: 通过实时采集双引擎CPU利用率指标,周期性地计算两者的差值并与预设CPU利用率差值阈值进行比对;当差值超过CPU利用率差值阈值时,基于当前双引擎的负载权重系数和事务处理优先级,运用反馈控制模型动态计算资源再分配比例,用于优先保证高负载引擎的基础资源供给;根据分配比例向资源调度器发送配额调整指令。By collecting dual-engine CPU utilization indicators in real time, the difference between the two is periodically calculated and compared with the preset CPU utilization difference threshold; when the difference exceeds the CPU utilization difference threshold, based on the current dual-engine load weight coefficient and transaction processing priority, the feedback control model is used to dynamically calculate the resource reallocation ratio to prioritize the basic resource supply of the high-load engine; and a quota adjustment instruction is sent to the resource scheduler based on the allocation ratio. 10.根据权利要求2所述的数据库的升级方法,其特征在于,所述基于缓冲区填充率动态调整网络带宽分配的过程具体包括:10. The database upgrade method according to claim 2, wherein the process of dynamically adjusting network bandwidth allocation based on buffer fill rate specifically comprises: 实时监测缓冲区填充率,当达到预设缓冲区填充率阈值时,根据当前负载和增长趋势动态计算带宽分配比例,利用滑动窗口算法优化传输参数,通过流量控制器实时调整各通道带宽权重,形成缓冲区容量与网络资源的动态适配机制。Monitor the buffer fill rate in real time. When the preset buffer fill rate threshold is reached, dynamically calculate the bandwidth allocation ratio based on the current load and growth trend, optimize the transmission parameters using the sliding window algorithm, and adjust the bandwidth weight of each channel in real time through the traffic controller to form a dynamic adaptation mechanism between buffer capacity and network resources.
CN202510271984.5A 2025-03-07 2025-03-07 Database upgrading method Active CN120215994B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202510271984.5A CN120215994B (en) 2025-03-07 2025-03-07 Database upgrading method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202510271984.5A CN120215994B (en) 2025-03-07 2025-03-07 Database upgrading method

Publications (2)

Publication Number Publication Date
CN120215994A true CN120215994A (en) 2025-06-27
CN120215994B CN120215994B (en) 2025-08-12

Family

ID=96102000

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202510271984.5A Active CN120215994B (en) 2025-03-07 2025-03-07 Database upgrading method

Country Status (1)

Country Link
CN (1) CN120215994B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6351753B1 (en) * 1998-02-20 2002-02-26 At&T Corp. Method and apparatus for asynchronous version advancement in a three version database
CN105122241A (en) * 2013-03-15 2015-12-02 亚马逊科技公司 Database system with database engine and independent distributed storage service
CN107077495A (en) * 2014-10-19 2017-08-18 微软技术许可有限责任公司 High performance transaction in data base management system
CN113722052A (en) * 2021-08-23 2021-11-30 华中科技大学 Nonvolatile memory updating method based on data double versions
CN118733604A (en) * 2024-09-03 2024-10-01 天翼视联科技有限公司 A database updating method, device, electronic device and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6351753B1 (en) * 1998-02-20 2002-02-26 At&T Corp. Method and apparatus for asynchronous version advancement in a three version database
CN105122241A (en) * 2013-03-15 2015-12-02 亚马逊科技公司 Database system with database engine and independent distributed storage service
CN107077495A (en) * 2014-10-19 2017-08-18 微软技术许可有限责任公司 High performance transaction in data base management system
CN113722052A (en) * 2021-08-23 2021-11-30 华中科技大学 Nonvolatile memory updating method based on data double versions
CN118733604A (en) * 2024-09-03 2024-10-01 天翼视联科技有限公司 A database updating method, device, electronic device and storage medium

Also Published As

Publication number Publication date
CN120215994B (en) 2025-08-12

Similar Documents

Publication Publication Date Title
Luo et al. On performance stability in LSM-based storage systems (extended version)
CN110362390B (en) Distributed data integration job scheduling method and device
CN111597015B (en) Transaction processing method and device, computer equipment and storage medium
CN104915407B (en) A kind of resource regulating method based under Hadoop multi-job environment
CN104407926B (en) A kind of dispatching method of cloud computing resources
CN112068934B (en) Control system and method for shrinking container cloud service instance
CN110781244B (en) Method and device for controlling concurrent operation of database
CN108491159B (en) A checkpoint data writing method for massively parallel systems based on random delays to alleviate I/O bottlenecks
CN117032974A (en) Dynamic scheduling method and terminal based on resource application
CN109241194A (en) The load-balancing method and device of Database Systems based on High-Performance Computing Cluster distribution
CN119739498A (en) Intelligent resource scheduling and dynamic data priority management method and system
CN106557492A (en) A kind of method of data synchronization and device
CN111737226B (en) A method for optimizing HBase cluster performance based on Redis cluster
WO2022266975A1 (en) Method for millisecond-level accurate slicing of time series stream data
Zheng et al. Lion: Minimizing distributed transactions through adaptive replica provision
CN120215994B (en) Database upgrading method
CN114297002A (en) A method and system for mass data backup based on object storage
Zhuang et al. Geotp: Latency-aware geo-distributed transaction processing in database middlewares (extended version)
Zhang et al. Online nonstop task management for storm-based distributed stream processing engines
CN118193565A (en) Distributed big data calculation engine
Bouazizi et al. Management of QoS and data freshness in RTDBSs using feedback control scheduling and data versions
CN118677913B (en) Distributed storage service request processing method, device and distributed storage system
CN117311992B (en) Method for predicting and automatically dynamically balancing internal resources of cluster based on established resources
CN120353839B (en) Multi-level caching method, equipment and medium for distributed database
Jiang et al. The analysis and design of ship monitoring system based on hybrid replication technology

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
GR01 Patent grant
GR01 Patent grant