Method and system for upgrading and optimizing file-based database, and device and storage medium

By introducing the collaborative work of the main controller and the node controller into the file database, online upgrade and data conversion are realized, solving the problems of poor performance and deadlock during the database upgrade process, and ensuring the continuity and upgrade of the read and write services. efficiency.

WO2024174906A1PCT designated stage expired Publication Date: 2024-08-29INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/076548
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-02-21
Filing Date
2024-02-07
Publication Date
2024-08-29

AI Technical Summary

Technical Problem

During the upgrade process, file-based databases suffer from poor performance and deadlock issues due to concurrent write operations, and lack of SQL standard support, resulting in low upgrade efficiency and the need to be performed offline, affecting read and write services.

Method used

Develop concurrent upgrade strategies through the main controller, use heartbeats to monitor node status, implement online upgrades, and perform data structure conversion and rollback strategies through data converters and redirection interfaces to ensure that the read and write services of the database are available during the upgrade.

Benefits of technology

The online upgrade of the file database of the distributed storage system is realized, which reduces the impact of the upgrade on the business, ensures the seamless connection between the conversion of old and new data structures and the reading and writing services, reduces the risk of deadlock, and improves the upgrade efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024076548_29082024_PF_FP_ABST
    Figure CN2024076548_29082024_PF_FP_ABST
Patent Text Reader

Abstract

The present application relates to the field of distributed storage systems, and provides a method and system for upgrading and optimizing a file-based database, and a device and a storage medium. The method comprises: issuing a node controller to each node by means of a master controller, installing and starting the node controller, and monitoring the state of the node controller in a heartbeat mode; formulating a database upgrading strategy according to a concurrent upgrading strategy of a distributed storage system; and according to the database upgrading strategy, performing online upgrading on a file-based database of each node by means of the node controller. According to the present application, online upgrading of a file-based database is achieved, and it is ensured that a normal read-write service can be provided for the outside during the database upgrading period; and a read-write service supporting both a new data structure and an old data structure is achieved, i.e., during the upgrading period of the whole distributed storage system, a normal read-write operation can be performed on the database regardless of whether a database operation interface has been upgraded.
Need to check novelty before this filing date? Find Prior Art

Description

Method, system, device and storage medium for file-based database upgrade optimization

[0001] CROSS-REFERENCE TO RELATED APPLICATIONS

[0002] This application claims priority to the Chinese patent application filed with the China Patent Office on February 21, 2023, with application number 202310141162.6, and entitled “Method, system, device and storage medium for upgrading and optimizing file-type databases”, the entire contents of which are incorporated by reference into this application. Technical Field

[0003] The present application relates to the field of distributed file systems, and more specifically, to a method, system, device, and non-volatile readable storage medium for upgrading and optimizing a file-based database. Background Art

[0004] Lightweight file-based databases offer advantages such as portability, ease of use, good concurrent read performance, and simple, efficient storage. They offer zero-configuration access, meaning that data can be directly accessed without any system configuration. Therefore, distributed storage systems often use these databases for storing alerts, caches, and temporary information. However, file-based databases also have significant drawbacks: Due to the locking mechanisms used for concurrent access, their concurrent read and write performance is suboptimal. Write operations can monopolize the database, blocking other read and write operations. Concurrent writes can even lead to database deadlocks. Furthermore, these file-based databases lack comprehensive support for SQL (Structured Query Language, a database language with multiple capabilities, including data manipulation and definition). In particular, they lack support for modifying database table fields. Due to the lack of standard commands for modifying database table fields, upgrades to these databases require creating new tables and then re-importing historical data to update table fields. For the above reasons, in order to ensure the upgrade efficiency and database security of file-based databases (concurrent write operations of the upgraded database and normal data write operations may cause database deadlock), file-based databases are usually upgraded offline. That is, external read and write access to the database needs to be stopped during the database upgrade.

[0005] Summary of the Invention

[0006] In view of this, the purpose of some embodiments of the present application is to propose a method, system, computer equipment and non-volatile readable storage medium for upgrading and optimizing a file-type database. The present application realizes the online upgrade of a file-type database, ensuring that normal read and write services can still be provided to the outside world during the database upgrade; and realizes read and write services that support both new and old data structures. That is, during the upgrade of the entire distributed storage system, normal read and write operations can be performed on the database regardless of whether the database operation interface has completed the upgrade.

[0007] Based on the above-mentioned purpose, one aspect of some embodiments of the present application provides a method for upgrading and optimizing a file-type database, comprising the following steps: sending a node controller to each node through a main controller and installing and starting it, and monitoring the status of the node controller using a heartbeat method; formulating a database upgrade strategy based on the concurrent upgrade strategy of the distributed storage system; and performing online upgrading of the file-type database of each node through the node controller according to the database upgrade strategy.

[0008] In some implementations, the method further includes: triggering, by the main controller, different rollback strategies according to different upgrade stages.

[0009] In some embodiments, triggering different rollback strategies according to different upgrade stages by the main controller includes: in response to an exception occurring during the database upgrade stage, directly using a temporary database to replace the source database content and blocking the node storage system upgrade.

[0010] In some embodiments, triggering different rollback strategies according to different upgrade stages through the main controller includes: in response to an exception occurring in an upgrade node of the node distributed storage system, triggering downgrade, rolling back the database table structure to before the upgrade and retaining the newly written data during the upgrade.

[0011] In some embodiments, triggering different rollback strategies according to different upgrade stages by the main controller includes: in response to a cluster distributed storage system upgrade failure, triggering a forced rollback, and the main controller forcibly rolling back all node databases to the pre-upgrade state.

[0012] In some embodiments, performing an online upgrade of the file-type database of each node through the node controller according to the database upgrade strategy includes: setting an upgrade mark in the database, and triggering the database operation interface to redirect through the upgrade mark to redirect all database operation commands to the redirection interface of the node controller for processing.

[0013] In some implementations, performing an online upgrade of the file-based database of each node through the node controller according to the database upgrade strategy includes: writing all write data sent through redirection during the database upgrade into the data buffer.

[0014] In some implementations, performing online upgrade of the file-based database of each node through the node controller according to the database upgrade strategy includes: copying the file-based database to generate a temporary database, and using the temporary database as a main database to provide external data query services during the database upgrade.

[0015] In some embodiments, online upgrading of the file-based database of each node through the node controller according to the database upgrade strategy includes: making corresponding adjustments to the tables with data structure changes in the source library, and flushing the data in the data cache to the source library according to the new data structure.

[0016] In some implementations, performing an online upgrade of the file-based database of each node through the node controller according to the database upgrade strategy includes performing read and write tests on the source database itself and tables with changed structures, and directly using a temporary database for rollback if the test is abnormal.

[0017] In some implementations, performing online upgrade of the file-based database of each node through the node controller according to the database upgrade strategy includes: in response to completion of the source database upgrade, directly reading and writing the source database through the node controller.

[0018] In some embodiments, performing online upgrade of the file-based database of each node through the node controller according to the database upgrade strategy includes: in response to completion of the file-based database upgrade, canceling the upgrade mark through the node controller and restoring the database operation interface to a normal operation process.

[0019] In some embodiments, the method further includes: simultaneously recording the table structure data information of the new library and the old library through the node controller, and converting the information into data information that meets the redirection interface requirements based on the table structure information of the new library and the old library for response.

[0020] In some implementations, the method further includes: automatically switching the temporary database and the source database according to the database upgrade status through a redirection interface of the node controller.

[0021] In some embodiments, the method further includes: receiving externally written data through a redirection interface of the node controller and saving the data to a data buffer, and assembling the data in the database buffer and temporary database data through the redirection interface to respond to external read operations.

[0022] In some implementations, the method further includes: caching the newly added data in a data cache of the node controller and serializing the cached data according to the source library structure.

[0023] In some implementations, the method further includes: upgrading the data structure and updating the data of the source library through an upgrade controller of the node controller.

[0024] On the other hand, some embodiments of the present application provide a system for upgrading and optimizing file-type databases, including: a monitoring module configured to send a node controller to each node through a main controller and install and start it, and monitor the status of the node controller using a heartbeat method; a policy module configured to formulate a database upgrade strategy based on a concurrent upgrade strategy of a distributed storage system; and an execution module configured to perform online upgrades on the file-type database of each node through the node controller according to the database upgrade strategy.

[0025] In another aspect of some embodiments of the present application, a computer device is provided, comprising: at least one processor; and a memory, wherein the memory stores computer instructions that can be executed on the processor, and when the instructions are executed by the processor, the steps of the above method are implemented.

[0026] According to another aspect of some embodiments of the present application, a non-volatile readable storage medium is provided, which stores a computer program that implements the above method steps when executed by a processor.

[0027] This application has the following beneficial technical effects:

[0028] 1. It can realize online upgrade of file-based databases in distributed storage systems, that is, the read and write operations of the database will not be affected during the upgrade of the distributed storage system;

[0029] 2. Different database rollback strategies can be adopted according to different upgrade stages, thereby reducing the impact of database or upgrade failures on the business;

[0030] 3. The database now has old and new structure data that can be converted to each other, automatically switching between the old and new structure data on demand and responding to external requests, ensuring that the database can be queried or written using both the old and new interfaces normally during the upgrade period.

[0031] 4. The redirection interface enables normal reading and writing of external data during the distributed storage system upgrade. The data converter and the redirection interface work together to achieve seamless data query. The redirection interface can automatically switch between the old and new data structures and respond according to the status of the external interface upgrade.

[0032] 5. Cache new data through the data cache and serialize the cached data according to the source library structure;

[0033] 6. The database upgrade operation is minimized, and the database upgrade is controlled within the scope of a single table, and only the tables that need to be updated are upgraded. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] In order to more clearly illustrate some embodiments of the present application or technical solutions in the prior art, the following briefly introduces the drawings required for use in some embodiments or descriptions of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other embodiments can be obtained based on these drawings without any creative work.

[0035] FIG1 is a schematic diagram of some embodiments of the method for upgrading and optimizing a file-based database provided by the present application;

[0036] FIG2 is a block diagram of the main controller monitoring provided by this application;

[0037] FIG3 is a block diagram of a node controller provided by this application;

[0038] FIG4 is a block diagram of the rollback strategy provided by this application;

[0039] FIG5 is a schematic diagram of some embodiments of the system for upgrading and optimizing a file-based database provided by the present application;

[0040] FIG6 is a schematic diagram of the hardware structure of some embodiments of a computer device for upgrading and optimizing a file-based database provided by the present application;

[0041] FIG7 is a schematic diagram of some embodiments of the non-volatile readable storage medium optimized for file-type database upgrade provided by the present application. DETAILED DESCRIPTION

[0042] In order to make the objectives, technical solutions and advantages of the present application more clear, some embodiments of the present application are further described in detail below in combination with some specific embodiments and with reference to the accompanying drawings.

[0043] It should be noted that all expressions using "first" and "second" in some embodiments of the present application are for distinguishing two non-identical entities with the same name or non-identical parameters. It can be seen that "first" and "second" are only for the convenience of expression and should not be understood as limitations on some embodiments of the present application. This will not be explained one by one in some subsequent embodiments.

[0044] In a first aspect of some embodiments of the present application, an embodiment of a method for upgrading and optimizing a file-based database is provided. FIG1 shows a schematic diagram of some embodiments of the method for upgrading and optimizing a file-based database provided by the present application. As shown in FIG1 , some embodiments of the present application include the following steps:

[0045] S1. The master controller sends the node controller to each node and installs and starts it, and uses the heartbeat method to monitor the status of the node controller;

[0046] S2. Formulate a database upgrade strategy based on the concurrent upgrade strategy of the distributed storage system; and

[0047] S3. Perform online upgrade of the file-based database of each node through the node controller according to the database upgrade strategy.

[0048] Some embodiments of the present application add a database upgrade controller module, which is mainly composed of a main controller and a node controller. The main controller is mainly responsible for the overall upgrade process of the cluster database and the formulation of the upgrade strategy. The node controller is mainly responsible for controlling the upgrade of the file-type database and ensuring that normal data read and write operations can still be provided to the outside during the database upgrade. The core of the online upgrade of the file-type database lies in the data converter and redirection interface in the node controller. The data converter and the redirection interface cooperate with each other to realize the external interface non-perceptual query, that is, regardless of whether the external database interface has completed the upgrade, the redirection interface can ensure that it can obtain data information with the correct structure.

[0049] The master controller distributes the node controller to each node, installs and starts it, and monitors the node controller status using a heartbeat method. The master controller is primarily responsible for online database upgrades during the distributed storage system's online upgrade process. The node controller is distributed to each node, installed and started. The node controller status is monitored using a heartbeat method. The status of each node controller and the progress of the node database upgrade are monitored in real time. Figure 2 shows the master controller monitoring block diagram provided in this application.

[0050] The master controller formulates a database upgrade strategy based on the concurrent upgrade strategy of the distributed storage system and performs concurrent upgrades of the databases across nodes. Upgrading a single node's storage system depends on the database on that node having completed the upgrade.

[0051] The file-based database of each node is upgraded online through the node controller according to the database upgrade strategy.

[0052] Figure 3 is a block diagram of the node controller provided by this application. As shown in Figure 3, the node controller mainly consists of the following parts: 1) Data Converter. This is mainly responsible for converting and outputting output data according to the data structures of the new and old databases. The data converter records the table structure data information of both the new and old databases. Based on the table structure information of the new and old databases, the data converter converts this information into data information that meets the requirements of the redirection interface and responds. 2) Redirection Interface. This is mainly responsible for reading and writing external data during the database upgrade. The redirection interface automatically switches between the temporary database and the source database based on the database upgrade status. The redirection interface receives externally written data and saves the data to the data buffer. At the same time, the redirection interface is also responsible for assembling the data in the database buffer and the temporary database data to respond to external read operations. 3) Data Buffer. The main functions of the data buffer are: first, caching the write data sent by the redirection interface; second, providing cached data query function; and third, the data buffer will flush the cached data to the source database based on the upgrade status of the source database. The purpose of introducing the data buffer is: first, to prevent the loss of newly written data during the database upgrade process. Second, optimize database performance. File-based databases are not very suitable for concurrent writes. Adding a data cache can effectively prevent concurrent writes during database upgrades, thereby reducing the probability of database deadlocks and improving upgrade efficiency. 4) Upgrade Controller. This is primarily responsible for upgrading the source database's data structure and updating data.

[0053] In some embodiments, performing an online upgrade of the file-type database of each node through the node controller according to the database upgrade strategy includes: setting an upgrade mark in the database, and triggering the database operation interface to redirect through the upgrade mark to redirect all database operation commands to the redirection interface of the node controller for processing.

[0054] In some implementations, performing an online upgrade of the file-based database of each node through the node controller according to the database upgrade strategy includes: writing all write data sent through redirection during the database upgrade into the data buffer.

[0055] In some embodiments, the online upgrade of the file-type database of each node through the node controller according to the database upgrade strategy includes: copying the file-type database to generate a temporary database, and using the temporary database as the main database to provide data query services to the outside during the database upgrade. In order to improve the upgrade efficiency of the database and the availability of the database during the upgrade. Utilizing the single file feature of the file-type database, a temporary database is copied and generated, and the data in the temporary database is consistent with the data in the source database. There are two purposes for introducing the temporary database: one reason is to use the temporary database as the main database to provide data query services to the outside during the database upgrade, thereby ensuring the availability of the database during the upgrade. Only the temporary database is selected to provide query services to the outside because the source database is currently performing an upgrade, and a large number of write operations will block read operations during the upgrade. Therefore, in order to ensure that the external read performance of the database is not affected, the temporary database is selected to provide query services to the outside. The second reason is that as a database backup, the temporary database and the data buffer can be used to recover data after the source database upgrade fails.

[0056] In some embodiments, performing an online upgrade of each node's file-based database via the node controller according to the database upgrade strategy includes making corresponding adjustments to tables with changed data structures in the source database and flushing data in the data buffer to the source database according to the new data structures. The source database upgrade adheres to the principle of minimal modification, making corresponding adjustments only to tables with changed data structures. After the source database upgrade is complete, the data in the data buffer is flushed to the source database according to the new data structures.

[0057] In some embodiments, performing an online upgrade of the file-based database on each node through the node controller according to the database upgrade policy includes performing read and write tests on the source database itself and tables with structural changes. If any test failure occurs, a rollback is performed directly using a temporary database. Read and write tests are performed on the source database itself and tables with structural changes. If any test failure occurs, indicating that the database upgrade has failed, a rollback is performed directly using a temporary database.

[0058] In some implementations, performing online upgrade of the file-based database of each node through the node controller according to the database upgrade strategy includes: in response to completion of the source database upgrade, directly reading and writing the source database through the node controller.

[0059] In some embodiments, performing online upgrade of the file-based database of each node through the node controller according to the database upgrade strategy includes: in response to completion of the file-based database upgrade, canceling the upgrade mark through the node controller and restoring the database operation interface to a normal operation process.

[0060] In some embodiments, the method further includes: simultaneously recording the table structure data information of the new library and the old library through the node controller, and converting the information into data information that meets the redirection interface requirements based on the table structure information of the new library and the old library for response.

[0061] In some implementations, the method further includes: automatically switching the temporary database and the source database according to the database upgrade status through a redirection interface of the node controller.

[0062] In some embodiments, the method further includes: receiving externally written data through a redirection interface of the node controller and saving the data to a data buffer, and assembling the data in the database buffer and temporary database data through the redirection interface to respond to external read operations.

[0063] In some implementations, the method further includes: caching the newly added data in a data cache of the node controller and serializing the cached data according to the source library structure.

[0064] In some implementations, the method further includes: upgrading the data structure and updating the data of the source library through an upgrade controller of the node controller.

[0065] In some embodiments, the method further includes triggering different rollback strategies, via the master controller, based on different upgrade stages. Dynamic rollback strategies include replacement, downgrade, and forced rollback. Downgrade refers to rolling back only the database table structure but not the data, thus retaining newly written data during the upgrade. Forced rollback involves performing a rollback based on the data anchor point established by the master controller prior to the distributed storage system upgrade, without retaining new data. The master controller triggers different rollback strategies based on different upgrade stages.

[0066] Figure 4 is a rollback strategy framework diagram provided by this application. As shown in Figure 4, an exception occurs during the database upgrade phase, triggering replacement. A temporary database is directly used to replace the source database content and block the node storage system upgrade. An exception occurs during the node distributed storage system upgrade node, triggering downgrade. The database table structure rolls back to the state before the upgrade and retains the newly written data during the upgrade. A cluster distributed storage system upgrade fails, triggering a forced rollback, and the master controller forces all node databases to roll back to the state before the upgrade.

[0067] In some embodiments, triggering different rollback strategies according to different upgrade stages by the main controller includes: in response to an exception occurring during the database upgrade stage, directly using a temporary database to replace the source database content and blocking the node storage system upgrade.

[0068] In some embodiments, triggering different rollback strategies according to different upgrade stages through the main controller includes: in response to an exception occurring in an upgrade node of the node distributed storage system, triggering downgrade, rolling back the database table structure to before the upgrade and retaining the newly written data during the upgrade.

[0069] In some embodiments, triggering different rollback strategies according to different upgrade stages by the main controller includes: in response to a cluster distributed storage system upgrade failure, triggering a forced rollback, and the main controller forcibly rolling back all node databases to the pre-upgrade state.

[0070] The database upgrade controller in some embodiments of the present application can realize the online upgrade of the file-type database of the distributed storage system, that is, it does not affect the read and write operations of the database during the distributed storage system upgrade process; the main controller implements a dynamic rollback strategy, and can adopt different database rollback strategies according to different upgrade stages, thereby reducing the impact of database or upgrade failure on the business; the data converter realizes the mutual conversion of the old and new structure data of the database, realizes automatic switching of the old and new structure data on demand and responds to the outside, and ensures that the database can execute normally during the upgrade period whether it is new or old interface query or write; the redirection interface realizes the normal reading and writing of external data during the distributed storage system upgrade, and the data converter and the redirection interface cooperate with each other to realize seamless connection of data query, that is, the redirection interface can automatically switch the new and old data structures and respond according to the upgrade status of the external interface; the data cache is mainly used to cache new data and can serialize the cached data according to the source library structure; the upgrade controller realizes the minimization of database upgrade operations, controls the database upgrade within the scope of a single table, and only upgrades the tables that need to be updated.

[0071] It should be pointed out in particular that the various steps in the various embodiments of the above-mentioned method for upgrading and optimizing file-type databases can be cross-linked, replaced, added, and deleted with each other. Therefore, these reasonable permutations, combinations, and transformations of the method for upgrading and optimizing file-type databases should also fall within the scope of protection of this application, and the scope of protection of this application should not be limited to the embodiments.

[0072] Based on the above objectives, a second aspect of some embodiments of the present application proposes a system for upgrading and optimizing file-based databases. As shown in Figure 5, system 200 includes the following modules: a monitoring module configured to distribute node controllers to each node via a master controller, install and start the node controllers, and monitor the status of the node controllers using a heartbeat method; a policy module configured to formulate a database upgrade policy based on the concurrent upgrade policy of the distributed storage system; and an execution module configured to perform online upgrades on each node's file-based database via the node controllers according to the database upgrade policy.

[0073] In some embodiments, the system further includes a rollback module configured to: trigger different rollback strategies according to different upgrade stages via the main controller.

[0074] In some embodiments, the rollback module is configured to: in response to an exception occurring during the database upgrade phase, directly use a temporary database to replace the source database content and block the node storage system upgrade.

[0075] In some embodiments, the rollback module is configured to: in response to an exception occurring during node upgrade of the node distributed storage system, trigger a downgrade, roll back the database table structure to before the upgrade, and retain the newly written data during the upgrade.

[0076] In some embodiments, the rollback module is configured to: in response to a cluster distributed storage system upgrade failure, trigger a forced rollback, and the main controller forcibly rolls back all node databases to a state before the upgrade.

[0077] In some embodiments, the execution module is configured to: set an upgrade mark in the database, and trigger the database operation interface to redirect through the upgrade mark to redirect all database operation commands to the redirection interface of the node controller for processing.

[0078] In some implementations, the execution module is configured to write all write data sent through redirection during the database upgrade into the data buffer.

[0079] In some implementations, the execution module is configured to: copy the file-based database to generate a temporary database, and use the temporary database as a main database to provide external data query services during the database upgrade.

[0080] In some implementations, the execution module is configured to: make corresponding adjustments to tables in the source database with changed data structures, and flush the data in the data buffer to the source database according to the new data structure.

[0081] In some implementations, the execution module is configured to perform read and write tests on the source database itself and the tables whose structures have changed, and directly use a temporary database for rollback if the test fails.

[0082] In some implementations, the execution module is configured to: in response to completion of the source library upgrade, directly read and write the source library through the node controller.

[0083] In some embodiments, the execution module is configured to: in response to the completion of the file-based database upgrade, cancel the upgrade mark through the node controller and restore the database operation interface to a normal operation process.

[0084] In some embodiments, the system also includes a conversion module configured to: simultaneously record the table structure data information of the new library and the old library through the node controller, and convert the information into data information that meets the redirection interface requirements based on the table structure information of the new library and the old library for response.

[0085] In some embodiments, the system further includes a switching module configured to automatically switch between the temporary database and the source database according to the database upgrade status through a redirection interface of the node controller.

[0086] In some embodiments, the system also includes a response module configured to: receive externally written data through the redirection interface of the node controller and save the data to the data cache, and assemble the data in the database cache and the temporary database data through the redirection interface to respond to external read operations.

[0087] In some embodiments, the system further includes a cache module configured to: cache the newly added data through the data cache of the node controller and serialize the cached data according to the source library structure.

[0088] In some embodiments, the system further includes an upgrade module configured to upgrade the data structure and update the data of the source library through an upgrade controller of the node controller.

[0089] Based on the above-mentioned purpose, the third aspect of some embodiments of the present application proposes a computer device, comprising: at least one processor; and a memory, the memory storing computer instructions that can be run on the processor, and the instructions are executed by the processor to implement the following steps: S1, sending the node controller to each node through the main controller and installing and starting it, and monitoring the status of the node controller using a heartbeat method; S2, formulating a database upgrade strategy based on the concurrent upgrade strategy of the distributed storage system; and S3, performing online upgrades on the file-type database of each node through the node controller according to the database upgrade strategy.

[0090] In some implementations, the steps further include: triggering different rollback strategies according to different upgrade stages via the main controller.

[0091] In some embodiments, triggering different rollback strategies according to different upgrade stages by the main controller includes: in response to an exception occurring during the database upgrade stage, directly using a temporary database to replace the source database content and blocking the node storage system upgrade.

[0092] In some embodiments, triggering different rollback strategies according to different upgrade stages through the main controller includes: in response to an exception occurring in an upgrade node of the node distributed storage system, triggering downgrade, rolling back the database table structure to before the upgrade and retaining the newly written data during the upgrade.

[0093] In some embodiments, triggering different rollback strategies according to different upgrade stages by the main controller includes: in response to a cluster distributed storage system upgrade failure, triggering a forced rollback, and the main controller forcibly rolling back all node databases to the pre-upgrade state.

[0094] In some embodiments, performing an online upgrade of the file-type database of each node through the node controller according to the database upgrade strategy includes: setting an upgrade mark in the database, and triggering the database operation interface to redirect through the upgrade mark to redirect all database operation commands to the redirection interface of the node controller for processing.

[0095] In some implementations, performing an online upgrade of the file-based database of each node through the node controller according to the database upgrade strategy includes: writing all write data sent through redirection during the database upgrade into the data buffer.

[0096] In some implementations, performing online upgrade of the file-based database of each node through the node controller according to the database upgrade strategy includes: copying the file-based database to generate a temporary database, and using the temporary database as a main database to provide external data query services during the database upgrade.

[0097] In some embodiments, online upgrading of the file-based database of each node through the node controller according to the database upgrade strategy includes: making corresponding adjustments to the tables with data structure changes in the source library, and flushing the data in the data cache to the source library according to the new data structure.

[0098] In some implementations, performing an online upgrade of the file-based database of each node through the node controller according to the database upgrade strategy includes performing read and write tests on the source database itself and tables with changed structures, and directly using a temporary database for rollback if the test is abnormal.

[0099] In some implementations, performing online upgrade of the file-based database of each node through the node controller according to the database upgrade strategy includes: in response to completion of the source database upgrade, directly reading and writing the source database through the node controller.

[0100] In some embodiments, performing online upgrade of the file-based database of each node through the node controller according to the database upgrade strategy includes: in response to completion of the file-based database upgrade, canceling the upgrade mark through the node controller and restoring the database operation interface to a normal operation process.

[0101] In some implementations, the steps further include: simultaneously recording the table structure data information of the new library and the old library through the node controller, and converting the information into data information that meets the redirection interface requirements based on the table structure information of the new library and the old library for response.

[0102] In some implementations, the steps further include: automatically switching between the temporary database and the source database according to the database upgrade status through a redirection interface of the node controller.

[0103] In some embodiments, the steps further include: receiving externally written data through a redirection interface of the node controller and saving the data to a data buffer, and assembling the data in the database buffer and the temporary database data through the redirection interface to respond to external read operations.

[0104] In some implementations, the steps further include: caching the newly added data in a data cache of the node controller and serializing the cached data according to the source library structure.

[0105] In some implementations, the steps further include: upgrading the data structure and updating the data of the source library through an upgrade controller of the node controller.

[0106] FIG6 is a schematic diagram of the hardware structure of an embodiment of the computer device for upgrading and optimizing the file-based database provided in this application.

[0107] Taking the device shown in FIG. 6 as an example, the device includes a processor 301 and a memory 302 .

[0108] The processor 301 and the memory 302 may be connected via a bus or other means. FIG6 takes the bus connection as an example.

[0109] Memory 302, as a non-volatile readable storage medium, can be used to store non-volatile software programs, non-volatile computer executable programs, and modules, such as the program instructions / modules corresponding to the file-based database upgrade and optimization method in some embodiments of the present application. Processor 301 executes the non-volatile software programs, instructions, and modules stored in memory 302 to execute various server functional applications and data processing, thereby implementing the file-based database upgrade and optimization method.

[0110] The memory 302 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and application programs required for at least one function; the data storage area may store data created using a method for upgrading and optimizing a file-based database, etc. In addition, the memory 302 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory 302 may optionally include a memory remotely located relative to the processor 301, and these remote memories may be connected to the local module via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0111] Computer instructions 303 corresponding to one or more file-type database upgrade and optimization methods are stored in the memory 302 . When executed by the processor 301 , the file-type database upgrade and optimization method in any of the above method embodiments is executed.

[0112] Any embodiment of the computer device that executes the above-mentioned method for upgrading and optimizing a file-based database can achieve the same or similar effects as any corresponding embodiment of the above-mentioned method.

[0113] The present application also provides a non-volatile readable storage medium, which stores a computer program that performs a method for upgrading and optimizing a file-type database when executed by a processor.

[0114] FIG7 is a schematic diagram of an embodiment of a non-volatile readable storage medium optimized for upgrading a file-based database, as provided in some embodiments of the present application. Taking the non-volatile readable storage medium shown in FIG7 as an example, the non-volatile readable storage medium 401 stores a computer program 402 that, when executed by a processor, performs the method described above.

[0115] Finally, it should be noted that those skilled in the art will understand that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program. The program of the file-type database upgrade and optimization method can be stored in a non-volatile readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the storage medium of the program can be a magnetic disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM). The above-mentioned computer program embodiment can achieve the same or similar effects as any of the corresponding aforementioned method embodiments.

[0116] The above are exemplary embodiments disclosed in the present application, but it should be noted that various changes and modifications may be made without departing from the scope of the present application as defined in the claims. The functions, steps and / or actions of the method claims according to the disclosed embodiments described herein do not need to be performed in any particular order. In addition, although the elements disclosed in the embodiments of the present application may be described or required in individual form, they may also be understood as multiple unless expressly limited to the singular.

[0117] It should be understood that, as used herein, the singular forms "a" and "an" are intended to include the plural forms as well, unless the context clearly supports an exception. It should also be understood that, as used herein, "and / or" is intended to include any and all possible combinations of one or more of the associated listed items.

[0118] The serial numbers of the embodiments disclosed in the above embodiments of the present application are only for description and do not represent the advantages or disadvantages of the embodiments.

[0119] Those skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware, or by programs instructing related hardware to accomplish the steps. The programs may be stored in a non-volatile readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk, or an optical disk, etc.

[0120] Those skilled in the art should understand that the discussion of any of the above embodiments is merely illustrative and is not intended to imply that the scope of the disclosure of the embodiments of the present application (including the claims) is limited to these examples; based on the ideas of the embodiments of the present application, the technical features of the above embodiments or different embodiments can also be combined, and there are many other variations of different aspects of the embodiments of the present application as described above, which are not provided in detail for the sake of simplicity. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the embodiments of the present application should be included in the scope of protection of the embodiments of the present application.

Claims

1. A method for upgrading and optimizing a file-based database. It is characterized in that The steps include: The node controller is sent to each node through the main controller for installation and startup, and the status of the node controller is monitored using the heartbeat method; Formulate database upgrade strategy based on concurrent upgrade strategy of distributed storage system; as well as The file-type database of each node is upgraded online through the node controller according to the database upgrade strategy.

2. The method according to claim 1, It is characterized in that The method also includes: Different rollback strategies are triggered by the main controller according to different upgrade stages.

3. The method according to claim 2, It is characterized in that The triggering of different rollback strategies according to different upgrade stages by the main controller includes: In response to an exception occurring during the database upgrade phase, a temporary database is directly used to replace the source database content and block the node storage system upgrade.

4. The method according to claim 2, It is characterized in that The triggering of different rollback strategies according to different upgrade stages by the main controller includes: In response to an exception occurring in an upgraded node of the node distributed storage system, a downgrade is triggered, the database table structure is rolled back to before the upgrade and the newly written data during the upgrade is retained.

5. The method according to claim 2, It is characterized in that The triggering of different rollback strategies according to different upgrade stages by the main controller includes: In response to the failure of the cluster distributed storage system upgrade, a forced rollback is triggered, and the main controller forcibly rolls back all node databases to the state before the upgrade.

6. The method according to claim 1, It is characterized in that The online upgrading of the file-based database of each node through the node controller according to the database upgrade strategy includes: An upgrade mark is set in the database, and the database operation interface is triggered by the upgrade mark to redirect all database operation commands to the redirection interface of the node controller for processing.

7. The method according to claim 6, It is characterized in that The online upgrading of the file-based database of each node through the node controller according to the database upgrade strategy includes: During the database upgrade, all write data sent through redirection is written to the data buffer.

8. The method according to claim 7, It is characterized in that The online upgrading of the file-based database of each node through the node controller according to the database upgrade strategy includes: The file-based database is copied to generate a temporary database, and the temporary database is copied to the As the main database, it provides data query services to the outside world.

9. The method according to claim 8, It is characterized in that The online upgrading of the file-based database of each node through the node controller according to the database upgrade strategy includes: Make corresponding adjustments to the tables in the source database with changed data structures, and flush the data in the data buffer to the source database according to the new data structure.

10. The method according to claim 9, It is characterized in that The online upgrading of the file-based database of each node through the node controller according to the database upgrade strategy includes: Perform read and write tests on the source database itself and the tables whose structures have changed. If the test fails, use the temporary database to roll back directly.

11. The method according to claim 10, It is characterized in that The online upgrading of the file-based database of each node through the node controller according to the database upgrade strategy includes: In response to the completion of the source database upgrade, the source database is directly read and written through the node controller.

12. The method according to claim 11, It is characterized in that The online upgrading of the file-based database of each node through the node controller according to the database upgrade strategy includes: In response to the completion of the file-based database upgrade, the node controller cancels the upgrade mark and restores the database operation interface to a normal operation process.

13. The method according to claim 1, It is characterized in that The method also includes: The node controller simultaneously records the table structure data information of the new library and the old library, and based on the table structure information of the new library and the old library, converts the information into data information that meets the requirements of the redirection interface for response.

14. The method according to claim 13, It is characterized in that The method also includes: Automatically switch between the temporary database and the source database based on the database upgrade status through the redirection interface of the node controller.

15. The method according to claim 14, It is characterized in that The method also includes: The node controller receives external written data through its redirection interface and saves the data to the data buffer. It also assembles the data in the database buffer and the temporary database data through the redirection interface to respond to external read operations.

16. The method according to claim 15, It is characterized in that The method also includes: The newly added data is cached through the data cache of the node controller and the cached data is serialized according to the source library structure.

17. The method according to claim 16, It is characterized in that The method also includes: The data structure of the source database is upgraded and the data is updated through the upgrade controller of the node controller.

18. A system for upgrading and optimizing file-based databases. It is characterized in that include: A monitoring module is configured to send the node controller to each node through the main controller and install and start it, and monitor the status of the node controller in a heartbeat manner; A policy module configured to formulate a database upgrade strategy according to a concurrent upgrade strategy of a distributed storage system; as well as The execution module is configured to perform online upgrade of the file-based database of each node through the node controller according to the database upgrade strategy.

19. A computer device, It is characterized in that include: at least one processor; as well as A memory storing computer instructions executable on the processor, wherein the instructions, when executed by the processor, implement the steps of the method according to any one of claims 1 to 17.

20. A non-volatile readable storage medium storing a computer program. It is characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 17 are implemented.

Citation Information

Patent Citations

  • Hot upgrading method for software-defined network controllers with distributed architecture

    CN107179912A

  • Distributed database upgrading method and device and medium

    CN112434008A

  • Database upgrading method and device

    CN115495436A

  • Method, system and equipment for upgrading and optimizing file type database and storage medium

    CN115827789A

  • Seamless upgrades in a distributed database system

    US20120239616A1