Data processing method and apparatus, electronic device, and storage medium

By receiving tenant identification and data change instructions and calling relevant microservices to process tenant space data, the data isolation problem in multi-tenant architecture is solved, efficient tenant management and resource utilization are achieved, and operation and maintenance costs are reduced.

WO2024244732A1PCT designated stage expired Publication Date: 2024-12-05BOE TECHNOLOGY GROUP CO LTD +1

Patent Information

Application Number
PCT/CN2024/087998
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-05-31
Filing Date
2024-04-16
Publication Date
2024-12-05

AI Technical Summary

Technical Problem

In a multi-tenant architecture, it is difficult for the existing technology to effectively achieve data isolation to prevent illegal acquisition and tampering of tenant data, and the existing methods have large changes at the code level or high operation and maintenance costs.

Method used

By receiving a service request carrying a tenant's identity, determine the tenant information, and use this information to call the relevant microservices, process the data tables in the tenant space in response to the data change instructions, realize data isolation, and do not affect the existing microservice framework Multi-tenant management is carried out in the case.

Benefits of technology

It improves data isolation effect, reduces the use of database servers, accelerates the initialization of tenant space, improves user experience, and reduces operation and maintenance costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024087998_05122024_PF_FP_ABST
    Figure CN2024087998_05122024_PF_FP_ABST
Patent Text Reader

Abstract

The present disclosure relates to the technical fields of databases, cloud platforms, and microservices, and provides a data processing method and apparatus, an electronic device, and a storage medium. The method comprises: receiving a service request from a first tenant, wherein the service request carries a tenant identifier; determining first tenant information of the first tenant from a tenant table on the basis of the tenant identifier, wherein the tenant table is located in a public space of a database; calling at least one first microservice related to the first tenant by using the first tenant information; and in response to obtaining a data change instruction, on the basis of the first tenant information and the data change instruction, performing data processing on a data table in a first tenant space associated with the first tenant in the database, wherein the data change instruction is generated in the process of calling the at least one first microservice.
Need to check novelty before this filing date? Find Prior Art

Description

Data processing method, device, electronic device and storage medium Technical Field

[0001] The present disclosure relates to the fields of database, cloud platform and microservice technology, and in particular to a data processing method, device, electronic device and storage medium. Background Art

[0002] Multi-tenancy is an architectural design approach whereby a SaaS system running on one or a group of servers can provide services to multiple tenants. The goal is to allow multiple tenants to use the same application in an internet environment while ensuring data isolation between tenants. The key to a multi-tenant architecture is the isolation of data between multiple tenants within the same application. Because tenant data is centrally stored, ensuring data security hinges on isolating tenant data to prevent inadvertent or malicious access and tampering.

[0003] Summary of the Invention

[0004] The present disclosure provides a data processing method, apparatus, electronic device, and storage medium.

[0005] According to one aspect of the present disclosure, a data processing method is provided, including: receiving a service request from a first tenant, wherein the service request carries a tenant identifier; determining first tenant information of the first tenant from a tenant table based on the tenant identifier, wherein the tenant table is located in a public space of a database; using the first tenant information to call at least one first microservice related to the first tenant; and in response to obtaining a data change instruction, performing data processing on a data table in the first tenant space associated with the first tenant in the database based on the first tenant information and the data change instruction, wherein the data change instruction is generated during the calling process of the at least one first microservice.

[0006] According to another aspect of the present disclosure, a data processing device is provided, including: a receiving module for receiving a service request from a first tenant, wherein the service request carries a tenant identifier; a first determination module for determining the first tenant information of the first tenant from a tenant table based on the tenant identifier, wherein the tenant table is located in a public space of a database; a calling module for using the first tenant information to call at least one first microservice related to the first tenant; and a processing module for performing data processing on a data table in the first tenant space associated with the first tenant in the database based on the first tenant information and the data change instruction in response to obtaining a data change instruction, wherein the data change instruction is generated during the calling process of the at least one first microservice.

[0007] According to another aspect of the present disclosure, an electronic device is provided, including a memory and a processor, wherein instructions executable by the processor are stored in the memory, and when the instructions are executed by the processor, the processor executes the method described above.

[0008] According to another aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable a computer to execute and implement the method described above.

[0009] According to another aspect of the present disclosure, a computer program product is provided, comprising a computer program, which implements the method described above when executed by a processor.

[0010] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present disclosure, nor are they intended to limit the scope of the present disclosure. Other features of the present disclosure will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] The accompanying drawings are provided to facilitate a better understanding of the present invention and do not constitute a limitation of the present disclosure.

[0012] FIG1 schematically shows an exemplary system architecture to which the data processing method and apparatus according to an embodiment of the present disclosure can be applied.

[0013] FIG2 schematically shows a flow chart of a data processing method according to an embodiment of the present disclosure.

[0014] FIG3 schematically shows a schematic diagram of a microservice framework in a multi-tenant scenario according to an embodiment of the present disclosure.

[0015] FIG4 schematically shows a diagram of a tenant creation process according to an embodiment of the present disclosure.

[0016] FIG5 schematically shows a schematic diagram of a user access process of a first tenant according to an embodiment of the present disclosure.

[0017] FIG6 schematically shows a schematic diagram of a user access process of a first tenant according to another embodiment of the present disclosure.

[0018] FIG7 schematically shows a block diagram of a data processing device according to an embodiment of the present disclosure.

[0019] FIG8 schematically shows a block diagram of an electronic device suitable for implementing a video data processing method according to an embodiment of the present disclosure. DETAILED DESCRIPTION

[0020] Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are merely exemplary and are not intended to limit the scope of the present disclosure. In the detailed description below, for ease of explanation, many specific details are set forth to provide a comprehensive understanding of the embodiments of the present disclosure. However, it is apparent that one or more embodiments may also be implemented without these specific details. In addition, in the following description, descriptions of well-known structures and technologies are omitted to avoid unnecessary confusion of the concepts of the present disclosure.

[0021] The terms used herein are only for describing specific embodiments and are not intended to limit the present disclosure. The terms "comprise," "include," etc. used herein indicate the presence of the features, steps, operations, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, or components.

[0022] All terms used herein (including technical and scientific terms) have the meanings commonly understood by those skilled in the art unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification and should not be interpreted in an idealized or overly rigid manner.

[0023] When expressions such as “at least one of A, B, and C, etc.” are used, they should generally be interpreted in accordance with the meaning commonly understood by those skilled in the art (e.g., “a system having at least one of A, B, and C” should include but is not limited to systems having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, and C, etc.). When expressions such as “at least one of A, B, or C, etc.” are used, they should generally be interpreted in accordance with the meaning commonly understood by those skilled in the art (e.g., “a system having at least one of A, B, or C” should include but is not limited to systems having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, and C, etc.).

[0024] In the technical solutions disclosed herein, the collection, storage, use, processing, transmission, provision, disclosure and application of the data involved (including but not limited to user personal information) comply with the provisions of relevant laws and regulations, take necessary confidentiality measures, and do not violate public order and good morals.

[0025] In the technical solution disclosed herein, the user's authorization or consent is obtained before obtaining or collecting the user's personal information.

[0026] It should be noted that, unless it is explicitly stated that there is a sequence of execution between different operations shown in the flowchart in the embodiments of the present disclosure, or there is a sequence of execution between different operations in technical implementation, otherwise, the execution order between multiple operations may not be prioritized, and multiple operations may also be executed simultaneously.

[0027] In related technologies, when implementing multi-tenant data isolation, a redundant field, such as the tenant ID, can be added to each data record. When performing operations such as adding, deleting, modifying, and querying data records, the data records that need to be processed can be filtered according to the tenant ID. This type of method is relatively lightweight and simple in technical implementation, but the amount of changes at the code level is large, and the data of different tenants are not physically or logically isolated, resulting in a low isolation level. Alternatively, based on containerization technologies such as docker and k8s, the data of each tenant can be stored in a separate container. This type of method requires relevant technical personnel to have a certain understanding and familiarity with docker and k8s. It is an implementation solution with the highest technical feasibility, the highest isolation level, and the highest operation and maintenance cost.

[0028] Embodiments of the present disclosure provide a data processing method, apparatus, electronic device, and storage medium that can implement multi-tenant management services in a microservice scenario without affecting an existing microservice framework. The data processing method includes: receiving a service request from a first tenant, wherein the service request carries a tenant identifier; based on the tenant identifier, determining first tenant information of the first tenant from a tenant table, wherein the tenant table is located in a public space of a database; using the first tenant information to call at least one first microservice related to the first tenant; and in response to obtaining a data change instruction, performing data processing on a data table in a first tenant space associated with the first tenant in the database based on the first tenant information and the data change instruction, wherein the data change instruction is generated during the calling process of at least one first microservice.

[0029] Figure 1 schematically illustrates an exemplary system architecture to which the data processing method and apparatus according to an embodiment of the present disclosure may be applied. It should be noted that Figure 1 is merely an example of a system architecture to which the embodiments of the present disclosure may be applied, to help those skilled in the art understand the technical content of the present disclosure, and does not imply that the embodiments of the present disclosure may not be applied to other devices, systems, environments, or scenarios.

[0030] As shown in FIG. 1 , the system architecture 100 according to this embodiment may include terminal devices 101 , 102 , 103 , a network 104 and a server 105 .

[0031] The terminal devices 101 , 102 , and 103 may be various electronic devices with display screens, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers.

[0032] The network 104 may be used for data communication between the terminal devices 101, 102, 103, or between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired and / or wireless communication links.

[0033] Server 102 can be any type of server that provides various services. For example, the server can be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system. It solves the management difficulties and poor business scalability of traditional physical hosts and VPS (Virtual Private Server) services. The server can also be an edge server. The server can also be a server in a distributed system.

[0034] It should be noted that the data processing method provided in the embodiment of the present disclosure can generally be executed by the server 105. Accordingly, the data processing device provided in the embodiment of the present disclosure can also be set in the server 105.

[0035] For example, a user can access the tenant service provided by server 105 through a browser application on any one of terminal devices 101, 102, and 103 (for example, terminal device 101). By accessing the tenant service, the user can call the microservice corresponding to the tenant. During the process of the user calling the microservice, the user's input operation on terminal device 101 can be sent to server 105 via network 104. Server 105 can intercept the data change operation in the input operation, rewrite the SQL statement contained in the data change operation, and then execute the SQL statement to perform data change processing on the data table under the tenant space of the corresponding tenant in the database.

[0036] It should be understood that the number of terminal devices, networks, and servers in Figure 1 is merely illustrative and any number of terminal devices, networks, and servers may be provided as required.

[0037] FIG2 schematically shows a flow chart of a data processing method according to an embodiment of the present disclosure.

[0038] As shown in FIG. 2 , the data processing method may include operations S210 to S240 .

[0039] In operation S210 , a service request from a first tenant is received, where the service request carries a tenant identifier.

[0040] In operation S220 , first tenant information of the first tenant is determined from a tenant table based on the tenant identifier, where the tenant table is located in a public space of a database.

[0041] In operation S230 , at least one first microservice related to the first tenant is called using the first tenant information.

[0042] In operation S240, in response to obtaining the data change instruction, data processing is performed on a data table in a first tenant space associated with the first tenant in the database based on the first tenant information and the data change instruction, wherein the data change instruction is generated during the calling process of at least one first microservice.

[0043] According to embodiments of the present disclosure, a tenant can be represented as a collection of accessible resources within each service. This collection of resources can be used by multiple users, who can access computing and management resources through the tenant. The first tenant can be any tenant within a microservices framework. Through the first tenant, a user can use one or more microservices within the microservices framework.

[0044] According to an embodiment of the present disclosure, the service request may be an access request initiated by a user of the first tenant. That is, after logging in through the first tenant, the user may initiate a service request to the resource service to access the tenant data of the first tenant.

[0045] According to an embodiment of the present disclosure, the tenant identifier of the first tenant may be a string of information uniquely identifying the first tenant. The tenant identifier may be a random number consisting of at least one of numbers, uppercase letters, and lowercase letters. The tenant identifier may have a fixed length.

[0046] According to an embodiment of the present disclosure, a tenant table may be a data table that stores information such as the tenant ID, tenant name, and tenant creation time of each tenant. The data results of the tenant table may be as shown in Table 1. The tenant table may record information such as the field name, data type, length, default value, and description of each of the information items such as the tenant ID, tenant name, and tenant creation time.

[0047] Table 1

[0048] According to an embodiment of the present disclosure, the first tenant information may include at least information of a tenant data space associated with the first tenant, for example, the name of the tenant data space.

[0049] According to an embodiment of the present disclosure, the public space of the database may be a schema named public in the database.

[0050] According to an embodiment of the present disclosure, different tenants can use different microservices. The at least one first microservice associated with a first tenant may include a microservice that a user can call through the first tenant. The at least one first microservice associated with the first tenant can be configured in the tenant table when the first tenant is created or updated.

[0051] According to an embodiment of the present disclosure, the first tenant and the first microservice can communicate through a gateway server. The gateway server can be provided with an interceptor for the first tenant. When the first tenant makes data changes, the interceptor can intercept and obtain the data change instruction.

[0052] According to an embodiment of the present disclosure, a data change instruction may be generated by a user during a process of calling at least one first microservice related to a first tenant. The data change instruction may include a structured query statement, i.e., an SQL statement, generated based on a user operation.

[0053] According to an embodiment of the present disclosure, the first tenant space associated with the first tenant may be a schema related to the first tenant in the database. The schema may be named using the tenant identifier of the first tenant or the tenant name of the first tenant, which is not limited here.

[0054] According to an embodiment of the present disclosure, performing data processing on the data table in the first tenant space may be updating data on the data table in the first tenant space based on an SQL statement included in the data change instruction.

[0055] According to an embodiment of the present disclosure, a user can initiate a service request through the first tenant. After receiving the service request, the gateway server can determine the first tenant information of the first tenant from the tenant table, and use the first tenant information to call at least one first microservice related to the first tenant. For the data change instructions generated during the user's call to the first microservice, the first tenant information can be used to modify the data change instructions, and the modified data change instructions can be used to process data in the data table in the first tenant space. Through the above technical means, data isolation processing can be implemented in a multi-tenant scenario based on the microservice framework, thereby improving the data isolation effect.

[0056] 3 to 6 , the data processing method shown in FIG. 2 will be further described in conjunction with specific embodiments.

[0057] FIG3 schematically shows a schematic diagram of a microservice framework in a multi-tenant scenario according to an embodiment of the present disclosure.

[0058] As shown in Figure 3, the microservice framework can be based on Liquibase and the database PostgreSQL.

[0059] According to embodiments of the present disclosure, the microservices framework may include, from bottom to top, an infrastructure layer, a middleware layer, a microservices layer, a gateway layer, and multiple tenants. The infrastructure layer may include infrastructure such as servers, storage, and networks. The middleware layer may include middleware such as caches and message queues. The microservices layer may include microservices that can provide external services. The gateway layer may provide access control, information forwarding, reverse proxy, and other access functions.

[0060] According to an embodiment of the present disclosure, each tenant can support multiple users to register and access. For example, user 1 and user 2 can both access the microservice framework through tenant A.

[0061] According to an embodiment of the present disclosure, each tenant may have permission to call one or more of multiple microservices. Each tenant service may correspond to a database instance in the PostgreSQL database, that is, a database space in the PostgreSQL database. The name of the database space in the PostgreSQL database may serve as the tenant identifier of the corresponding tenant. The PostgreSQL database may include a public space, and the data tables in the database spaces corresponding to each tenant may have the same library and table structures as the data tables in the public space.

[0062] According to an embodiment of the present disclosure, the multiple tenants may include at least one default tenant. The default tenant may correspond to a user called a tenant administrator, and the tenant administrator may perform management such as creation and deletion of tenants.

[0063] FIG4 schematically shows a diagram of a tenant creation process according to an embodiment of the present disclosure.

[0064] As shown in Figure 4, when creating a tenant, for example, when creating a second tenant, the tenant administrator can submit basic information of the tenant to be created through the tenant service. Specifically, the tenant administrator can initiate a tenant creation request to the gateway server based on the second tenant information.

[0065] According to an embodiment of the present disclosure, the gateway server may create a second tenant space in the database in response to a tenant creation request for the second tenant based on the second tenant information carried in the tenant creation request.

[0066] According to an embodiment of the present disclosure, specifically, the gateway server can generate a random string of a preset length in response to a tenant creation request. The random string can be a string containing numbers, uppercase and lowercase English letters, and can avoid conflicts with Chinese characters and special characters such as slashes and underscores.

[0067] According to an embodiment of the present disclosure, the gateway server may generate an initial tenant space in the database using a random string as the schema space name, that is, create a tenant's schema in the PostgreSQL database.

[0068] According to an embodiment of the present disclosure, the gateway server may create a plurality of initial data tables, that is, initialize the table structure, in the initial tenant space based on the second tenant information.

[0069] According to embodiments of the present disclosure, a table structure can be initialized using the microservices and their data required by a tenant as an isolation strategy. Specifically, at least one second microservice associated with the second tenant can be determined based on the second tenant information. Based on the data tables associated with each of the at least one second microservices, multiple initial data tables can be created in the initial tenant space.

[0070] According to the embodiments of the present disclosure, by initializing table structures based on the microservices and their data required by tenants as an isolation strategy, different tenants can have different microservices and different database spaces to isolate the generated data, thus achieving data isolation within the microservices framework. Furthermore, when creating tenants, on-demand creation can be achieved based on the tenant's microservice needs, reducing database server resource usage and accelerating the initialization of database table structures within the tenant space.

[0071] According to an embodiment of the present disclosure, a plurality of initial data tables are initialized using a plurality of data tables included in a public space of a database to obtain a second tenant space, namely, initialization table data.

[0072] According to embodiments of the present disclosure, when initializing table data, multiple target data tables can be determined from multiple data tables included in a public space of a database based on multiple initial data tables. The target data tables can correspond to the initial data tables. Data synchronization can be performed on the multiple initial data tables using the multiple target data tables to initialize the multiple initial data tables and obtain a second tenant space.

[0073] According to the embodiments of the present disclosure, the operations of initializing the table structure and initializing the table data can be implemented using Liquibase, which will not be described in detail here. Alternatively, the process of initializing the table structure can also be implemented using any data table generation method, which is not limited here. The process of initializing the table data can also be implemented using any data synchronization method, which is not limited here.

[0074] According to the embodiments of the present disclosure, in a microservice scenario, data isolation is a very important link. The scalability and hot deployment between microservices all involve data isolation at the bottom layer. Therefore, for tenants, the services used by different tenants may be different. When creating a tenant, there is no need to create all services for the tenant. That is, on-demand and dynamic creation can reduce the use of database server resources and speed up the initialization of the tenant schema database table structure, so as to achieve rapid response of tenant services in a microservice scenario and improve user experience.

[0075] According to an embodiment of the present disclosure, when a service request is received from the first tenant, access authentication may be performed on the service request to determine the user's access rights.

[0076] According to an embodiment of the present disclosure, the service request initiated by the user through the first tenant may carry user credential information, such as the user's login account name, password, and other information.

[0077] FIG5 schematically shows a schematic diagram of a user access process of a first tenant according to an embodiment of the present disclosure.

[0078] As shown in FIG5 , a user belonging to the first tenant can input a tenant identification and user credential information in the front-end browser, so that the front-end browser initiates a service request to the gateway server based on the tenant identification and user credential information.

[0079] According to an embodiment of the present disclosure, a gateway server may, in response to receiving a service request, perform access authentication on user credential information and obtain an authentication result. Specifically, the gateway server may call an authentication service to obtain an information list of users registered with a first tenant, and may match the user credential information with information included in the information list to determine whether the user credential information exists in the information list, thereby obtaining an authentication result indicating whether the user has passed authentication.

[0080] According to an embodiment of the present disclosure, when the authentication result indicates that the authentication is passed, the gateway server can determine the first tenant information of the first tenant from the tenant table based on the tenant identifier. Specifically, the gateway server can call the tenant service to authenticate the first tenant based on the tenant identifier, and after determining that the first tenant has passed the authentication, use the tenant service to obtain the tenant space information table. Authenticating the first tenant can be to verify whether the first tenant has been created in the microservice framework. A tenant information table can be maintained in the tenant service, and the tenant identifier can be matched with multiple identification information included in the tenant information table, and the first tenant authentication result can be obtained based on the matching result. The tenant space information table may include the tenant space related to each tenant, that is, the tenant schema.

[0081] According to an embodiment of the present disclosure, after obtaining the first tenant information of a first tenant, the gateway server may call a user service to call at least one first microservice associated with the first tenant. Specifically, based on the first tenant information, the gateway server may determine the access path for each of the at least one first microservices. Based on the access path for each of the at least one first microservices, the gateway server may forward the service request to each of the at least one first microservices to call the at least one first microservice.

[0082] According to the embodiments of the present disclosure, the same microservice can provide different access paths when providing services to different tenants. After decoding, different access paths can point to the same address. For example, the access path provided by microservice A to tenant 1 is A1.com, and the access path provided by microservice A to tenant 2 is A2.com. The two access paths can point to the same address A.com. That is, when tenant 1 uses A1.com to call microservice A, and when tenant 2 uses A2.com to call microservice A, both ultimately point to address A.com.

[0083] According to embodiments of the present disclosure, user credential information may also include other information that can verify the user's access behavior, such as a login token. After the user logs in for the first time and passes verification, the user can obtain a login token based on the user's login account name, password, and other information. The login token can then be used to authenticate the user and tenant when subsequently accessing microservices.

[0084] FIG6 schematically shows a schematic diagram of a user access process of a first tenant according to another embodiment of the present disclosure.

[0085] As shown in FIG6 , the user access process of the first tenant may include a login process and an access process.

[0086] According to an embodiment of the present disclosure, during the login process, the user can enter the tenant identification and login account name, password and other user information in the front-end browser, so that the front-end browser can initiate a user login request to the gateway server based on the tenant identification and login account name, password and other information.

[0087] According to an embodiment of the present disclosure, the gateway server may, in response to receiving a user login request from the first tenant, perform login verification on the user information carried in the user login request and obtain a verification result. Specifically, the gateway server may call an authentication service and use the authentication service to verify user information such as the login account name and password to obtain a verification result indicating whether the login verification is passed.

[0088] According to an embodiment of the present disclosure, if the verification result indicates that the login verification has passed, the tenant service can generate user credential information based on the user information. Specifically, a data table related to user information maintained in the tenant service can be pre-set with user credential information related to the user information, namely, a login token. Based on the user information, the tenant service can obtain the corresponding login token from this data table and return it to the gateway server.

[0089] According to an embodiment of the present disclosure, the gateway server may return user credential information to the first tenant, that is, return the login token to the front-end browser.

[0090] According to an embodiment of the present disclosure, as an optional implementation, during the login process, the gateway server may also call the tenant service to determine the first tenant information of the first tenant from the tenant table by means of the tenant identifier.

[0091] According to an embodiment of the present disclosure, during the access process, the user can directly click the quick access button of the front-end browser, and the front-end browser can generate a service request based on the tenant identifier and login token, and send the service request to the gateway service.

[0092] According to an embodiment of the present disclosure, when a service request calls a tenant service or an authentication service to authenticate a tenant or a user, the authentication process can be completed based on a login token, and after the authentication is passed, the first microservice can be called based on the tenant identifier, which will not be repeated here.

[0093] According to an embodiment of the present disclosure, when a user completes a call to a microservice through a first tenant, an interceptor for the tenant space of the first tenant may be generated in the gateway server. The interceptor may be used to intercept and obtain data change instructions when data changes occur. In response to obtaining the data change instruction, the gateway server may splice the first tenant information with the data change instruction to obtain the target data change instruction. Based on the space name included in the first tenant information, the first tenant space is determined from the database. The target data change instruction is executed to perform data processing on the data table in the first tenant space. Data processing may include, but is not limited to, data addition, deletion, and modification processing.

[0094] For example, you can connect to retrieve each SQL statement to be executed, parse the SQL statement into a Java object, add the tenant's schema information (i.e., the first tenant's information) to the table name signature in the SQL statement, and then execute the modified SQL statement to modify the data in the table in the first tenant's space.

[0095] According to the embodiments of the present disclosure, when executing SQL queries, standard SQL statements are intercepted by interceptors. In order to improve the query efficiency of SQL, tenant information and user information can be cached first to ensure that users can quickly and stably obtain the required information during the access process. At the same time, since in a microservice environment, the process from the user initiating a request to the end of the response involves associated communications between multiple services, the tenant information can be updated in real time in the cache and then synchronized to the database through asynchronous refresh. In order to facilitate the interceptor to quickly process SQL, backend developers can avoid using complex, difficult-to-maintain and update SQL such as multi-table associations and nested queries in the process of developing microservices, which reduces the maintenance cost for developers and enables rapid development.

[0096] According to an embodiment of the present disclosure, in a microservice scenario, for database table management operations such as updating and adding microservices, corresponding version information records can be left in liquibase to facilitate rollback operations in case of system abnormalities.

[0097] FIG7 schematically shows a block diagram of a data processing device according to an embodiment of the present disclosure.

[0098] As shown in FIG. 7 , the data processing device 700 may include a receiving module 710 , a first determining module 720 , a calling module 730 and a processing module 740 .

[0099] The receiving module 710 is configured to receive a service request from a first tenant, wherein the service request carries a tenant identifier.

[0100] The first determining module 720 is configured to determine first tenant information of a first tenant from a tenant table based on the tenant identifier, wherein the tenant table is located in a public space of a database.

[0101] The calling module 730 is configured to call at least one first microservice related to the first tenant by using the first tenant information.

[0102] The processing module 740 is used to process data on a data table in a first tenant space associated with the first tenant in the database based on the first tenant information and the data change instruction in response to obtaining the data change instruction, wherein the data change instruction is generated during the calling process of at least one first microservice.

[0103] According to an embodiment of the present disclosure, the processing module 740 includes a first processing unit, a second processing unit, and a third processing unit.

[0104] The first processing unit is configured to, in response to obtaining the data change instruction, combine the first tenant information with the data change instruction to obtain a target data change instruction.

[0105] The second processing unit is configured to determine the first tenant space from the database based on the space name included in the first tenant information.

[0106] The third processing unit is configured to execute the target data change instruction to perform data processing on the data table in the first tenant space.

[0107] According to an embodiment of the present disclosure, the calling module 730 includes a first calling unit and a second calling unit.

[0108] The first calling unit is configured to determine an access path for each of the at least one first microservice based on the first tenant information.

[0109] The second calling unit is configured to forward the service request to the at least one first microservice based on the respective access path of the at least one first microservice, so as to call the at least one first microservice.

[0110] According to an embodiment of the present disclosure, the service request also carries user credential information.

[0111] According to an embodiment of the present disclosure, the data processing device 700 further includes an authentication module and a second determination module.

[0112] The authentication module is used to perform access authentication on the user credential information in response to receiving the service request and obtain an authentication result.

[0113] The second determining module is configured to determine the first tenant information of the first tenant from the tenant table based on the tenant identifier when the authentication result indicates that the authentication is passed.

[0114] According to an embodiment of the present disclosure, the data processing device 700 further includes a verification module, a generation module, and a sending module.

[0115] The verification module is configured to, in response to receiving a user login request from the first tenant, perform login verification on the user information carried in the user login request to obtain a verification result.

[0116] The generation module is used to generate user credential information based on the user information when the verification result indicates that the login verification is passed.

[0117] The sending module is configured to return user credential information to the first tenant.

[0118] According to an embodiment of the present disclosure, the data processing device 700 further includes a creation module.

[0119] The creation module is configured to create a second tenant space in the database in response to a tenant creation request for the second tenant and based on the second tenant information carried in the tenant creation request.

[0120] According to an embodiment of the present disclosure, the creation module includes a first creation unit, a second creation unit, a third creation unit, and a fourth creation unit.

[0121] The first creation unit is configured to generate a random character string of a preset length in response to a tenant creation request.

[0122] The second creation unit is used to generate an initial tenant space in the database using a random character string as a pattern space name.

[0123] The third creating unit is configured to create a plurality of initial data tables in the initial tenant space based on the second tenant information.

[0124] The fourth creating unit is configured to initialize the plurality of initial data tables using the plurality of data tables included in the public space of the database to obtain a second tenant space.

[0125] According to an embodiment of the present disclosure, the third creation unit includes a first creation sub-unit and a second creation sub-unit.

[0126] The first creation subunit is configured to determine at least one second microservice related to the second tenant based on the second tenant information.

[0127] The second creation subunit is configured to create a plurality of initial data tables in the initial tenant space based on data tables respectively related to at least one second microservice.

[0128] According to an embodiment of the present disclosure, the fourth creation unit includes a third creation sub-unit and a fourth creation sub-unit.

[0129] The third creating subunit is configured to determine a plurality of target data tables from a plurality of data tables included in a public space of the database based on the plurality of initial data tables, wherein the target data tables correspond to the initial data tables.

[0130] The fourth creation subunit is configured to perform data synchronization processing on the multiple initial data tables using the multiple target data tables, so as to initialize the multiple initial data tables and obtain a second tenant space.

[0131] According to the module of the embodiment of the present disclosure, submodule, unit, subunit, any multiple, or at least part of the function of any multiple thereof can be realized in a module. According to the module of the embodiment of the present disclosure, submodule, unit, subunit, any one or more can be split into multiple modules to realize. According to the module of the embodiment of the present disclosure, submodule, unit, subunit, any one or more can be at least partially realized as a hardware circuit, 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 a package, an application specific integrated circuit (ASIC), or can be realized by hardware or firmware of any other reasonable way of integrating or encapsulating the circuit, or by any one of the three implementation modes of software, hardware and firmware or by a suitable combination of any of them. Or, according to the module of the embodiment of the present disclosure, submodule, unit, subunit, one or more can be at least partially realized as a computer program module, which can execute the corresponding function when the computer program module is run.

[0132] For example, any multiple of the receiving module 710, the first determining module 720, the calling module 730, and the processing module 740 can be combined into one module / unit / sub-unit for implementation, or any one of the modules / units / sub-units can be split into multiple modules / units / sub-units. Alternatively, at least part of the functions of one or more of these modules / units / sub-units can be combined with at least part of the functions of other modules / units / sub-units and implemented in one module / unit / sub-unit. According to an embodiment of the present disclosure, at least one of the receiving module 710, the first determining module 720, the calling module 730, and the processing module 740 can be at least partially implemented as a hardware circuit, 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 a package, an application specific integrated circuit (ASIC), or can be implemented by hardware or firmware such as any other reasonable way of integrating or packaging the circuit, or implemented in any one of the three implementation modes of software, hardware, and firmware, or in an appropriate combination of any of them. Alternatively, at least one of the receiving module 710 , the first determining module 720 , the calling module 730 and the processing module 740 may be at least partially implemented as a computer program module, which may perform corresponding functions when executed.

[0133] It should be noted that the data processing device part in the embodiment of the present disclosure corresponds to the data processing method part in the embodiment of the present disclosure. The description of the data processing device part specifically refers to the data processing method part and will not be repeated here.

[0134] Figure 8 schematically shows a block diagram of an electronic device suitable for implementing the video data processing method according to an embodiment of the present disclosure. The electronic device shown in Figure 8 is only an example and should not bring any limitation to the functions and scope of use of the embodiment of the present disclosure.

[0135] As shown in Figure 8, the electronic device 800 according to an embodiment of the present disclosure includes a processor 801, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 802 or a program loaded from a storage part 808 into a random access memory (RAM) 803. The processor 801 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or a related chipset and / or a dedicated microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 801 may also include an onboard memory for caching purposes. The processor 801 may include a single processing unit or multiple processing units for executing different actions of the method flow according to an embodiment of the present disclosure.

[0136] Various programs and data required for the operation of the electronic device 800 are stored in the RAM 803. The processor 801, ROM 802, and RAM 803 are connected to each other via a bus 804. The processor 801 performs various operations of the method flow according to the embodiment of the present disclosure by executing the programs in the ROM 802 and / or RAM 803. It should be noted that the programs may also be stored in one or more memories other than the ROM 802 and RAM 803. The processor 801 may also perform various operations of the method flow according to the embodiment of the present disclosure by executing the programs stored in one or more memories.

[0137] According to an embodiment of the present disclosure, the electronic device 800 may further include an input / output (I / O) interface 805, which is also connected to the bus 804. The electronic device 800 may further include one or more of the following components connected to the I / O interface 805: an input portion 806 including a keyboard, a mouse, etc.; an output portion 807 including devices such as a cathode ray tube (CRT), a liquid crystal display (LCD), and speakers; a storage portion 808 including a hard disk; and a communication portion 809 including a network interface card such as a LAN card or a modem. The communication portion 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to the I / O interface 805 as needed. A removable medium 811, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed in the drive 810 as needed, so that a computer program read therefrom can be installed into the storage portion 808 as needed.

[0138] The present disclosure also provides a non-transitory computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments, or may exist independently and not be incorporated into the device / apparatus / system. The computer-readable storage medium carries one or more programs, and when executed, implements the method according to the embodiments of the present disclosure.

[0139] According to an embodiment of the present disclosure, a computer-readable storage medium may be a non-volatile computer-readable storage medium, for example, it may include but is not limited to: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, apparatus, or device. For example, according to an embodiment of the present disclosure, a computer-readable storage medium may include the ROM 802 and / or RAM 803 described above and / or one or more memories other than ROM 802 and RAM 803.

[0140] The embodiments of the present disclosure also include a computer program product, which includes a computer program containing program code for executing the method shown in the flowchart. When the computer program product is run in a computer system, the program code is used to enable the computer system to implement the method provided by the embodiments of the present disclosure.

[0141] The computer program executes the above functions defined in the system / device of the embodiment of the present disclosure when the computer program is executed by the processor 801. According to the embodiment of the present disclosure, the system, device, module, unit, etc. described above can be implemented by a computer program module.

[0142] In one embodiment, the computer program may be stored on a tangible storage medium such as an optical storage device or a magnetic storage device. In another embodiment, the computer program may be transmitted and distributed in the form of a signal on a network medium, downloaded and installed via the communication portion 809, and / or installed from a removable medium 811. The program code contained in the computer program may be transmitted using any appropriate network medium, including but not limited to wireless, wired, or any suitable combination thereof.

[0143] In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 809, and / or installed from a removable medium 811. When the computer program is executed by the processor 801, the above-described functions defined in the system of the embodiment of the present disclosure are performed. According to the embodiment of the present disclosure, the systems, devices, means, modules, units, etc. described above can be implemented by computer program modules.

[0144] According to an embodiment of the present disclosure, the program code for executing the computer program provided by the embodiment of the present disclosure can be written in any combination of one or more programming languages. Specifically, these computer 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 be executed entirely on the user computing device, partially on the user device, partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device can be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (for example, using an Internet service provider to connect via the Internet).

[0145] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the above-mentioned module, program segment, or a part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in an order different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

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

[0147] The embodiments of the present disclosure are described above. However, these embodiments are for illustrative purposes only and are not intended to limit the scope of the present disclosure. Although each embodiment has been described separately above, this does not mean that the measures in each embodiment cannot be used in combination to advantage. The scope of the present disclosure is defined by the appended claims and their equivalents. Without departing from the scope of the present disclosure, those skilled in the art may make various substitutions and modifications, which should all fall within the scope of the present disclosure.

Claims

1. A data processing method, include: Receiving a service request from a first tenant, wherein the service request carries a tenant identifier; Based on the tenant identifier, determining first tenant information of the first tenant from a tenant table, wherein the tenant table is located in a public space of a database; Using the first tenant information to call at least one first microservice related to the first tenant; and In response to obtaining a data change instruction, data processing is performed on a data table in a first tenant space associated with the first tenant in the database based on the first tenant information and the data change instruction, wherein the data change instruction is generated during the calling process of the at least one first microservice.

2. The method according to claim 1, in, In response to obtaining the data change instruction, based on the first tenant information and the data change instruction, performing data processing on a data table in the first tenant space associated with the first tenant in the database includes: In response to obtaining the data change instruction, concatenating the first tenant information with the data change instruction to obtain a target data change instruction; Determining the first tenant space from the database based on the space name included in the first tenant information; and The target data change instruction is executed to perform data processing on the data table in the first tenant space.

3. The method according to claim 1, in, The using the first tenant information to call at least one first microservice related to the first tenant includes: Based on the first tenant information, determining an access path for each of the at least one first microservice; and Based on the respective access paths of the at least one first microservice, the service request is forwarded to the at least one first microservice respectively to call the at least one first microservice.

4. The method according to claim 1, in, The service request also carries user credential information; The method further comprises: In response to receiving the service request, performing access authentication on the user credential information to obtain an authentication result; and When the authentication result indicates that the authentication is successful, first tenant information of the first tenant is determined from the tenant table based on the tenant identifier.

5. The method according to claim 4, further comprising: include: In response to receiving a user login request from the first tenant, User information is used for login verification to obtain the verification result; If the verification result indicates that the login verification is passed, generating the user credential information based on the user information; and The user credential information is returned to the first tenant.

6. The method according to claim 1, further comprising: include: In response to a tenant creation request for the second tenant, a second tenant space is created in the database based on the second tenant information carried in the tenant creation request.

7. The method according to claim 6, in, The step of creating, in response to a tenant creation request for a second tenant and based on the second tenant information carried in the tenant creation request, a second tenant space in the database includes: In response to the tenant creation request, generating a random string of a preset length; Using the random string as a pattern space name, generating an initial tenant space in the database; Based on the second tenant information, creating a plurality of initial data tables in the initial tenant space; and The plurality of initial data tables are initialized using the plurality of data tables included in the public space of the database to obtain the second tenant space.

8. The method according to claim 7, in, The creating a plurality of initial data tables in the initial tenant space based on the second tenant information includes: Based on the second tenant information, determining at least one second microservice related to the second tenant; and Based on the data tables respectively related to the at least one second microservice, the multiple initial data tables are created in the initial tenant space.

9. The method according to claim 7, in, The initializing the multiple initial data tables using the multiple data tables included in the public space of the database to obtain the second tenant space includes: Based on the multiple initial data tables, determining multiple target data tables from multiple data tables included in the public space of the database, wherein the target data tables correspond to the initial data tables; and The multiple target data tables are used to perform data synchronization processing on the multiple initial data tables, so as to initialize the multiple initial data tables and obtain the second tenant space.

10. A data processing device, include: A receiving module, configured to receive a service request from a first tenant, wherein the service request carries a tenant identifier; a first determining module, configured to determine, based on the tenant identifier, a first tenant of the first tenant from a tenant table; User information, wherein the tenant table is located in the public space of the database; a calling module, configured to call at least one first microservice related to the first tenant by using the first tenant information; and A processing module is used to, in response to obtaining a data change instruction, perform data processing on a data table in a first tenant space associated with the first tenant in the database based on the first tenant information and the data change instruction, wherein the data change instruction is generated during the calling process of the at least one first microservice.

11. An electronic device comprising a memory and a processor, wherein the memory stores instructions executable by the processor, and when the instructions are executed by the processor, the processor executes the method according to any one of claims 1 to 9.

12. A non-transitory computer-readable storage medium storing computer instructions, in, The computer instructions are used to cause the computer to execute the method according to any one of claims 1 to 9.

13. A computer program product comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • Multi-tenant database isolation method and system, electronic equipment and computer storage medium

    CN110765489A

  • Cloud service method, device and equipment and storage medium

    CN112637328A

  • Data isolation method and system for multi-tenant platform based on micro-service architecture

    CN115391828A

  • Multi-tenant data isolation method, server and system

    CN115408403A

  • Database access control method and related device

    CN115510496A

Cited By

  • CDN tenant bandwidth allocation method and device, equipment, medium and product

    CN119276720A