Tenant data processing method and device for PaaS platform

By using the combination method of Bloom filter and B+ tree in the PaaS platform, the problems of indexing difficulties and slow data query of multi-tenant databases are solved, efficient multi-tenant data retrieval and isolation are achieved, and storage costs are reduced.

CN116049180BActive Publication Date: 2025-08-12CHINA TELECOM CLOUD TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211702566.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-29
Publication Date
2025-08-12
Estimated Expiration
2042-12-29

AI Technical Summary

Technical Problem

The multi-tenant database of existing PaaS platforms is difficult to establish indexing, slow data query, and low index isolation.

Method used

By obtaining the data identification information and index value key in the query request, the BloomFilter uses the Bloom filter to determine the existence of the index value, determine the C value based on the identification information and index value, and find the storage location V in the index table through the constructed B+ tree, so as to achieve isolation and rapid retrieval of multi-tenant data.

Benefits of technology

It improves the index establishment efficiency and data query speed of multi-tenant databases, solves the indexing difficulties of multi-tenant databases, and reduces data storage costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116049180B_ABST
    Figure CN116049180B_ABST
Patent Text Reader

Abstract

The present invention discloses a tenant data processing method and device for a PaaS platform. The method comprises: obtaining a query request for data to be queried, wherein the query request carries data identification information and an index value key; responding to the query request, and determining, when it is determined that a Bloom filter has an index value, a C value corresponding to the data to be queried based on the identification information and the index value, wherein the C value is represented as a set of binary numbers, including the tenant corresponding to the index and the data table and column corresponding to the index; finding the C value in the index table based on a constructed B+ tree; searching the index data table to obtain a storage location V corresponding to the C value, wherein the V value represents the location of the wide table corresponding to the index, that is, achieving multi-tenant security through Bloom filter table isolation, and improving the multi-tenant retrieval speed through an index algorithm, thereby solving the technical problems in the prior art of difficulty in indexing a multi-tenant database of a PaaS platform and slow data query.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field related to data engine technology, and in particular to a tenant data processing method and device for a PaaS platform. Background Art

[0002] With the continuous development of cloud computing technology, PaaS (Platform as a Service), a cloud computing model, provides multi-tenant services. It provides application development and testing environments and development tools to tenants in the form of interfaces, hiding operating system and hardware information, greatly facilitating development and maintenance. However, multi-tenant databases suffer from difficulties in indexing, slow data queries, and low index isolation, which are significant issues in current databases.

[0003] To address the above-mentioned problems, no effective solutions have been proposed so far. Summary of the Invention

[0004] The embodiments of the present invention provide a tenant data processing method and device for a PaaS platform, so as to at least solve the technical problems in the prior art of difficulty in establishing indexes and slow data queries in a multi-tenant database of a PaaS platform.

[0005] According to one aspect of an embodiment of the present invention, a tenant data processing method for a PaaS platform is provided, comprising: obtaining a query request for data to be queried, wherein the query request carries the data identification information and an index value key; responding to the query request, and upon determining that a Bloom filter BloomFilter has the index value, determining a C value corresponding to the data to be queried based on the identification information and the index value, wherein the C value is represented as a set of binary numbers, including the tenant corresponding to the index and the data table and column corresponding to the index; finding the C value in the index table based on the constructed B+ tree; and searching the index data table to obtain a storage location V corresponding to the C value, wherein the V value represents the location of the wide table corresponding to the index.

[0006] Optionally, the method of finding the C value in the index table based on the constructed B+ tree includes: establishing a mapping relationship between the logical index value and the storage index value through the BloomFilter construction function; and establishing a mapping between the storage index and the actual storage using a B+ tree through a mapping algorithm of index entries in the identification space.

[0007] Optionally, finding the C value in the index table according to the constructed B+ tree includes: distributing the index entries to different Bloom filters according to the principle that one tenant uses one Bloom filter.

[0008] Optionally, the index entries are distributed to different Bloom filters according to the principle of using one Bloom filter for one tenant, including: creating a corresponding number of BloomFilters according to the number of tenants, one BloomFilter for one tenant; in the initial state, the BloomFilter is an m-bit bit array, represented by S = {x1, x2, ..., xm} and each bit of the array is set to 0; defining n independent hash functions H(x), for any element x, the position Hi(x) mapped by the i-th hash function will be set to 1, where 0≤i≤n.

[0009] Optionally, the method also includes: when multiple tenants store data, if the current field is judged to be an index field, determining the tenant to which the current data belongs and writing the key value into the corresponding Bloom Filter, and obtaining a one-dimensional binary array K through calculation; according to the number of tenants t and the number of tenant data tables a and the number of indexes b, obtaining a set of binary numbers Itab, identifying the b-th column in the table a in tenant t as the index; combining the two binary numbers Itab and K into a set of binary numbers C, which is the storage index value; and obtaining the actual storage location of the data in the wide table through the index entry space mapping function.

[0010] Optionally, the method further includes: the index entry space mapping function F(x) is:

[0011] F(Cij)1=|Kt|*(t-1)+|KNi|*i+j

[0012] F(Cij)2=|Kt|*(t-1)+|KNi|*MaxN+|KYi|*i+j

[0013] Among them, F(Cij)1 represents the actual storage location V of the unindexed data in the wide table, where i represents the i-th table in the tenant metadata table, and j represents the j-th data item in the i-th table; |Kt| is the space size of Kt, which represents the space size occupied by tenant t in the wide table. The total space size of the wide table is |K|, |Kt| = |K| / Maxt, Maxt represents the maximum number of tenants that the PaaS platform can bear, and |KNi| represents the space size reserved in the wide table for the unindexed table of tenant t; F(Cij)2 represents the actual storage location V of the indexed data in the wide table, where i represents the i-th table in the tenant metadata table, j represents the j-th data item in the i-th table, MaxN represents the maximum number of unindexed tables in the wide table, |KYi| represents the space size reserved in the wide table for the indexed table of tenant t, |KNi| and |KYi| represent the number of rows in the wide table, and the settings of Maxt, MaxN, |KNi|, and |KYi| can be customized according to the amount of tenant data.

[0014] Optionally, determining the C value corresponding to the data to be queried based on the identification information and the index value includes: obtaining the field table id, index id, tenant id and the index value key, wherein the identification information includes the field table id, the index id, and the tenant id; the index value key is written into the BloomFilter, and the C value is obtained according to the hash value calculated by the BloomFilter based on the tenant id, field table id, and index column id.

[0015] Optionally, finding the C value in the index table based on the constructed B+ tree includes: converting the C value into hexadecimal and establishing the B+ tree.

[0016] According to another aspect of an embodiment of the present application, a tenant data processing device for a PaaS platform is provided, including: an acquisition unit, used to obtain a query request for data to be queried, wherein the query request carries the data identification information and the index value key; a determination unit, used to respond to the query request, and when it is determined that the Bloom filter BloomFilter has the index value, determine the C value corresponding to the data to be queried according to the identification information and the index value, wherein the C value is represented as a set of binary numbers, including the tenant corresponding to the index and the data table and column corresponding to the index; a first query unit, used to find the C value in the index table according to a constructed B+ tree; a second query unit, used to search the index data table to obtain the storage location V corresponding to the C value, wherein the V value represents the location of the wide table corresponding to the index.

[0017] The benefit of the present invention lies in that, in an embodiment of the present invention, by obtaining a query request for data to be queried, wherein the query request carries data identification information and an index value key; in response to the query request, when it is determined that the Bloom filter BloomFilter has an index value, the C value corresponding to the data to be queried is determined according to the identification information and the index value, wherein the C value is represented as a set of binary numbers, including the tenant corresponding to the index and the data table and column corresponding to the index; according to the constructed B+ tree, the C value in the index table is found; the index data table is searched to obtain the storage location V corresponding to the C value, wherein the V value represents the location of the wide table corresponding to the index, that is, a tenant data processing method for a PaaS platform of the present invention is realized by isolating the Bloom Filter table to achieve multi-tenant security, and improving the retrieval speed of multi-tenants by the index algorithm, thereby solving the technical problems in the prior art that the multi-tenant database of the PaaS platform is difficult to establish indexes and data query is slow. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:

[0019] Figure 1 A flowchart of an optional tenant data processing method for a PaaS platform according to an embodiment of the present invention;

[0020] Figure 2 1 is a schematic diagram of an optional multi-tenant isolation indexing mechanism structure based on BloomFilter according to an embodiment of the present invention;

[0021] Figure 3 is a flow chart of an optional index creation algorithm according to an embodiment of the present invention;

[0022] Figure 4 is a flow chart of an optional index search algorithm according to an embodiment of the present invention;

[0023] Figure 5 This is a diagram of an optional tenant data processing device for a PaaS platform according to an embodiment of the present invention. DETAILED DESCRIPTION

[0024] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of the present invention.

[0025] It should be noted that the terms "first," "second," and the like in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or precedence. It should be understood that the numbers used in this manner are interchangeable where appropriate so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having," as well as any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or apparatus that includes a sequence of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units that are not explicitly listed or that are inherent to these processes, methods, products, or apparatus.

[0026] In order to better understand the contents of this plan, the relevant contents are explained as follows:

[0027] Bloom filter is a binary vector data structure proposed by Howard Bloom in 1970. It is space and time efficient and is used to detect whether an element is a member of a set.

[0028] A B+ tree is a tree data structure commonly used in databases and operating system file systems. B+ trees maintain stable and ordered data, and insertion and modification have a relatively stable logarithmic time complexity. Elements in a B+ tree are inserted from the bottom up, in contrast to a binary tree.

[0029] This embodiment also provides a tenant data processing method for the PaaS platform. Figure 1 Flowchart of a tenant data processing method for PaaS platform according to an embodiment of the present invention. Figure 1 As shown, the tenant data processing method for the PaaS platform includes the following steps:

[0030] Step S102: Obtain a query request for the data to be queried, wherein the query request carries the data identification information and the index value key.

[0031] Step S104, in response to the query request, when it is determined that the Bloom filter BloomFilter has the index value, determines the C value corresponding to the data to be queried based on the identification information and the index value, wherein the C value is represented as a set of binary numbers, including the tenant corresponding to the index and the data table and column corresponding to the index.

[0032] Step S106: Find the C value in the index table based on the constructed B+ tree.

[0033] Step S108 , searching the index data table to obtain the storage location V corresponding to the C value, wherein the V value represents the location of the index corresponding to the wide table.

[0034] In this embodiment, the input is the index value key, the table id and index id corresponding to the index field, and the index field corresponds to the tenant id; output: the index value is stored in the index table.

[0035] The number of BloomFilters created corresponds to the number of tenants in the PaaS platform, with one BloomFilter for each tenant. Initially, the BloomFilter is an m-bit array, represented by S = {x1, x2, ..., xm}, with each bit in the array set to 0. At the same time, n independent hash functions H(x) are defined. For any element x, the position Hi(x) mapped by the i-th hash function is set to 1 (0 ≤ i ≤ n).

[0036] Among them, when multiple tenants store data, determine whether the current field is an index field. If the current field is an index field, first determine the tenant to which the current data belongs and write the key value into the corresponding Bloom Filter. After calculation, a one-dimensional binary array K is obtained.

[0037] Among them, according to the number of tenants t, the number of tenant data tables a, and the number of indexes b in the system, a set of binary numbers Itab is obtained to identify the b-th column in table a in tenant t as the index; the two binary numbers Itab and K are combined into a set of binary numbers C, which is the storage index value.

[0038] Through the embodiments provided by the present application, a query request for data to be queried is obtained, wherein the query request carries data identification information and an index value key; in response to the query request, when it is determined that the Bloom filter BloomFilter has an index value, the C value corresponding to the data to be queried is determined according to the identification information and the index value, wherein the C value is represented as a set of binary numbers, including the tenant corresponding to the index and the data table and column corresponding to the index; according to the constructed B+ tree, the C value in the index table is found; the index data table is searched to obtain the storage location V corresponding to the C value, wherein the V value represents the location of the wide table corresponding to the index, that is, a tenant data processing method for PaaS platform of the present invention is realized by isolating the Bloom Filter table to achieve multi-tenant security, and improving the retrieval speed of multi-tenants by the index algorithm, thereby solving the technical problems in the prior art that the multi-tenant database of the PaaS platform is difficult to establish indexes and the data query is slow.

[0039] It should be noted that, in this embodiment, in order to achieve multi-tenant index isolation and improve tenant data retrieval speed, a tenant data processing method for PaaS platform is proposed, which realizes multi-tenant shared storage based on wide tables and index tables, and uniformly maps index data to the specified position of the wide table by constructing an index mapping function. The given mapping function enables a single tenant index to be isolated and orderly distributed in space, so that tenant indexes and data can be placed in each node in a balanced and clustered manner. At the same time, an algorithm for multi-tenant index creation and index query is designed, so that when querying, performance bottlenecks can be avoided through a peer-to-peer structure, data storage costs can be reduced, and query efficiency can be improved, thereby better meeting the needs of multi-tenant sharing and dynamically customizable cloud resources in a cloud environment.

[0040] Optionally, the method of finding the C value in the index table based on the constructed B+ tree includes: establishing a mapping relationship between the logical index value and the storage index value through the BloomFilter construction function; and establishing a mapping between the storage index and the actual storage using a B+ tree through a mapping algorithm of index entries in the identification space.

[0041] Optionally, finding the C value in the index table according to the constructed B+ tree includes: distributing the index entries to different Bloom filters according to the principle that one tenant uses one Bloom filter.

[0042] Optionally, the index entries are distributed to different Bloom filters according to the principle of using one Bloom filter for one tenant, including: creating a corresponding number of BloomFilters according to the number of tenants, one BloomFilter for one tenant; in the initial state, the BloomFilter is an m-bit bit array, represented by S = {x1, x2, ..., xm} and each bit of the array is set to 0; defining n independent hash functions H(x), for any element x, the position Hi(x) mapped by the i-th hash function will be set to 1, where 0≤i≤n.

[0043] Optionally, the method also includes: when multiple tenants store data, if the current field is judged to be an index field, determining the tenant to which the current data belongs and writing the key value into the corresponding Bloom Filter, and obtaining a one-dimensional binary array K through calculation; according to the number of tenants t and the number of tenant data tables a and the number of indexes b, obtaining a set of binary numbers Itab, identifying the b-th column in the table a in tenant t as the index; combining the two binary numbers Itab and K into a set of binary numbers C, which is the storage index value; and obtaining the actual storage location of the data in the wide table through the index entry space mapping function.

[0044] Optionally, the method further includes: the index entry space mapping function F(x) is:

[0045] F(Cij)1=|Kt|*(t-1)+|KNi|*i+j

[0046] F(Cij)2=|Kt|*(t-1)+|KNi|*MaxN+|KYi|*i+j

[0047] Where F(Cij)1 represents the actual storage location V of unindexed data in the wide table, where i represents the i-th table in the tenant metadata table, and j represents the j-th data item in the i-th table. |Kt| is the space size of Kt, indicating the space occupied by tenant t in the wide table. The total space size of the wide table is |K|, where |Kt| = |K| / Maxt. Maxt represents the maximum number of tenants the PaaS platform can support, and |KNi| represents the space reserved in the wide table for tenant t's unindexed tables. F(Cij)2 represents the actual storage location V of indexed data in the wide table, where i represents the i-th table in the tenant metadata table, j represents the j-th data item in the i-th table, MaxN represents the maximum number of unindexed tables in the wide table, |KYi| represents the space reserved in the wide table for tenant t's indexed tables, and |KNi| and |KYi| represent the number of rows in the wide table. The values of Maxt, MaxN, |KNi|, and |KYi| can be customized based on the amount of tenant data.

[0048] Optionally, determining the C value corresponding to the data to be queried based on the identification information and the index value includes: obtaining the field table id, index id, tenant id and the index value key, wherein the identification information includes the field table id, the index id, and the tenant id; the index value key is written into the BloomFilter, and the C value is obtained according to the hash value calculated by the BloomFilter based on the tenant id, field table id, and index column id.

[0049] Optionally, finding the C value in the index table based on the constructed B+ tree includes: converting the C value into hexadecimal and establishing the B+ tree.

[0050] As an optional embodiment, the present application also provides a tenant data processing method for a PaaS platform. The specific content of the solution is as follows.

[0051] like Figure 2 As shown in the figure, a schematic diagram of the index mechanism structure based on multi-tenant isolation of BloomFilter.

[0052] First, the index entries are distributed to different BloomFilter indexers according to the principle of one tenant using one BloomFilter indexer, so as to ensure the isolation of tenant data and the balance of data entry distribution. The legitimacy of the tenant's acquisition of data can also be determined based on the tenant's request data.

[0053] Then, a mapping relationship is established between the logical index value and the storage index value through the BloomFilter index construction function.

[0054] Because multiple tenants need to index different attribute columns, and the numeric types of different columns vary, the main purpose of the index construction function is to convert all index values into a unified description in the index space. This method does not distinguish between index data types and can uniquely identify an index. This method converts the logical index into a storage index, preparing for the next step of index entry mapping.

[0055] Finally, through the mapping algorithm of index entries in the identification space, the B+ tree method is used to establish the mapping between the storage index and the actual storage to effectively improve the index retrieval speed.

[0056] like Figure 3 As shown in the figure, the index establishment algorithm flow chart. Figure 3 As shown, the data storage process is as follows.

[0057] Input: Enter the index value key, the table ID and index ID corresponding to the index field, and the tenant ID corresponding to the index field;

[0058] Output: The index value is stored in the index table.

[0059] 1) Create a corresponding number of BloomFilters based on the number of tenants in the PaaS platform, i.e., one BloomFilter for each tenant. Initially, the BloomFilter is an m-bit array, represented by S = {x1, x2, ..., xm}, with each bit in the array set to 0. At the same time, define n independent hash functions H(x). For any element x, the position Hi(x) mapped by the i-th hash function is set to 1 (0 ≤ i ≤ n).

[0060] 2) When storing data in multiple tenants, determine whether the current field is an index field.

[0061] 3) If the current field is an index field, first determine the tenant to which the current data belongs and write the key value into the corresponding Bloom Filter. After calculation, a one-dimensional binary array K is obtained.

[0062] 4) Based on the number of tenants t, the number of tenant data tables a, and the number of indexes b in the system, a set of binary numbers Itab is obtained to identify the b-th column in table a of tenant t as the index.

[0063] 5) Combine the two binary numbers Itab and K into a set of binary numbers C, which is the storage index value.

[0064] 6) The actual storage location V of the data in the wide table is obtained through the index entry space mapping function F(x), where the index entry space mapping function F(x) is:

[0065] F(Cij)=|Kt|*(t-1)+|KNi|*i+j Formula 1-1

[0066] F(Cij)=|Kt|*(t-1)+|KNi|*MaxN+|KYi|*i+j Formula 1-2

[0067] In formula 1-1, V represents the actual storage location of unindexed data in the wide table, i represents the i-th table in the tenant metadata table, and j represents the j-th data item in the i-th table. |Kt| is the space size of Kt, which represents the space occupied by tenant t in the wide table. The total space size of the wide table is |K|, where |Kt| = |K| / Maxt, where Maxt represents the maximum number of tenants the PaaS platform can support. |KNi| represents the space reserved in the wide table for tenant t's unindexed table.

[0068] Formula 1-2 represents the actual storage location V of the indexed data in the wide table, where i represents the i-th table in the tenant metadata table, j represents the j-th data item in the i-th table, MaxN represents the maximum number of unindexed tables in the wide table, |KYi| represents the space reserved in the wide table for the indexed tables of tenant t, |KNi| and |KYi| represent the number of rows in the wide table. The values of Maxt, MaxN, |KNi|, and |KYi| can be customized based on the amount of tenant data.

[0069] Store C, key, and V in the index data table. The C value includes the tenant, table, and column corresponding to the index. The key represents the index value, and the V value represents the position of the wide table corresponding to the index. The index data table is shown in Table 1.

[0070] Table 1

[0071]

[0072]

[0073] like Figure 4 As shown in the figure, the index search algorithm flow chart. Figure 4 As shown in Figure 2, the data retrieval process is as follows.

[0074] Input: table ID and index ID corresponding to the index field, tenant ID corresponding to the index field, and index value key;

[0075] Output: Data is stored in wide table locations.

[0076] 1) Based on the number of tenants t, the number of tenant data tables a, and the number of indexes b in the system, a set of binary numbers Itab is obtained to identify the b-th column in table a of tenant t as the index.

[0077] 2) Determine the tenant to which the current data belongs and write the key value into the corresponding BloomFilter. The one-dimensional binary array K is calculated.

[0078] 3) Combine the two binary numbers Itab and K into a set of binary numbers C, which is the storage index value.

[0079] 4) Convert the C value into a hexadecimal tree to create B+, and find C in the index table through the B+ tree.

[0080] 5) Find the actual storage location V corresponding to the C value according to the index table.

[0081] In order to achieve multi-tenant index isolation and improve tenant data retrieval speed, the present invention proposes an optional tenant data processing method for PaaS platform, which realizes multi-tenant shared storage based on wide table and index table, and uniformly maps index data to the specified position of wide table by constructing index mapping function. The given mapping function enables single tenant index to be isolated and orderly distributed in space, so that tenant index and data can be balanced and clustered on each node. At the same time, algorithms for multi-tenant index creation and index query are designed, so that performance bottlenecks can be avoided through peer structure during query, data storage costs can be reduced, and query efficiency can be improved, so as to better meet the needs of multi-tenant sharing and dynamic customization of cloud resources in cloud environment.

[0082] Compared to traditional multi-tenant indexing mechanisms, the advantages of the optional tenant data processing method for PaaS platforms proposed in this invention are as follows: 1) When creating an index, since writing each key only requires a BloomFilter setting operation, its write performance is very high. 2) When querying an index, adding a BloomFilter to determine whether the index value exists in the data table can improve index retrieval time to a certain extent. 3) Instead of storing the row and column data of the index data separately, the tenant information and index information are converted into a set of binary data, thus saving storage space.

[0083] It should be noted that through key steps such as BloomFilter, routing table mapping, and logical index construction of a B+ tree, index and data addressing and storage are achieved, improving index retrieval speed. This provides an efficient method for managing tenant data in the cloud and can quickly locate data, providing support for the construction of a multi-tenant PaaS platform. By mapping index entries to the identifier space and using a B+ tree to establish a mapping between storage indexes and actual storage, index retrieval speed is effectively improved.

[0084] Through the solution provided in this embodiment, an optional tenant data processing method for PaaS platform is proposed to achieve multi-tenant security through Bloom Filter table isolation and improve the multi-tenant retrieval speed through indexing algorithm.

[0085] Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus the necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present invention.

[0086] In this embodiment, a tenant data processing device for a PaaS platform is also provided, which is used to implement the above-mentioned embodiments and preferred implementation methods, and the details that have been described will not be repeated. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0087] Figure 5 is a structural block diagram of a tenant data processing device for a PaaS platform according to an embodiment of the present invention. Figure 5 As shown, the tenant data processing device for the PaaS platform includes:

[0088] The acquiring unit 51 is configured to acquire a query request for the data to be queried, wherein the query request carries the data identification information and the index value key.

[0089] The determination unit 53 is used to respond to the query request and, when it is determined that the Bloom filter BloomFilter has the index value, determine the C value corresponding to the data to be queried based on the identification information and the index value, wherein the C value is represented as a set of binary numbers, including the tenant corresponding to the index and the data table and column corresponding to the index.

[0090] The first query unit 55 is used to find the C value in the index table according to the constructed B+ tree.

[0091] The second query unit 57 is configured to search the index data table to obtain a storage location V corresponding to the C value, wherein the V value represents a location of the index corresponding to the wide table.

[0092] Through the embodiment provided by the present application, the acquisition unit 51 obtains a query request for the data to be queried, wherein the query request carries data identification information and an index value key; the determination unit 53 responds to the query request, and when it is determined that the Bloom filter BloomFilter has an index value, determines the C value corresponding to the data to be queried according to the identification information and the index value, wherein the C value is represented as a set of binary numbers, including the tenant corresponding to the index and the data table and column corresponding to the index; the first query unit 55 finds the C value in the index table according to the constructed B+ tree; the second query unit 57 searches the index data table to obtain the storage location V corresponding to the C value, wherein the V value represents the location of the wide table corresponding to the index, that is, the tenant data processing method for the PaaS platform of the present invention realizes multi-tenant security through Bloom Filter table isolation, and improves the retrieval speed of multi-tenants through the index algorithm, thereby solving the technical problems in the prior art that the multi-tenant database of the PaaS platform is difficult to establish indexes and data query is slow.

[0093] Optionally, the first query unit 55 may include: a first establishment module, used to establish a mapping relationship between the logical index value and the storage index value through the BloomFilter construction function; a second establishment module, used to establish the mapping between the storage index and the actual storage using a B+ tree through a mapping algorithm of index entries in the identification space.

[0094] Optionally, the second query unit 57 may include: a distribution module, configured to distribute the index entries to different Bloom filters according to the principle that one tenant uses one Bloom filter.

[0095] Optionally, the distribution module can be used to perform the following operations: create a corresponding number of BloomFilters according to the number of tenants, with one tenant corresponding to one BloomFilter; in the initial state, the BloomFilter is an m-bit bit array, represented by S = {x1, x2, ..., xm} and each bit of the array is set to 0; define n independent hash functions H(x), for any element x, the position Hi(x) mapped by the i-th hash function will be set to 1, where 0≤i≤n.

[0096] Optionally, the device may also include: a writing unit, which is used to determine the tenant to which the current data belongs and write the key value into the corresponding Bloom Filter when multiple tenants store data and the current field is judged to be an index field, and obtain a one-dimensional binary array K through calculation; an indexing module, which is used to obtain a set of binary numbers Itab according to the number of tenants t, the number of tenant data tables a, and the number of indexes b, to identify the b-th column in the table a in tenant t as the index; a combining unit, which is used to combine the two binary numbers Itab and K into a set of binary numbers C, which is the storage index value; a mapping unit, which is used to obtain the actual storage location of the data in the wide table through the index entry space mapping function.

[0097] Optionally, the apparatus may further include: the index entry space mapping function F(x) is:

[0098] F(Cij)1=|Kt|*(t-1)+|KNi|*i+j

[0099] F(Cij)2=|Kt|*(t-1)+|KNi|*MaxN+|KYi|*i+j

[0100] Where F(Cij)1 represents the actual storage location V of unindexed data in the wide table, where i represents the i-th table in the tenant metadata table, and j represents the j-th data item in the i-th table. |Kt| is the space size of Kt, indicating the space occupied by tenant t in the wide table. The total space size of the wide table is |K|, where |Kt| = |K| / Maxt. Maxt represents the maximum number of tenants the PaaS platform can support, and |KNi| represents the space reserved in the wide table for tenant t's unindexed tables. F(Cij)2 represents the actual storage location V of indexed data in the wide table, where i represents the i-th table in the tenant metadata table, j represents the j-th data item in the i-th table, MaxN represents the maximum number of unindexed tables in the wide table, |KYi| represents the space reserved in the wide table for tenant t's indexed tables, and |KNi| and |KYi| represent the number of rows in the wide table. The values of Maxt, MaxN, |KNi|, and |KYi| can be customized based on the amount of tenant data.

[0101] Optionally, the determination unit 53 may include: an acquisition module for acquiring the field table id, index id, tenant id and the index value key, wherein the identification information includes the field table id, the index id, and the tenant id; a calculation module for writing the index value key into the BloomFilter, and obtaining the C value based on the hash value calculated by the BloomFilter according to the tenant id, field table id, and index column id.

[0102] Optionally, the first query unit 55 may include: a third establishing module, configured to convert the C value into hexadecimal to establish the B+ tree.

[0103] It should be noted that the above modules can be implemented through software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.

[0104] An embodiment of the present invention further provides a storage medium storing a computer program, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.

[0105] Optionally, in this embodiment, the storage medium may be configured to store a computer program for performing the following steps:

[0106] S1, obtaining a query request for the data to be queried, wherein the query request carries the data identification information and the index value key;

[0107] S2, in response to the query request, if it is determined that the BloomFilter has the index value, determining a C value corresponding to the data to be queried according to the identification information and the index value, wherein the C value is represented as a set of binary numbers, including the tenant corresponding to the index and the data table and column corresponding to the index;

[0108] S3, find the C value in the index table based on the constructed B+ tree;

[0109] S4, searching the index data table to obtain the storage location V corresponding to the C value, where the V value represents the location of the wide table corresponding to the index.

[0110] Optionally, in this embodiment, the above-mentioned storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store computer programs.

[0111] An embodiment of the present invention further provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0112] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0113] Optionally, in this embodiment, the processor may be configured to execute the following steps through a computer program:

[0114] S1, obtaining a query request for the data to be queried, wherein the query request carries the data identification information and the index value key;

[0115] S2, in response to the query request, if it is determined that the BloomFilter has the index value, determining a C value corresponding to the data to be queried according to the identification information and the index value, wherein the C value is represented as a set of binary numbers, including the tenant corresponding to the index and the data table and column corresponding to the index;

[0116] S3, find the C value in the index table based on the constructed B+ tree;

[0117] S4, searching the index data table to obtain the storage location V corresponding to the C value, where the V value represents the location of the wide table corresponding to the index.

[0118] Optionally, specific examples in this embodiment may refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be described in detail here.

[0119] Obviously, those skilled in the art will appreciate that the various modules or steps of the present invention described above can be implemented using a general-purpose computing device, centralized on a single computing device, or distributed across a network of multiple computing devices. Alternatively, they can be implemented using program code executable by a computing device, which can then be stored in a storage device and executed by the computing device. In some cases, the steps shown or described can be performed in a different order than that shown, or can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, the present invention is not limited to any particular combination of hardware and software.

[0120] The foregoing description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Those skilled in the art will readily appreciate that various modifications and variations of the present invention are possible. Any modifications, equivalent substitutions, or improvements made within the principles of the present invention are intended to be within the scope of protection of the present invention.

Claims

1. A tenant data processing method for PaaS platform, characterized in that: include: Obtain a query request for the data to be queried, wherein the query request carries identification information and an index value key of the data; In response to the query request, if it is determined that the BloomFilter has the index value, determine a C value corresponding to the data to be queried according to the identification information and the index value, wherein the C value is represented as a set of binary numbers, including the tenant corresponding to the index and the data table and column corresponding to the index; According to the constructed B+ tree, find the C value in the index table; Search the index data table to obtain the storage location V corresponding to the C value, where the V value represents the location of the index corresponding to the wide table; The method of finding the C value in the index table based on the constructed B+ tree includes: Establishing a mapping relationship between the logical index value and the storage index value through the BloomFilter construction function; By using a mapping algorithm of index entries in the identification space, a mapping between the storage index and the actual storage is established in a B+ tree manner; And / or, finding the C value in the index table based on the constructed B+ tree includes: Distribute index entries to different Bloom filters according to the principle that one tenant uses one Bloom filter; The determining, according to the identification information and the index value, a C value corresponding to the data to be queried includes: Obtain the field table id, index id, tenant id, and the index value key, wherein the identification information includes the field table id, the index id, and the tenant id; The index value key is written into the BloomFilter, and the C value is obtained by the hash value calculated by the BloomFilter according to the tenant ID, field table ID, and index column ID.

2. The method according to claim 1, characterized in that The index entries are distributed to different Bloom filters according to the principle that one tenant uses one Bloom filter, including: Create a corresponding number of BloomFilters based on the number of tenants, with one tenant corresponding to one BloomFilter; In the initial state, BloomFilter is an m-bit bit array, represented by S = {x1, x2, ..., xm} and each bit of the array is set to 0; Define n independent hash functions H(x). For any element x, the position Hi(x) mapped by the i-th hash function will be set to 1, where 0≤i≤n.

3. The method according to claim 2, characterized in that The method further comprises: When storing data for multiple tenants, if the current field is an index field, the tenant to which the current data belongs is determined and the key value is written into the corresponding Bloom Filter. The one-dimensional binary array K is calculated. According to the number of tenants t, the number of tenant data tables a, and the number of indexes b, a set of binary numbers Itab is obtained to identify the b-th column in table a in tenant t as the index; Combine the two binary numbers Itab and K into a set of binary numbers C, which is the storage index value; The actual storage location of the data in the wide table is obtained through the index entry space mapping function.

4. The method according to claim 3, characterized in that The method further comprises: The index entry space mapping function F(x) is: F(Cij)1= |Kt|*(t-1) + |KNi|*i + j F(Cij)2= |Kt|*(t-1) + |KNi|*MaxN + |KYi|*i + j Where F(Cij)1 represents the actual storage location V of unindexed data in the wide table, where i represents the i-th table in the tenant metadata table, and j represents the j-th data item in the i-th table. |Kt| is the space size of Kt, which indicates the space occupied by tenant t in the wide table. The total space size of the wide table is |K|, where |Kt| = |K| / Maxt, where Maxt represents the maximum number of tenants that the PaaS platform can support. |KNi| represents the space reserved in the wide table for the unindexed table of tenant t. F(Cij)2 represents the actual storage location V of the indexed data in the wide table, where i represents the i-th table in the tenant metadata table, j represents the j-th data item in the i-th table, MaxN represents the maximum number of unindexed tables in the wide table, |KYi| represents the space reserved in the wide table for the indexed tables of tenant t, |KNi| and |KYi| represent the number of rows in the wide table. The values of Maxt, MaxN, |KNi|, and |KYi| are customized according to the amount of tenant data.

5. The method according to claim 1, wherein The method of finding the C value in the index table based on the constructed B+ tree includes: The C value is converted into hexadecimal and the B+ tree is established.

6. A tenant data processing device for PaaS platform, characterized in that: include: An acquiring unit, configured to acquire a query request for the data to be queried, wherein the query request carries identification information and an index value key of the data; a determining unit, configured to respond to the query request and, if it is determined that the BloomFilter has the index value, determine a C value corresponding to the data to be queried according to the identification information and the index value, wherein the C value is represented as a set of binary numbers, including the tenant corresponding to the index and the data table and column corresponding to the index; The first query unit is used to find the C value in the index table according to the constructed B+ tree; A second query unit is configured to search the index data table to obtain a storage location V corresponding to the C value, wherein the V value represents a location of the index corresponding to the wide table; The method of finding the C value in the index table based on the constructed B+ tree includes: Establishing a mapping relationship between the logical index value and the storage index value through the BloomFilter construction function; By using a mapping algorithm of index entries in the identification space, a mapping between the storage index and the actual storage is established in a B+ tree manner; And / or, finding the C value in the index table based on the constructed B+ tree includes: Distribute index entries to different Bloom filters according to the principle that one tenant uses one Bloom filter; The determining, according to the identification information and the index value, a C value corresponding to the data to be queried includes: Obtain the field table id, index id, tenant id, and the index value key, wherein the identification information includes the field table id, the index id, and the tenant id; The index value key is written into the BloomFilter, and the C value is obtained by the hash value calculated by the BloomFilter according to the tenant ID, field table ID, and index column ID.

Citation Information

Patent Citations

  • Rapid data reading / writing method and device

    CN107704202A

  • Efficient database query evaluation

    US20210240670A1