Cross-Cluster Missing Table Permission Synchronization Method and Device

The method synchronizes missing table structures and permissions across clusters using build and grant scripts, addressing inconsistent metadata and ensuring service availability.

CN114860754BActive Publication Date: 2025-07-15INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210390329.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-14
Publication Date
2025-07-15
Estimated Expiration
2042-04-14

AI Technical Summary

Technical Problem

After the primary and secondary clusters are used for a long time, some tables are missing due to various reasons, resulting in the loss of the primary and secondary cluster table structure and user read and write permissions, affecting service availability.

Method used

By obtaining the inventory table list of each cluster, generating a list of missing subtables, splicing the table creation statement and user query script, running the script separately to obtain the table creation statement and the empowerment statement, and executing the synchronous script in parallel to synchronize the missing table permissions.

Benefits of technology

Ensure the consistency of cluster metadata, avoid service unavailability, and realize missing tables and permission synchronization across clusters.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114860754B_ABST
    Figure CN114860754B_ABST
Patent Text Reader

Abstract

The present invention provides a method and device for synchronizing missing table permissions across clusters, which relates to the technical field of cloud computing and can be applied to the financial technology field or other technical fields. The method for synchronizing missing table permissions across clusters includes: obtaining a list of missing sub-tables according to the inventory table list of each cluster; splicing the list of missing sub-tables to generate a table creation statement query script and a user query script respectively; running the table creation statement query script and the user query script respectively to obtain a table creation statement and a permission granting statement; splicing the table creation statement and the corresponding permission granting statement to obtain a table permission synchronization script, and executing the table permission synchronization script in parallel to synchronize the missing table permissions. The present invention can ensure the consistency of cluster metadata and avoid service unavailability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of cloud computing, and specifically, to a method and device for synchronizing missing table permissions across clusters. Background Art

[0002] With the continuous expansion of the data scale, distributed systems are currently mainly used to store data. To ensure data security and service availability in extreme situations, a primary and standby cluster is generally built. When a new cluster is built, metadata is synchronized. However, in actual application scenarios, after long-term use of the cluster, some tables may be missing due to various reasons, further resulting in the missing of the table structure in the primary and standby clusters, and at the same time, the missing of user read and write permissions for the corresponding tables. Summary of the Invention

[0003] The main purpose of the embodiments of the present invention is to provide a method and device for synchronizing missing table permissions across clusters to complete the synchronization of missing tables and permissions, ensure the consistency of cluster metadata, and avoid service unavailability.

[0004] To achieve the above purpose, an embodiment of the present invention provides a method for synchronizing missing table permissions across clusters, including:

[0005] Obtaining a list of missing sub-tables according to the inventory table list of each cluster;

[0006] Concatenating the list of missing sub-tables to generate a table creation statement query script and a user query script respectively;

[0007] Running the table creation statement query script and the user query script respectively to obtain a table creation statement and a permission assignment statement;

[0008] Concatenating the table creation statement and the corresponding permission assignment statement to obtain a table permission synchronization script, and executing the table permission synchronization script in parallel to synchronize the missing table permissions.

[0009] In one embodiment, obtaining a list of missing sub-tables according to the inventory table list of each cluster includes:

[0010] Obtaining a list of missing tables according to the inventory table list of each cluster;

[0011] Splitting the list of missing tables to obtain a list of missing sub-tables.

[0012] In one embodiment, running the table creation statement query script and the user query script respectively to obtain a table creation statement and a permission assignment statement includes:

[0013] Running the table creation statement query script and the user query script respectively to obtain an intermediate table creation statement and an intermediate permission assignment statement;

[0014] Obtaining a table creation statement according to the intermediate table creation statement, and obtaining a permission assignment statement according to the intermediate permission assignment statement.

[0015] In one embodiment, separately running the table creation statement query script and the user query script to obtain the intermediate table creation statement and the intermediate authorization statement includes:

[0016] Determine the non-missing clusters according to the inventory table list of each cluster;

[0017] Run the table creation statement query script and the user query script on the non-missing clusters respectively to obtain the intermediate table creation statement and the intermediate authorization statement.

[0018] In one embodiment, it further includes:

[0019] Obtain the corresponding user list according to the missing sub-table list;

[0020] Generate authorization statements according to the user list.

[0021] In one embodiment, it further includes:

[0022] Obtain the authorization statement from the full amount statement according to the table name in the missing sub-table list.

[0023] The embodiment of the present invention also provides a cross-cluster missing table permission synchronization device, including:

[0024] The missing sub-table list module is used to obtain the missing sub-table list according to the inventory table list of each cluster;

[0025] The query script generation module is used to splice the missing sub-table list to generate the table creation statement query script and the user query script respectively;

[0026] The script running module is used to separately run the table creation statement query script and the user query script to obtain the table creation statement and the authorization statement;

[0027] The missing table permission synchronization module is used to splice the table creation statement and the corresponding authorization statement to obtain the table permission synchronization script, and execute the table permission synchronization script in parallel to synchronize the missing table permissions.

[0028] In one embodiment, the missing sub-table list module includes:

[0029] The missing table list unit is used to obtain the missing table list according to the inventory table list of each cluster;

[0030] The missing sub-table list unit is used to split the missing table list to obtain the missing sub-table list.

[0031] In one embodiment, the script running module includes:

[0032] The intermediate statement unit is used to separately run the table creation statement query script and the user query script to obtain the intermediate table creation statement and the intermediate authorization statement;

[0033] A table creation and authorization statement unit is used to obtain a table creation statement according to the intermediate table creation statement and obtain an authorization statement according to the intermediate authorization statement.

[0034] In one embodiment, the intermediate statement unit includes:

[0035] An intact cluster determination subunit is used to determine intact clusters according to the inventory table list of each cluster;

[0036] An intermediate statement subunit is used to separately run a table creation statement query script and a user query script on the intact clusters to obtain an intermediate table creation statement and an intermediate authorization statement.

[0037] In one embodiment, it further includes:

[0038] A user list module is used to obtain a corresponding user list according to the missing sub-table list;

[0039] A first authorization statement module is used to generate an authorization statement according to the user list.

[0040] In one embodiment, it further includes:

[0041] A second authorization statement module is used to obtain an authorization statement from the full-scale statements according to the table names in the missing sub-table list.

[0042] An embodiment of the present invention also provides a computer device, including a memory, a processor, and a computer program stored on the memory and running on the processor. When the processor executes the computer program, the steps of the cross-cluster missing table permission synchronization method are implemented.

[0043] An embodiment of the present invention also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the cross-cluster missing table permission synchronization method are implemented.

[0044] An embodiment of the present invention also provides a computer program product, including a computer program / instructions. When the computer program / instructions are executed by a processor, the steps of the cross-cluster missing table permission synchronization method are implemented.

[0045] The cross-cluster missing table permission synchronization method and device according to the embodiments of the present invention obtain a missing sub-table list according to the inventory table list of each cluster, splice them to generate a table creation statement query script and a user query script, run the query script to obtain a table creation statement and an authorization statement, and parallelly execute the table permission synchronization script obtained by splicing the table creation statement and the authorization statement to synchronize the missing table permissions, which can ensure the consistency of cluster metadata and avoid service unavailability. Description of the Drawings

[0046] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the accompanying drawings required for the description of the embodiments. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other accompanying drawings can be obtained based on these drawings.

[0047] Figure 1 is a flowchart of the method for synchronizing missing table permissions across clusters in an embodiment of the present invention;

[0048] Figure 2 is a flowchart of the method for synchronizing missing table permissions across clusters in another embodiment of the present invention;

[0049] Figure 3 is a flowchart of the method for synchronizing missing table permissions across clusters in yet another embodiment of the present invention;

[0050] Figure 4 is a flowchart of S103 in an embodiment of the present invention;

[0051] Figure 5 is a structural block diagram of the device for synchronizing missing table permissions across clusters in an embodiment of the present invention;

[0052] Figure 6 is a structural block diagram of a computer device in an embodiment of the present invention. Detailed implementation manners

[0053] The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, rather than all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of protection of the present invention.

[0054] Those skilled in the art know that the embodiments of the present invention can be implemented as a system, device, equipment, method, or computer program product. Therefore, the present disclosure can be specifically implemented in the following forms: completely hardware, completely software (including firmware, resident software, microcode, etc.), or a combination of hardware and software.

[0055] In view of the fact that after long-term use, some tables may be missing in the cluster due to various reasons, and the permissions for users to read and write the corresponding tables may also be missing. The embodiments of the present invention provide a method for synchronizing missing table permissions across clusters. By comparing the existing tables in two clusters (such as Cluster A and Cluster B), a list of missing tables in the clusters is obtained. Subsequently, according to the list of missing tables, the table creation statements and the list of accessing users of the corresponding tables are obtained on Cluster A. At the same time, the table creation statements and the list of users are processed to generate the table creation script and the permission assignment statements for Cluster B. Finally, log in to Cluster B and execute the table creation script and the permission assignment statements to complete the synchronization of the missing tables and permissions, thus ensuring the consistency of Clusters A and B and avoiding service unavailability in extreme cases. The present invention will be described in detail below with reference to the accompanying drawings.

[0056] Figure 1 It is a flowchart of the method for synchronizing missing table permissions across clusters in the embodiments of the present invention. Figure 2 It is a flowchart of the method for synchronizing missing table permissions across clusters in another embodiment of the present invention. Figure 3 It is a flowchart of the method for synchronizing missing table permissions across clusters in yet another embodiment of the present invention. As Figures 1-3 shown, the present invention is mainly divided into three parts: obtaining the list of missing tables, generating the synchronization script, and executing the synchronization script. Obtaining the list of missing tables mainly involves obtaining the list of existing tables in the clusters to be synchronized (such as Cluster A and Cluster B), comparing the list of existing tables, and generating the list of missing tables; generating the synchronization script mainly includes batch obtaining of table creation statements, batch processing of table creation statements, obtaining of accessing users, and generating of table creation statements and permission assignment statements. After executing the synchronization script, the synchronization of the missing tables and user permissions in the cluster is completed. The method for synchronizing missing table permissions across clusters in the embodiments of the present invention includes:

[0057] S101: Obtain the list of missing sub-tables according to the list of existing tables in each cluster.

[0058] Currently, the list of existing tables in each cluster can be obtained through the following three methods:

[0059] 1. Obtain through the knowledge base. Log in to the knowledge base of the corresponding cluster and obtain the list of existing tables from the corresponding tables. For example, generate the list of existing tables of the corresponding cluster through select system;table_name from bdp_src.

[0060] 2. Obtain through the meta-database of the cluster. After authenticating the user with access permission to the cluster meta-database, query through the hive component to generate the list of tables of the corresponding cluster.

[0061] 3. Obtain the corresponding table list through the cluster storage directory structure. For example, after obtaining all the table directory structures under the library level hive through Hadoop fs - ls / user / hive / (such as / user / hive / dcm_ecs_tebb_1010 / ), process the directory structure according to the delimiter (for example, obtain the table name dcm_ecs_tebb_1010 by intercepting the directory structure through the delimiter).

[0062] In one embodiment, S101 includes:

[0063] Obtain the missing table list according to the inventory table list of each cluster; split the missing table list to obtain the missing sub - table list.

[0064] For example, assume that cluster B is the cluster with missing tables. After obtaining the inventory table lists of cluster A and cluster B, compare the inventory table lists to obtain the missing table list of cluster B.

[0065] In actual applications, since there are many missing table lists, in order to reduce the execution time of the synchronization process, the missing table list can be evenly split. For example, if the missing table list is Hive, it is evenly split into n sub - table lists such as hive1, hive2, hive3... hiven according to the number of missing tables.

[0066] S102: Concatenate the missing sub - table lists to generate the create - table statement query script and the user query script respectively.

[0067] Specifically, according to the n missing sub - table lists after splitting, concatenate them into n batch create - table statement query scripts. For example: show create table ecs.XXX.

[0068] In the actual environment, if it can be ensured that the permissions of the non - missing cluster (such as cluster A) are full, then the corresponding permissions can be directly obtained on cluster A. According to the n missing sub - table lists (such as hive1, hive2, hive3... hiven) after splitting, concatenate them into a batch of user query scripts, such as: show grant on table XXX.

[0069] S103: Run the create - table statement query script and the user query script respectively to obtain the create - table statement and the authorization statement.

[0070] Figure 4 It is the flowchart of S103 in the embodiment of the present invention. As Figure 4 shown, S103 includes:

[0071] S201: Run the create - table statement query script and the user query script respectively to obtain the create - table intermediate statement and the authorization intermediate statement.

[0072] In one embodiment, S201 includes: determining non-missing clusters according to the inventory list of each cluster; respectively running a table creation statement query script and a user query script on the non-missing clusters to obtain an intermediate table creation statement and an intermediate authorization statement.

[0073] For example, if the non-missing cluster is Cluster A, then log in to Cluster A and batch run the table creation statement query script to obtain n intermediate table creation statements into the corresponding n intermediate files (such as hive1.log, hive2.log... hiven.log).

[0074] If the permissions of Cluster A are full, then log in to Cluster A and batch run the user query script to obtain n intermediate authorization statements into the corresponding n intermediate files.

[0075] S202: Obtain a table creation statement according to the intermediate table creation statement, and obtain an authorization statement according to the intermediate authorization statement.

[0076] In specific implementation, there are some special characters in both the n intermediate table creation statements and the n intermediate authorization statements. It is necessary to remove the special characters in the intermediate statements and respectively generate n executable table creation statements (such as create1.hql, create2.hql... createn.hql) and n executable authorization statements (such as grant1.hql, grant2.hql... grantn.hql).

[0077] In one embodiment, it further includes: obtaining a corresponding user list according to the missing sub-table list; generating an authorization statement according to the user list; or obtaining an authorization statement from the full amount of statements according to the table names in the missing sub-table list.

[0078] When the permissions of Cluster A are not full permissions, it can be processed in the following two ways:

[0079] 1. Obtain the registered user list in the permission registration system of Cluster A according to the table names in the n split missing sub-table lists, and generate the corresponding n authorization statements according to the user list, such as grant select on tableXXX to group ZZZ.

[0080] 2. Obtain n authorization statements from the full amount of authorization statements (such as auto_fq.hql) according to the table names in the n split missing sub-table lists.

[0081] S104: Concatenate the table creation statement and the corresponding authorization statement to obtain a table permission synchronization script, and execute the table permission synchronization script in parallel to synchronize the missing table permissions.

[0082] During specific implementation, the table creation statements (create1.hql, create2.hql... createn.hql) and permission granting statements (grant1.hql, grant2.hql... grantn.hql) are concatenated together in the split order, with table creation first and permission granting second, to generate n table structure and permission synchronization scripts (such as create_grant1.hql, create_grant2.hql... create_grantn.hql). After authenticating the table permission synchronization scripts on the missing B cluster, the n table permission synchronization scripts are executed in parallel to improve the execution efficiency of the scripts.

[0083] Figure 1 The execution entity of the cross-cluster missing table permission synchronization method shown can be a computer. From Figure 1 the process shown, it can be seen that the cross-cluster missing table permission synchronization method in the embodiments of the present invention obtains the missing sub-table list based on the inventory table list of each cluster, splices them to generate a table creation statement query script and a user query script, runs the query scripts to obtain the table creation statement and the permission granting statement, and executes the table permission synchronization script obtained by concatenating the table creation statement and the permission granting statement in parallel to synchronize the missing table permissions, which can ensure the consistency of cluster metadata and avoid service unavailability.

[0084] The specific process of the embodiments of the present invention is as follows:

[0085] 1. Obtain the missing table list based on the inventory table list of each cluster, and split the missing table list to obtain the missing sub-table list.

[0086] 2. Splice the missing sub-table list to generate a table creation statement query script and a user query script respectively.

[0087] 3. When the non-missing cluster has full permissions, determine the non-missing cluster based on the inventory table list of each cluster, and run the table creation statement query script and the user query script on the non-missing cluster respectively to obtain the intermediate table creation statement and the intermediate permission granting statement.

[0088] 4. Obtain the table creation statement based on the intermediate table creation statement, and obtain the permission granting statement based on the intermediate permission granting statement.

[0089] 5. When the non-missing cluster does not have full permissions, obtain the corresponding user list based on the missing sub-table list,

[0090] generate the permission granting statement according to the user list; or obtain the permission granting statement from the full statement according to the table name in the missing sub-table list.

[0091] 6. Concatenate the table creation statement and the corresponding permission granting statement to obtain a table permission synchronization script, and execute the table permission synchronization script in parallel to synchronize the missing table permissions.

[0092] In summary, the method for synchronizing missing table permissions across clusters according to the embodiments of the present invention obtains a list of missing tables by comparing the inventory table lists of two clusters, queries and obtains the table creation and permission-granting users according to the list of missing tables, processes to obtain the final synchronization statement, and realizes the synchronization of the missing table structure and user permissions across clusters. It solves the problem of missing cluster tables caused by various reasons in the actual application scenarios of distributed systems, and ensures the consistency of cluster metadata.

[0093] Based on the same inventive concept, the embodiments of the present invention also provide a device for synchronizing missing table permissions across clusters. Since the principle of the device for solving problems is similar to that of the method for synchronizing missing table permissions across clusters, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be elaborated.

[0094] Figure 5 It is the structural block diagram of the device for synchronizing missing table permissions across clusters in the embodiments of the present invention. As Figure 5 shown, the device for synchronizing missing table permissions across clusters includes:

[0095] A missing sub-table list module, configured to obtain a list of missing sub-tables according to the inventory table lists of each cluster;

[0096] A query script generation module, configured to splice the list of missing sub-tables to generate a table creation statement query script and a user query script respectively;

[0097] A script running module, configured to run the table creation statement query script and the user query script respectively to obtain a table creation statement and a permission-granting statement;

[0098] A missing table permission synchronization module, configured to splice the table creation statement and the corresponding permission-granting statement to obtain a table permission synchronization script, and execute the table permission synchronization script in parallel to synchronize the missing table permissions.

[0099] In one of the embodiments, the missing sub-table list module includes:

[0100] A missing table list unit, configured to obtain a list of missing tables according to the inventory table lists of each cluster;

[0101] A missing sub-table list unit, configured to split the list of missing tables to obtain a list of missing sub-tables.

[0102] In one of the embodiments, the script running module includes:

[0103] An intermediate statement unit, configured to run the table creation statement query script and the user query script respectively to obtain a table creation intermediate statement and a permission-granting intermediate statement;

[0104] A table creation and permission-granting statement unit, configured to obtain a table creation statement according to the table creation intermediate statement and a permission-granting statement according to the permission-granting intermediate statement.

[0105] In one embodiment, the intermediate statement unit includes:

[0106] A non - missing cluster determination subunit, configured to determine non - missing clusters according to the inventory list of each cluster;

[0107] An intermediate language sentence unit, configured to separately run a table - creation statement query script and a user query script on the non - missing clusters to obtain a table - creation intermediate statement and an authorization intermediate statement.

[0108] In one embodiment, it further includes:

[0109] A user list module, configured to obtain a corresponding user list according to the missing sub - table list;

[0110] A first authorization statement module, configured to generate an authorization statement according to the user list.

[0111] In one embodiment, it further includes:

[0112] A second authorization statement module, configured to obtain an authorization statement from the full - volume statements according to the table names in the missing sub - table list.

[0113] In summary, the cross - cluster missing table permission synchronization device according to the embodiments of the present invention obtains a missing sub - table list according to the inventory list of each cluster, splices it to generate a table - creation statement query script and a user query script, runs the query scripts to obtain a table - creation statement and an authorization statement, and executes the table permission synchronization script obtained by splicing the table - creation statement and the authorization statement in parallel to synchronize the missing table permissions, which can ensure the consistency of cluster metadata and avoid service unavailability.

[0114] The embodiments of the present invention also provide a specific implementation manner of a computer device capable of implementing all steps in the above - mentioned cross - cluster missing table permission synchronization method. Figure 6 It is a structural block diagram of the computer device in the embodiments of the present invention. Refer to Figure 6 , and the computer device specifically includes the following:

[0115] A processor 601 and a memory 602.

[0116] The processor 601 is configured to call a computer program in the memory 602. When the processor executes the computer program, it implements all steps in the above - mentioned cross - cluster missing table permission synchronization method. For example, when the processor executes the computer program, it implements the following steps:

[0117] Obtain a missing sub - table list according to the inventory list of each cluster;

[0118] Splice the missing sub - table list to separately generate a table - creation statement query script and a user query script;

[0119] Run the table creation statement query script and the user query script separately to obtain the table creation statement and the authorization statement;

[0120] Concatenate the table creation statement and the corresponding authorization statement to obtain a table permission synchronization script, and execute the table permission synchronization script in parallel to synchronize the missing table permissions.

[0121] In summary, the computer device according to the embodiment of the present invention obtains a list of missing sub-tables based on the inventory table list of each cluster, splices them to generate a table creation statement query script and a user query script, runs the query script to obtain the table creation statement and the authorization statement, and executes the table permission synchronization script obtained by concatenating the table creation statement and the authorization statement in parallel to synchronize the missing table permissions, which can ensure the consistency of cluster metadata and avoid service unavailability.

[0122] The embodiment of the present invention also provides a computer-readable storage medium capable of implementing all steps in the cross-cluster missing table permission synchronization method in the above embodiment. A computer program is stored on the computer-readable storage medium. When the computer program is executed by a processor, all steps in the cross-cluster missing table permission synchronization method in the above embodiment are implemented. For example, when the processor executes the computer program, the following steps are implemented:

[0123] Obtain a list of missing sub-tables based on the inventory table list of each cluster;

[0124] Splice the list of missing sub-tables to generate a table creation statement query script and a user query script respectively;

[0125] Run the table creation statement query script and the user query script separately to obtain the table creation statement and the authorization statement;

[0126] Concatenate the table creation statement and the corresponding authorization statement to obtain a table permission synchronization script, and execute the table permission synchronization script in parallel to synchronize the missing table permissions.

[0127] In summary, the computer-readable storage medium according to the embodiment of the present invention obtains a list of missing sub-tables based on the inventory table list of each cluster, splices them to generate a table creation statement query script and a user query script, runs the query script to obtain the table creation statement and the authorization statement, and executes the table permission synchronization script obtained by concatenating the table creation statement and the authorization statement in parallel to synchronize the missing table permissions, which can ensure the consistency of cluster metadata and avoid service unavailability.

[0128] An embodiment of the present invention also provides a computer program product capable of implementing all steps in the cross-cluster missing table permission synchronization method in the above embodiment. The computer program product includes a computer program / instructions, and when the computer program / instructions are executed by a processor, all steps in the cross-cluster missing table permission synchronization method in the above embodiment are implemented. For example, when the processor executes the computer program, the following steps are implemented:

[0129] Obtain a list of missing sub-tables according to the inventory table list of each cluster;

[0130] Concatenate the list of missing sub-tables to generate a table creation statement query script and a user query script respectively;

[0131] Run the table creation statement query script and the user query script respectively to obtain a table creation statement and a permission assignment statement;

[0132] Concatenate the table creation statement and the corresponding permission assignment statement to obtain a table permission synchronization script, and execute the table permission synchronization script in parallel to synchronize the missing table permissions.

[0133] In summary, the computer program product of the embodiment of the present invention obtains a list of missing sub-tables according to the inventory table list of each cluster, concatenates them to generate a table creation statement query script and a user query script, runs the query script to obtain a table creation statement and a permission assignment statement, and executes the table permission synchronization script obtained by concatenating the table creation statement and the permission assignment statement in parallel to synchronize the missing table permissions, which can ensure the consistency of cluster metadata and avoid service unavailability.

[0134] In the above specific embodiments, the purpose, technical solution, and beneficial effects of the present invention have been further described in detail. It should be understood that the above are only specific embodiments of the present invention and are not used to limit the protection scope of the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

[0135] Those skilled in the art can also understand that the various illustrative logical blocks, units, and steps listed in the embodiments of the present invention can be implemented by electronic hardware, computer software, or a combination of the two. To clearly show the interchangeability of hardware and software, the above various illustrative components, units, and steps have been generally described in terms of their functions. Whether such functions are implemented by hardware or software depends on the specific application and the design requirements of the entire system. Those skilled in the art can use various methods to implement the described functions for each specific application, but such implementation should not be construed as exceeding the protection scope of the embodiments of the present invention.

[0136] In the embodiments of the present invention, the various illustrative logical blocks, or units, or devices can be implemented or operated with the described functions by a general-purpose processor, a digital signal processor, an application specific integrated circuit (ASIC), a field programmable gate array or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or any combination of the above designs. The general-purpose processor can be a microprocessor. Optionally, the general-purpose processor can also be any conventional processor, controller, microcontroller or state machine. The processor can also be implemented by a combination of computing devices, such as a digital signal processor and a microprocessor, multiple microprocessors, one or more microprocessors combined with a digital signal processor core, or any other similar configuration.

[0137] The steps of the methods or algorithms described in the embodiments of the present invention can be directly embedded in hardware, software modules executed by a processor, or a combination of the two. The software modules can be stored in a RAM memory, a flash memory, a ROM memory, an EPROM memory, an EEPROM memory, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium in the art. Exemplarily, the storage medium can be connected to the processor so that the processor can read information from the storage medium and write information to the storage medium. Optionally, the storage medium can also be integrated into the processor. The processor and the storage medium can be disposed in an ASIC, and the ASIC can be disposed in a user terminal. Optionally, the processor and the storage medium can also be disposed in different components of the user terminal.

[0138] In one or more exemplary designs, the functions described above in embodiments of the present invention may be implemented in hardware, software, firmware, or any combination thereof. If implemented in software, the functions may be stored on or transmitted over as one or more instructions or code on a computer-readable medium. The computer-readable medium includes both computer storage media and communication media facilitating transfer of a computer program from one place to another. The storage media may be any available media that can be accessed by a general purpose or special purpose computer. By way of example, and not limitation, such computer-readable media can comprise RAM, ROM, EEPROM, CD-ROM or other optical disk storage, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a general purpose or special purpose computer, or a general purpose or special purpose processor. In addition, any connection is properly termed a computer-readable medium, such as if the software is transmitted from a website, server, or other remote source over a coaxial cable, fiber optic cable, twisted pair, DSL, or wirelessly such as infrared, radio, and microwave. Disk and disc include compact disk, laser disk, optical disk, DVD, floppy disk, and Blu-ray disk where disks usually reproduce data magnetically, while discs reproduce data optically with lasers. The above combination may also be included within computer-readable media.

Claims

1. A method for synchronizing missing table permissions across clusters, characterized in that, It includes: Obtain a list of missing sub - tables according to the inventory list of each cluster; Concatenate the list of missing sub - tables to generate a table - creation statement query script and a user query script respectively; Run the table - creation statement query script and the user query script respectively to obtain a table - creation statement and a privilege - granting statement; Concatenate the table - creation statement and the corresponding privilege - granting statement to obtain a table - privilege synchronization script, and execute the table - privilege synchronization script in parallel to synchronize the missing table privileges; Wherein, the method further includes: Obtain a corresponding user list according to the list of missing sub - tables; Generate the privilege - granting statement according to the user list; Wherein, the method further includes: Obtain the privilege - granting statement from the full - volume statement according to the table names in the list of missing sub - tables.

2. The method for synchronizing missing table permissions across clusters according to claim 1, wherein Obtaining a list of missing sub - tables according to the inventory list of each cluster includes: Obtain a list of missing tables according to the inventory list of each cluster; Split the list of missing tables to obtain the list of missing sub - tables.

3. The cross-cluster missing table permission synchronization method according to claim 1, wherein Running the table - creation statement query script and the user query script respectively to obtain a table - creation statement and a privilege - granting statement includes: Run the table - creation statement query script and the user query script respectively to obtain an intermediate table - creation statement and an intermediate privilege - granting statement; Obtain the table - creation statement according to the intermediate table - creation statement, and obtain the privilege - granting statement according to the intermediate privilege - granting statement.

4. The cross-cluster missing table permission synchronization method according to claim 3, wherein Running the table - creation statement query script and the user query script respectively to obtain an intermediate table - creation statement and an intermediate privilege - granting statement includes: Determine the non - missing clusters according to the inventory list of each cluster; Run the table - creation statement query script and the user query script respectively on the non - missing clusters to obtain an intermediate table - creation statement and an intermediate privilege - granting statement.

5. A cross-cluster missing table permission synchronization device, characterized in that, It includes: A missing sub - table list module, which is used to obtain a list of missing sub - tables according to the inventory list of each cluster; A query script generation module, which is used to concatenate the list of missing sub - tables to generate a table - creation statement query script and a user query script respectively; A script running module, which is used to run the table - creation statement query script and the user query script respectively to obtain a table - creation statement and a privilege - granting statement; A missing table - privilege synchronization module, which is used to concatenate the table - creation statement and the corresponding privilege - granting statement to obtain a table - privilege synchronization script, and execute the table - privilege synchronization script in parallel to synchronize the missing table privileges; Wherein, the device further includes: A user list module, which is used to obtain a corresponding user list according to the list of missing sub - tables; A first privilege - granting statement module, which is used to generate a privilege - granting statement according to the user list; Wherein, the device further includes: A second privilege - granting statement module, which is used to obtain a privilege - granting statement from the full - volume statement according to the table names in the list of missing sub - tables.

6. A computer device, comprising a memory, a processor, and a computer program stored on the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the cross - cluster missing table - privilege synchronization method according to any one of claims 1 to 4.

7. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the cross - cluster missing table - privilege synchronization method according to any one of claims 1 to 4.

8. A computer program product, comprising a computer program / instructions, characterized in that, When the computer program / instructions are executed by the processor, it implements the steps of the cross - cluster missing table - privilege synchronization method according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • Database cluster, data query method and data synchronism method and device

    CN104199881A

  • Cluster data synchronization method and device based on big data, equipment and storage medium

    CN110795499A