Gray release method, device and equipment of stored procedure, medium and program product

By creating a grayscale mode in the database and configuring a priority search path, the system enables uninterrupted grayscale release of stored procedures, solving the problems of low system availability, high cost, and difficult operation and maintenance in existing technologies, and improving the stability and availability of the database system.

CN116881367BActive Publication Date: 2026-02-17INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310898517.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-07-20
Publication Date
2026-02-17
Estimated Expiration
2043-07-20

AI Technical Summary

Technical Problem

The existing canary release scheme for stored procedures in database production environments requires long-term downtime, which affects system availability and stability, and is costly, difficult to maintain, and has a high risk of deployment.

Method used

Create a grayscale schema in the database that mirrors the original schema, configure the grayscale search path to give it higher priority than the original schema, allowing grayscale users to test the new version of the stored procedure and adopt a release strategy based on the test results, without downtime or additional resources.

Benefits of technology

It improves the availability and stability of the database system, reduces the difficulty of operation and maintenance and the risk of deployment, reduces cost investment, and simplifies the deployment process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116881367B_ABST
    Figure CN116881367B_ABST
Patent Text Reader

Abstract

The present disclosure provides a database stored procedure gray release method, device, electronic equipment, medium and computer program product. The above method and device can be used in the field of big data and financial technology. The database stored procedure gray release method comprises: creating a gray mode which is a mirror of an original mode in a database, wherein the original mode and the gray mode are logically isolated; releasing a new version of the database stored procedure on the gray mode; configuring a search path for an account determined as a gray user to obtain a gray search path, wherein the search priority of the gray search path is that the gray mode is higher than the original mode; obtaining a test result in response to a test performed by the gray user according to the configured search path, wherein the test result is a test pass or test error information feedback; and taking a release strategy according to the test result.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present disclosure relates to the technical field of big data, and more particularly, to a database stored procedure gray release method and device, electronic equipment, medium and computer program product. BACKGROUND

[0002] The existing database production environment often uses a shutdown or gray cluster method to release a stored procedure.

[0003] The shutdown scheme requires at least one hour of shutdown window, during which the business is terminated, the stored procedure is compiled, and the business is restarted after the test is successful. As can be seen, the shutdown scheme for gray release of the stored procedure requires a long time of shutdown during the release version and deployment procedure, and no service can be provided during this period. If the version is released, the verification test fails or the application is used incorrectly, and the old version needs to be rolled back again, which requires a long time of shutdown. This scheme reduces the system availability and stability, and seriously affects the online business.

[0004] The gray cluster scheme requires a physical cluster consistent with the original database server specifications, and needs to synchronize the data and objects of the original database server. The stored procedure is released to the gray cluster for production, and the application side is notified to switch the connection to the gray cluster for production after full testing. As can be seen, the gray cluster scheme for gray release of the stored procedure requires additional physical resources, including network, server equipment, and room space, which has high cost and large investment. At the same time, this scheme needs to ensure that the data and objects of the gray cluster are consistent with the original cluster, otherwise the application switching connection will report an error when executing the stored procedure. After the gray release is completed, the application side needs to reset the connection configuration to the gray cluster after production, which requires the cooperation of the application side to release changes, has high invasiveness to the application, increases the production steps, and leads to an increase in production and operation support difficulty, and increases the production risk. SUMMARY

[0005] Therefore, the present disclosure provides a database stored procedure gray release method and device, electronic equipment, computer readable storage medium and computer program product, which has low invasiveness to the application, low production and operation difficulty, small production risk, low investment cost, and good database system availability and stability.

[0006] One aspect of the present disclosure provides a method for gray release of a database stored procedure, comprising: creating a gray mode in a database that mirrors an original mode, wherein the original mode and the gray mode are logically isolated; releasing a new version of the database stored procedure on the gray mode; configuring a search path for an account determined to be a gray user to obtain a gray search path, wherein the search priority of the gray search path is that the gray mode is higher than the original mode; obtaining a test result in response to a test performed by the gray user according to the configured search path, wherein the test result is a test pass or test error information feedback; and taking a release strategy according to the test result.

[0007] The method for gray release of a database stored procedure according to the embodiments of the present disclosure creates a gray mode in a database that mirrors an original mode; releases a new version of the database stored procedure on the gray mode; configures a search path for an account determined to be a gray user to obtain a gray search path, wherein the search priority of the gray search path is that the gray mode is higher than the original mode; obtains a test result in response to a test performed by the gray user according to the configured search path, and thus can take a release strategy according to the test result. The present disclosure does not need to stop when releasing a new version of the stored procedure, and can provide services to the outside, and does not need to stop when the test fails, thereby improving the availability and stability of the database system. In addition, the present disclosure does not need to cooperate with the application side to release changes, has low invasiveness to the application, simplifies the production steps, reduces the difficulty of production and operation support, and at the same time reduces the production risk. Furthermore, the present disclosure does not need to create a new cluster, and only needs to add a gray mode to the original database of the application, and does not need to copy the data of the original mode, but only needs to create a stored procedure in the gray mode, set the first order of the search path to the gray mode, and the second order to the original mode, to ensure that the application can normally access the data and objects in the original mode, thereby saving resources and reducing the cost.

[0008] In some embodiments, after the creating a gray mode in a database that mirrors an original mode, the method further comprises: setting the user permissions of the gray mode to be consistent with the user permissions of the original mode.

[0009] In some embodiments, the test comprises: directly performing a test on a queried stored procedure; and using a transaction rollback method to test an added, deleted, or modified stored procedure.

[0010] In some embodiments, the taking a release strategy according to the test result comprises: when the test result is a test pass, the release strategy taken is to configure the search path of all users to be a search path with a search priority that the gray mode is higher than the original mode.

[0011] In some embodiments, the taking a release strategy according to the test result comprises: when the test result is test error information feedback, the taken release strategy is: correcting the stored procedure according to the test error information feedback; and re-releasing the corrected stored procedure on the gray mode, and repeatedly performing the configuring a search path for the account determined as a gray user until the test result is passed.

[0012] In some embodiments, the configuring a search path for the account determined as a gray user is implemented using structured query language instructions.

[0013] Another aspect of the present disclosure provides a device for gray release of a database stored procedure, comprising: a creating module configured to create a gray mode mirroring an original mode in a database, wherein the original mode and the gray mode are logically isolated; a releasing module configured to release a new version of a database stored procedure on the gray mode; a configuring module configured to configure a search path for an account determined as a gray user to obtain a gray search path, wherein a search priority of the gray search path is that the gray mode is higher than the original mode; an obtaining module configured to obtain a test result in response to a test performed by the gray user according to the configured search path, wherein the test result is either a test pass or test error information feedback; and a strategy module configured to take a release strategy according to the test result.

[0014] Another aspect of the present disclosure provides an electronic device comprising one or more processors and one or more memories, wherein the memory is configured to store executable instructions, and the executable instructions, when executed by the processor, implement the method as described above.

[0015] Another aspect of the present disclosure provides a computer-readable storage medium storing computer-executable instructions, which, when executed, implement the method as described above.

[0016] Another aspect of the present disclosure provides a computer program product comprising a computer program, wherein the computer program comprises computer-executable instructions, which, when executed, implement the method as described above. BRIEF DESCRIPTION OF DRAWINGS

[0017] The above and other objects, features and advantages of the present disclosure will become more apparent from the following description when taken in conjunction with the accompanying drawings, in which:

[0018] Figure 1 An exemplary system architecture to which the method and device according to embodiments of the present disclosure can be applied is schematically shown.

[0019] Figure 2 A flow chart of a method for gray release of a database stored procedure is shown schematically according to an embodiment of the present disclosure;

[0020] Figure 3 A flow chart of taking a release strategy according to test results is shown schematically according to some embodiments of the present disclosure;

[0021] Figure 4 A flow chart of taking a release strategy according to test results is shown schematically according to some other embodiments of the present disclosure;

[0022] Figure 5 A block diagram of an apparatus for gray release of a database stored procedure is shown schematically according to an embodiment of the present disclosure;

[0023] Figure 6 A block diagram of an electronic device is shown schematically according to an embodiment of the present disclosure. DETAILED DESCRIPTION

[0024] Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. It should be understood, however, that the description is merely for illustration, and is not intended to limit the scope of the present disclosure. In the following detailed description of embodiments of the present disclosure, numerous specific details are set forth in order to provide a thorough understanding of the embodiments. However, it would be apparent to those skilled in the art that the present disclosure can be practiced without these specific details. In other instances, well-known structures and functions have not been described in detail in order to avoid obscuring the concepts of the present disclosure.

[0025] In the technical solutions of the present disclosure, the acquisition, storage and application of user personal information comply with relevant laws and regulations, necessary security measures are taken, and do not violate public order and good customs. In the technical solutions of the present disclosure, the acquisition, collection, storage, use, processing, transmission, provision, disclosure and application of data comply with relevant laws and regulations, necessary security measures are taken, and do not violate public order and good customs.

[0026] The terms used herein are merely used to describe specific embodiments, and are not intended to limit the present disclosure. The terms "include", "contain" and the like used herein indicate the existence of the described features, steps, operations and / or components, but do not exclude the existence or addition of one or more other features, steps, operations or components.

[0027] In the case of using expressions similar to "at least one of A, B, or C, etc.", it is generally understood that the expression is intended to mean any of the natural inclusive permutations. For example, "A, B, or C" is understood to mean "A, B, or C; or A and B; or A and C; or B and C; or A, B, and C; or 1; or 2; or 3; or 1 and 2; or 1 and 3; or 2 and 3; or 1, 2, and 3." In this document, the term "approximately" means ±30% of the value of the quantity being approximated. Numbers of forms, counts, amounts etc. specified should be understood as being approximate unless otherwise stated. The terms "first," "second," and the like, do not denote any ontological limitation of the components they qualify, but are used merely as labels, names for purposes of distinction, for the entities specified and for the clear understanding of the reader and are not intended to mean "second" compared to "first" or vice versa. Accordingly, a "first" feature can be a "second" feature and vice versa.

[0028] The following are the explanations of the terms appearing in the present disclosure.

[0029] Stored Procedure: A database executable object. Composed of a set of Structured Query Language (SQL language) according to the structure of the corresponding syntax, it can implement a specific function, and the stored procedure is stored in the database, permanently effective after one-time compilation, and the user calls and executes it by specifying the stored procedure name, parameters (if the stored procedure has parameters), etc. It is equivalent to an application program written in SQL language in the database.

[0030] Gray release: A release method that can smoothly transition. One of the release methods is to isolate the new and old versions, and when releasing the new version, first make a part of the users use the new version, and if there is no problem, gradually expand the scope to migrate all users to the new version. Gray release can ensure the stability of the overall system, and problems can be found and adjusted at the initial gray release to ensure the degree of impact.

[0031] Gray user: A user divided into a gray user can verify and experience the new version function with a small amount of traffic.

[0032] Schema: It is a collection of database objects, and it can organize database objects into logical groups that are easy to manage, including tables, views, sequences, indexes, stored procedures, and functions. A database can include one or more schemas, and the same database object name can exist in different schemas in the same database without conflict, and users with the required permissions can access objects in multiple schemas of the database.

[0033] Search Path: In a database that allows a user to have multiple schemas, when creating or viewing an object, it will first be performed in the first schema listed in the search path, and when searching for an object, if it does not exist in the first schema, it will sequentially search for the object in other schemas in the search path.

[0034] Transaction: A transaction is a logically consistent set of operations that are executed as a unit. The characteristics of a transaction are atomicity, consistency, isolation, and durability.

[0035] Transaction rollback: refers to the operation of the above transaction to the database is cancelled. Delete one or more partially completed transaction execution update operation to ensure the integrity of the database after the database system error.

[0036] The existing database production environment often uses the method of stopping or gray cluster to release the stored procedure.

[0037] The shutdown scheme needs at least one hour of shutdown window, during which the business is terminated, the stored procedure is compiled, and the business is restarted after the test is successful. As can be seen, the shutdown scheme of the gray release of the stored procedure needs a long time of shutdown during the release version and deployment program, and cannot provide services during this period. If the version is released, the verification test is not passed or the application is used incorrectly, and the old version needs to be rolled back again. The shutdown scheme reduces the system availability and stability, and seriously affects the online business.

[0038] The gray cluster scheme needs a physical cluster consistent with the original database server specification, and needs to synchronize the data and objects of the original database server. The stored procedure is released to the gray cluster, and the application side is notified to switch to connect to the gray cluster for production after full testing. As can be seen, the gray cluster scheme of the gray release of the stored procedure needs additional physical resources, including network, server equipment, and room space, which has high cost and large investment; At the same time, this scheme needs to ensure that the data and objects of the gray cluster are consistent with the original cluster, otherwise the application will report an error after switching to connect and executing the stored procedure; After the gray release is completed, the application side needs to reset the connection configuration to the gray cluster after production, and needs to cooperate with the application release changes, which is highly invasive to the application, increases the production steps, and leads to the increase of production risk.

[0039] Embodiments of the present disclosure provide a gray release method, device, electronic equipment, computer readable storage medium and computer program product of a database stored procedure. The gray release method of the database stored procedure comprises: creating a gray mode which is a mirror of an original mode in the database, wherein the original mode and the gray mode are logically isolated; releasing a new version of the database stored procedure on the gray mode; configuring a search path for an account determined as a gray user to obtain a gray search path, wherein the search priority of the gray search path is that the gray mode is higher than the original mode; in response to a test performed by the gray user according to the configured search path, obtaining a test result, wherein the test result is a test pass or test error information feedback; and according to the test result, taking a release strategy.

[0040] It should be noted that the database stored procedure gray release method, apparatus, electronic device, computer readable storage medium and computer program product of the present disclosure can be used in the field of big data technology, and can also be used in any field other than the field of big data technology, such as the financial field. The field of the present disclosure is not limited here.

[0041] Figure 1 An exemplary system architecture 100 to which the database stored procedure gray release method, apparatus, electronic device, computer readable storage medium and computer program product according to embodiments of the present disclosure can be applied is schematically shown. It should be noted that, Figure 1 The system architecture shown is only an example of a system architecture to which embodiments of the present disclosure can be applied, to help those skilled in the art understand the technical content of the present disclosure, but does not mean that embodiments of the present disclosure cannot be used in other devices, systems, environments or scenarios.

[0042] As Figure 1 The system architecture 100 according to this embodiment can include terminal devices 101, 102, 103, a network 104 and a server 105, as shown. The network 104 is a medium for providing a communication link between the terminal devices 101, 102, 103 and the server 105. The network 104 can include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0043] A user can use the terminal devices 101, 102, 103 to interact with the server 105 through the network 104 to receive or send messages, etc. Various communication client applications can be installed on the terminal devices 101, 102, 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only as examples).

[0044] The terminal devices 101, 102, 103 can be various electronic devices with display screens and supporting web browsing, including but not limited to smartphones, tablet computers, laptop computers and desktop computers, etc.

[0045] The server 105 can be a server providing various services, such as a background management server providing support for websites browsed by users using the terminal devices 101, 102, 103 (only as an example). The background management server can analyze and process received user requests and other data, and feed back the processing results (such as web pages, information or data generated according to user requests, etc.) to the terminal devices.

[0046] It should be noted that the database stored procedure gray release method provided by the embodiment of the present disclosure can be generally executed by the server 105. Accordingly, the database stored procedure gray release apparatus provided by the embodiment of the present disclosure can be generally arranged in the server 105. The database stored procedure gray release method provided by the embodiment of the present disclosure can also be executed by a server or a server cluster different from the server 105 and capable of communicating with the terminal device 101, 102, 103 and / or the server 105. Accordingly, the database stored procedure gray release apparatus provided by the embodiment of the present disclosure can also be arranged in a server or a server cluster different from the server 105 and capable of communicating with the terminal device 101, 102, 103 and / or the server 105.

[0047] It should be understood that Figure 1 The number of terminal devices, networks and servers in the above-mentioned scenario is only illustrative. Any number of terminal devices, networks and servers can be provided according to the implementation needs.

[0048] The database stored procedure gray release method of the embodiment of the present disclosure will be described in detail below based on the scenario described above. Figure 1 Figures 2 to 4 The database stored procedure gray release method of the embodiment of the present disclosure will be described in detail below based on the scenario described above.

[0049] Figure 2 The flowchart of the database stored procedure gray release method according to the embodiment of the present disclosure is schematically shown.

[0050] As shown in Figure 2 The database stored procedure gray release method of the embodiment includes operations S11-S15.

[0051] In operation S11, a gray mode that is a mirror image of an original mode is created in a database, wherein the original mode and the gray mode are logically isolated.

[0052] As an implementable manner, after the gray mode that is a mirror image of the original mode is created in the database in operation S11, the method further includes operation S001.

[0053] In operation S001, the user permissions of the gray mode are set to be consistent with the user permissions of the original mode.

[0054] It should be noted that the database administrator user can create the gray mode in the application database, the gray mode and the original mode are mirror images of each other, are logically isolated and do not affect each other, and the owner of the gray mode can be changed to the owner of the original mode. In order to ensure that the permissions of the gray mode are consistent with the permissions of the original mode, the related permissions of the gray mode are assigned to the related application users. The application users are the common owners of the gray mode and the original mode, so that the application users can normally access the two modes. ​

[0055] In operation S12, the new version of the database stored procedure is published in the gray mode. Wherein, the publishing of the new version of the database stored procedure in the gray mode can be understood as that the gray user creates and compiles the execution of the new version of the stored procedure in the gray mode, during which the original mode is not involved and the original business is not affected. It can be understood that one or part of the application users can be selected as the gray user.

[0056] In operation S13, the search path is configured for the account determined as the gray user to obtain the gray search path, wherein the search priority of the gray search path is that the gray mode is higher than the original mode.

[0057] In some examples, the configuration of the search path for the account determined as the gray user can be implemented by using the structured query language instruction. That is, the search path of the gray user is set to the search priority that the gray mode is higher than the original mode by using the SQL command, so that the gray user can preferentially create, compile and execute the stored procedure in the gray mode, and at the same time, when the stored procedure is tested, it is guaranteed that the stored procedure can normally call the stored procedure, data and object of the original mode and the like.

[0058] In operation S14, in response to the test performed by the gray user according to the configured search path, the test result is obtained, wherein the test result is that the test is passed or the test error information is fed back.

[0059] As some implementable ways, the test can include operation S141 and operation S142.

[0060] In operation S141, the test is directly performed on the queried stored procedure.

[0061] In operation S142, the test is performed on the added, deleted and modified stored procedure by using the transaction rollback mode.

[0062] It can be understood that through operation S141 and operation S142, the test can be directly performed on the stored procedure involving the table, data and object query, and the verification can be performed on the added, deleted and modified stored procedure involving the table, data and object by using the transaction rollback mode, which guarantees that the test stored procedure can be verified and the data and object of the original mode are not changed, so that the business of the original mode is not affected during the verification.

[0063] In operation S15, the release strategy is taken according to the test result.

[0064] In some examples, as shown in FIG. 1, operation S15 takes the release strategy according to the test result, which includes operation S151. Figure 3

[0065] ​When operating S151, if the test result is "pass," the deployment strategy is to configure all users' search paths with a search priority that prioritizes the grayscale mode over the original mode. Operating S151 facilitates implementing a deployment strategy based on the test results when the test passes.

[0066] In some examples, such as Figure 4 As shown, operation S15 adopts a release strategy based on the test results, including operation S152 and operation S153.

[0067] When operating S152, if the test result is a test error message, the release strategy is to correct the stored procedure based on the test error message feedback.

[0068] In operation S153, the corrected stored procedure is republished in grayscale mode, and operation S13 is repeated until the test result is a pass.

[0069] Understandably, when test results show error messages, the cause of the failure can be analyzed, and relevant settings or stored procedures can be corrected based on the error messages. The corrected new version of the stored procedure can then be released in the grayscale mode until no test error messages are reported. Subsequently, the grayscale mode can be set as the current first-priority application mode, allowing the application to use the new version of the stored procedure in the grayscale mode normally, while also being able to access data and objects in the original mode.

[0070] The canary deployment method for database stored procedures according to embodiments of this disclosure involves creating a canary schema in the database that mirrors the original schema; deploying a new version of the database stored procedure on the canary schema; configuring search paths for accounts designated for canary users to obtain canary search paths, wherein the search priority of the canary search paths is higher for the canary schema than for the original schema; and obtaining test results in response to tests performed by canary users according to the configured search paths, thereby enabling deployment strategies to be adopted based on the test results. This disclosure allows for deployment of new versions of stored procedures without system downtime, providing services externally, and also eliminates the need for system downtime when tests fail, thus improving the availability and stability of the database system. Furthermore, this disclosure requires no application-side cooperation for deployment changes, has low application invasiveness, simplifies deployment steps, reduces production operation and maintenance support difficulty, and minimizes deployment risks. Furthermore, this disclosure does not require building a new cluster. It only requires adding a grayscale mode to the existing application's database. At the same time, there is no need to copy the data from the original mode. Simply create a stored procedure in the grayscale mode logic, set the first priority of the search path to the grayscale mode, and the second priority to the original mode, to ensure that the application can access the data and objects in the original mode normally, thereby saving resources and reducing investment costs.

[0071] Based on the above-described method for canary deployment of database stored procedures, this disclosure also provides a canary deployment apparatus for database stored procedures. The following will be combined with... Figure 5 A detailed description of the canary deployment mechanism for database stored procedures is provided.

[0072] Figure 5 The diagram illustrates a structural block diagram of a grayscale publishing apparatus 10 for a database stored procedure according to an embodiment of the present disclosure.

[0073] The canary deployment device 10 for database stored procedures includes a creation module 1, a deployment module 2, a configuration module 3, an acquisition module 4, and a strategy module 5.

[0074] Create module 1, which is used to perform operation S11: Create a grayscale mode in the database that is a mirror image of the original mode, wherein the original mode and the grayscale mode are logically isolated.

[0075] Module 2 is used to perform operation S12: publish a new version of the database stored procedure in grayscale mode.

[0076] Configuration module 3 is used to perform operation S13: configure a search path for the account determined to be a grayscale user, and obtain a grayscale search path, wherein the search priority of the grayscale search path is that the grayscale mode is higher than the original mode.

[0077] Get module 4, which is used to perform operation S14: in response to the test performed by the grayscale user according to the configured search path, get the test result, wherein the test result is either a pass or a test error message.

[0078] Strategy module 5 is used to perform operation S15: Based on the test results, adopt a release strategy.

[0079] According to some embodiments of this disclosure, the canary release device for database stored procedures further includes a setting module.

[0080] The settings module is used to ensure that user permissions in grayscale mode are consistent with those in the original mode.

[0081] According to some embodiments of this disclosure, the strategy module includes a fully configured unit.

[0082] The full configuration unit is used to configure the search path of all users to have a higher search priority in grayscale mode than in the original mode when the test result is a pass.

[0083] According to some embodiments of this disclosure, the strategy module further includes a correction unit and a redistribution unit.

[0084] The correction unit is used to correct the stored procedure based on the test error feedback when the test result is a test error message.

[0085] The redistribution unit is used to redistribute the corrected stored procedure in grayscale mode and repeat operations S13 to S15.

[0086] The canary deployment apparatus 10 for database stored procedures according to embodiments of this disclosure involves: creating a canary mode in the database that mirrors the original mode; deploying a new version of the database stored procedure on the canary mode; configuring search paths for accounts of canary users to obtain canary search paths, wherein the search priority of the canary search paths is higher for the canary mode than for the original mode; and obtaining test results in response to tests performed by canary users according to the configured search paths, thereby enabling deployment strategies to be adopted based on the test results. This disclosure allows for deployment of new versions of stored procedures without system downtime, providing services externally, and also without downtime when tests fail, thus improving the availability and stability of the database system. Furthermore, the method of this disclosure requires no additional physical resources, resulting in lower costs and smaller investments; in addition, it eliminates the need for application-side cooperation in deployment changes, minimizing application intrusion, simplifying deployment steps, reducing production operation and maintenance support difficulties, and minimizing deployment risks.

[0087] Furthermore, according to embodiments of this disclosure, any and multiple modules among creation module 1, publishing module 2, configuration module 3, acquisition module 4, and strategy module 5 can be merged into one module, or any one of these modules can be split into multiple modules. Alternatively, at least some of the functionality of one or more of these modules can be combined with at least some of the functionality of other modules and implemented in one module.

[0088] According to embodiments of this disclosure, at least one of the creation module 1, publishing module 2, configuration module 3, acquisition module 4, and strategy module 5 can be at least partially implemented as hardware circuitry, such as a field-programmable gate array (FPGA), a programmable logic array (PLA), a system-on-a-chip, a system-on-a-substrate, a system-on-package, an application-specific integrated circuit (ASIC), or any other reasonable means of integrating or packaging the circuitry, or implemented in any one of the three methods of software, hardware, and firmware, or in a suitable combination of any of these.

[0089] Alternatively, at least one of the creation module 1, publishing module 2, configuration module 3, acquisition module 4, and strategy module 5 can be implemented at least partially as a computer program module that can perform corresponding functions when the computer program module is run.

[0090] The canary release apparatus for a database stored procedure according to embodiments of the present disclosure is described in detail below. It is to be understood that the following description is merely illustrative and not intended to limit the scope of the present disclosure.

[0091] This disclosure provides a canary release device for database stored procedures, which overcomes the shortcomings of existing technologies that cannot provide services externally during the release of stored procedures or require additional resources to achieve this. Furthermore, by using internal database creation of canary modes and control of search paths, it achieves the goal of switching canary modes without changing application connection configurations. Overall, it ensures the stability and service continuity of the database system, reduces operational complexity, lowers investment costs, and reduces deployment risks.

[0092] The canary deployment device for database stored procedures disclosed herein, during production system operation, involves creating a canary mode in the application database using a database administrator user, and assigning the owner and all permissions of this mode to the application users. The canary modes belong to the same application users but are logically isolated and do not affect each other. Next, a subset of users are selected as canary users, and their search paths are set (canary modes are prioritized first, and the original mode is prioritized second). This allows canary users to directly create stored procedures on the canary mode and call tables and data from the original mode. After setup, the canary users deploy the stored procedure to be released to the newly created canary mode, compile and execute it. After successful execution, the canary users test the successfully executed stored procedure in the canary mode using transaction rollback. If the verification fails, the stored procedure to be released can be modified and repeatedly compiled and executed on the canary mode until verification succeeds. After successful production verification, the search path for all application users can be set to grayscale (grayscale mode first, original mode second), thus completing the entire process of application users safely and seamlessly switching to grayscale mode to use the new version of the stored procedure.

[0093] The canary deployment apparatus for database stored procedures may include a unit for creating a canary mode, a unit for changing the search path for canary users, a unit for canary deployment of the stored procedure, a unit for testing the stored procedure, a unit for handling test error messages, and a unit for changing the search path for all application users.

[0094] The "Create Grayscale Schema" unit is primarily responsible for creating grayscale schemas in the application database using the database administrator user. The grayscale schema and the original schema are mirror images of each other, logically isolated, and do not affect each other. Simultaneously, the owner of the grayscale schema is changed to the owner of the original schema. To ensure consistent permissions between the grayscale and original schemas, the relevant permissions for the grayscale schema are granted to the relevant application users. Since the application users are co-owners of both the grayscale and original schemas, they can access both schemas normally. After granting permissions, the process is passed to the "Change Grayscale User Search Path" unit.

[0095] The "Change Gray-Scale User Search Path" unit selects one or more application users as gray-scale users and uses SQL commands to set their search path to: Gray-scale mode, original mode. This ensures that gray-scale users can preferentially create, compile, and execute stored procedures in gray-scale mode, while guaranteeing that stored procedures can correctly call stored procedures, data, and objects in the original mode during testing. After setting the search path, the process is handed over to the "Gray-Scale Deployment Stored Procedure" unit.

[0096] The canary release stored procedure unit is primarily responsible for enabling canary users to create, compile, and execute new versions of stored procedures in canary mode. During this period, the original mode is not involved, and there is no impact on existing business operations. After all new version stored procedures have been successfully executed, the test stored procedure unit will be executed.

[0097] The stored procedure testing unit is primarily responsible for using relevant canary testing users to verify the successful deployment of stored procedures in the canary release unit. Stored procedures involving table, data, and object queries can be executed directly for testing. Stored procedures involving adding, deleting, or modifying tables, data, and objects are verified using transaction rollback, ensuring both verification of the stored procedure and no changes to the original schema's data and objects. The verification process does not affect the original schema's business logic. If business logic verification passes, the process is submitted to the unit that changes the search path for all application users; if business logic verification fails, the process is submitted to the test error handling unit.

[0098] Test Error Handling Unit. This unit is primarily responsible for obtaining test error information for stored procedures, analyzing the reasons for failure, correcting relevant settings or the stored procedure based on the error information, and then submitting the corrected new version of the stored procedure to the canary release unit until no more error messages are reported.

[0099] This unit modifies the search path for all application users. It is responsible for changing the search path for all application users: grayscale mode and original mode. It sets grayscale mode as the current first-priority application mode, allowing applications to use the new version of stored procedures in grayscale mode normally, while also being able to access data and objects in the original mode.

[0100] The canary release method for a database stored procedure according to one embodiment of this disclosure is as follows.

[0101] In process S201, a grayscale mode unit is created. The database administrator user creates a grayscale mode in the application database and ensures that the grayscale mode and the original mode are mirror images of each other and have consistent application permissions by changing the mode owner and granting permissions.

[0102] In process S202, by changing the grayscale user search path unit, the search path for grayscale users is set to: grayscale mode, original mode using SQL commands.

[0103] In process S203, the stored procedure unit is released in a grayscale manner, allowing grayscale users to create, compile, and execute a new version of the stored procedure in grayscale mode. After setting the search path, the process is handed over to S204.

[0104] In process S204, the stored procedure unit is tested. Stored procedures involving table, data, and object queries can be directly executed for testing. Stored procedures involving adding, deleting, or modifying tables, data, and objects are tested using transaction rollback. If the test fails, process S205 proceeds; otherwise, process S206 proceeds.

[0105] In process S205, the test error handling unit obtains the test error information of the stored procedure, corrects the relevant settings or stored procedure based on the error information, and submits the corrected new version of the stored procedure to the gray release stored procedure unit until there are no more error messages.

[0106] Process S206, Change the search path for all application users: Change the search path for all application users: Grayscale mode, Original mode. Set the Grayscale mode as the current first-priority application mode. Applications can use the new version of stored procedures in the Grayscale mode normally, and can also call data and objects in the original mode normally.

[0107] Figure 6 A block diagram schematically illustrates an electronic device suitable for implementing the above-described method according to an embodiment of the present disclosure.

[0108] like Figure 6 As shown, an electronic device 900 according to an embodiment of the present disclosure includes a processor 901, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 902 or a program loaded from a storage portion 908 into a random access memory (RAM) 903. The processor 901 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or an associated chipset and / or a special-purpose microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 901 may also include onboard memory for caching purposes. The processor 901 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present disclosure.

[0109] RAM 903 stores various programs and data required for the operation of electronic device 900. Processor 901, ROM 902, and RAM 903 are interconnected via bus 904. Processor 901 performs various operations of the method flow according to embodiments of the present disclosure by executing programs in ROM 902 and / or RAM 903. It should be noted that the programs may also be stored in one or more memories other than ROM 902 and RAM 903. Processor 901 may also perform various operations of the method flow according to embodiments of the present disclosure by executing programs stored in said one or more memories.

[0110] According to embodiments of this disclosure, the electronic device 900 may further include an input / output (I / O) interface 905, which is also connected to a bus 904. The electronic device 900 may also include one or more of the following components connected to the I / O interface 905: an input section 906 including a keyboard, mouse, etc.; an output section 907 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 908 including a hard disk, etc.; and a communication section 909 including a network interface card such as a LAN card, modem, etc. The communication section 909 performs communication processing via a network such as the Internet. A drive 910 is also connected to the input / output (I / O) interface 905 as needed. A removable medium 911, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on the drive 910 as needed so that computer programs read from it can be installed into the storage section 908 as needed.

[0111] This disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or it may exist independently and not assembled into the device / apparatus / system. The computer-readable storage medium carries one or more programs that, when executed, implement the method according to the embodiments of this disclosure.

[0112] According to embodiments of this disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium, such as including, but not limited to: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this disclosure, the computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. For example, according to embodiments of this disclosure, the computer-readable storage medium may include ROM 902 and / or RAM 903 and / or one or more memories other than ROM 902 and RAM 903 described above.

[0113] Embodiments of this disclosure also include a computer program product comprising a computer program containing program code for performing the methods shown in the flowchart. When the computer program product is run on a computer system, the program code is used to cause the computer system to implement the methods of the embodiments of this disclosure.

[0114] When the computer program is executed by the processor 901, it performs the functions defined in the system / apparatus of this disclosure embodiments. According to embodiments of this disclosure, the systems, apparatuses, modules, units, etc., described above can be implemented by computer program modules.

[0115] In one embodiment, the computer program may rely on a tangible storage medium such as an optical storage device or a magnetic storage device. In another embodiment, the computer program may also be transmitted and distributed in the form of signals over a network medium, and downloaded and installed via the communication section 909, and / or installed from a removable medium 911. The program code contained in the computer program can be transmitted using any suitable network medium, including but not limited to: wireless, wired, etc., or any suitable combination thereof.

[0116] In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 909, and / or installed from the removable medium 911. When the computer program is executed by the processor 901, it performs the functions defined in the system of this disclosure embodiment. According to embodiments of this disclosure, the systems, devices, apparatuses, modules, units, etc., described above can be implemented by computer program modules.

[0117] According to embodiments of this disclosure, program code for executing the computer programs provided in embodiments of this disclosure can be written in any combination of one or more programming languages. Specifically, these computational programs can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages ​​include, but are not limited to, languages ​​such as Java, C++, Python, "C", or similar programming languages. The program code can execute entirely on the user's computing device, partially on the user's device, partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).

[0118] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0119] Those skilled in the art will understand that the features described in the various embodiments and / or claims of this disclosure can be combined and / or combined in various ways, even if such combinations or combinations are not explicitly described in this disclosure. In particular, the features described in the various embodiments and / or claims of this disclosure can be combined and / or combined in various ways without departing from the spirit and teachings of this disclosure. All such combinations and / or combinations fall within the scope of this disclosure.

[0120] The embodiments of this disclosure have been described above. However, these embodiments are for illustrative purposes only and are not intended to limit the scope of this disclosure. Although various embodiments have been described above, this does not mean that the measures in the various embodiments cannot be used advantageously in combination. The scope of this disclosure is defined by the appended claims and their equivalents. Various substitutions and modifications can be made by those skilled in the art without departing from the scope of this disclosure, and all such substitutions and modifications should fall within the scope of this disclosure.

Claims

1. A method for gray release of database stored procedures, the method comprising: The method comprises: creating a gray mode in the database, which is a mirror of an original mode, wherein the original mode and the gray mode are logically isolated, a mode is a collection of database objects, and the database objects are organized into logical groups that are easy to manage, and the database objects comprise tables, views, sequences, indexes, stored procedures, and functions; publishing a new version of a database stored procedure on the gray mode; configuring a search path for an account determined as a gray user to obtain a gray search path, wherein the search path is used to create an object or view an object in a first mode listed in the search path first in a database that allows one user to have multiple modes, and when the object is not found in the first mode, the object is sequentially found in other modes in the search path, and the search priority of the gray search path is that the gray mode is higher than the original mode; obtaining a test result in response to a test performed by the gray user according to the configured search path, wherein the test result is that the test is passed or test error information is fed back; and adopting a release strategy according to the test result.

2. The method of claim 1, wherein, After the gray mode is created in the database, the method further comprises: setting a user permission of the gray mode to be consistent with a user permission of the original mode.

3. The method of claim 1, wherein, The test comprises: directly performing a test on a queried stored procedure; performing a test on an added, deleted, or modified stored procedure by using transaction rollback.

4. The method of claim 1, wherein, The adopting a release strategy according to the test result comprises: when the test result is that the test is passed, the release strategy adopted is that a search path of all users is configured to be a search path with a search priority that the gray mode is higher than the original mode.

5. The method of claim 1, wherein, The adopting a release strategy according to the test result comprises: when the test result is that test error information is fed back, the release strategy adopted is that the stored procedure is corrected according to the test error information; and the corrected stored procedure is republished on the gray mode, and the configuring a search path for an account determined as a gray user to obtain a gray search path is repeatedly performed until the test result is that the test is passed.

6. The method of claim 1, wherein, The configuring a search path for an account determined as a gray user is implemented by using a structured query language instruction.

7. A canary deployment device for a database stored procedure, characterized in that, The method comprises: a creating module configured to create a gray mode in the database, which is a mirror of an original mode, wherein the original mode and the gray mode are logically isolated, a mode is a collection of database objects, and the database objects are organized into logical groups that are easy to manage, and the database objects comprise tables, views, sequences, indexes, stored procedures, and functions; a publishing module configured to publish a new version of a database stored procedure on the gray mode; and a test module configured to perform a test on the stored procedure in the gray mode. The configuration module is configured to configure a search path for an account determined as a gray user, and obtain a gray search path, wherein the search path is used to create an object or view an object in a database allowing one user to have multiple modes, and the search is first performed in a first mode listed in the search path when searching for an object, and the search is sequentially performed in other modes in the search path when the object is not found in the first mode; and the search priority of the gray search path is higher than that of an original mode. The obtaining module is configured to obtain a test result in response to a test performed by the gray user according to the configured search path, wherein the test result is a test pass or test error information feedback; and The policy module is configured to take a publishing policy according to the test result.

8. An electronic device, comprising: The method comprises the following steps: one or more processors; one or more memories for storing executable instructions, which, when executed by the processor, implement the method according to any one of claims 1-6.

9. A computer-readable storage medium, characterized in that, The storage medium has stored executable instructions, which, when executed by the processor, implement the method according to any one of claims 1-6.

10. A computer program product, characterised in that, The computer program comprises one or more executable instructions, which, when executed by the processor, implement the method according to any one of claims 1-6.

Citation Information

Patent Citations

  • A rule publishing method and apparatus for a database

    CN109271387A

  • Product gray release method and device based on gray database, equipment and medium

    CN112948278A