A database table space quota management method, device, equipment and medium

By specifying quota pages inside the database table space and establishing quota control items, quota information is directly stored in the target table space, the problems of concurrent access and network overhead in the existing technology are solved, and efficient quota management is achieved.

CN119739719APending Publication Date: 2025-04-01SHANGHAI DAMENG DATABASE
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411953443.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-27
Publication Date
2025-04-01

AI Technical Summary

Technical Problem

The prior art has problems with concurrent access and increased network overhead in database tablespace quota management, especially in distributed environments.

Method used

By specifying a quota page inside the target tablespace and establishing and updating quota control items in the quota page, quota-related information is directly stored in the target tablespace, avoiding obtaining information from other specified tablespaces, and using existing file system concurrency control and data persistence technologies.

Benefits of technology

It solves the problems of concurrent access and network overhead, realizes efficient management of quotas in the database table space, and reduces maintenance costs and network load.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119739719A_ABST
    Figure CN119739719A_ABST
Patent Text Reader

Abstract

The present invention discloses a method, device, equipment and medium for managing a database table space quota. The method comprises: obtaining quota configuration information, wherein the quota configuration information indicates that the quota of a target user in a database in a target table space is a specified value; in the case where there is no quota page in the target table space, a quota page is allocated to the target table space, and a quota control item corresponding to the target user is established in the allocated quota page based on the quota configuration information, wherein the quota control item includes the user ID, quota and used quota of the target user; in the case where there is a quota page in the target table space, it is determined whether the existing quota page includes the quota control item corresponding to the target user, if not, a quota control item corresponding to the target user is established in the existing quota page based on the quota configuration information, and if so, the quota control item corresponding to the target user is updated based on the specified value. No additional concurrent protection mechanism needs to be introduced in the table space quota management, and no additional network overhead is added.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of database technology, and in particular to a method, device, equipment and medium for managing database table space quota. Background Art

[0002] The purpose of database tablespace quota management is to limit the amount of space that users can use in a specified tablespace. Once a quota is set, users are not allowed to use more space than the quota in the specified tablespace. Through database tablespace quota management, you can finely control the space allocation and usage rules within the database, facilitating the stable operation of the database system.

[0003] In the prior art, a system table in a specified tablespace or a memory space in a specified tablespace can be used to store the quota and quota usage information of all users in each tablespace in the database. The disadvantages of such storage are:

[0004] 1. Each tablespace needs to access its corresponding quota-related information from the above specified tablespace, which may cause concurrent access to the above specified tablespace, triggering a large number of irrelevant operations and incurring maintenance costs;

[0005] 2. In a distributed environment, different tablespaces can be distributed on different nodes. If the tablespace that needs quota checking and maintenance is not on the same node as the above specified tablespace, additional network overhead will be added. Summary of the invention

[0006] The present invention provides a method, device, equipment and medium for managing the quota of a database table space. When performing quota management on the database table space, there is no need to introduce an additional concurrent protection mechanism and no additional network overhead is added.

[0007] In a first aspect, an embodiment of the present invention provides a method for managing a database table space quota, including:

[0008] Acquire quota configuration information, where the quota configuration information indicates that a quota of a target user in a target tablespace in a database is a specified value;

[0009] In the case that there is no quota page in the target tablespace, a quota page is allocated to the target tablespace, and a quota control item corresponding to the target user is established in the allocated quota page based on the quota configuration information, wherein the quota control item includes a user ID, a quota, and a used quota of the target user;

[0010] In the case that a quota page exists in the target tablespace, determine whether the existing quota page includes a quota control item corresponding to the target user; if not, establish the quota control item corresponding to the target user in the existing quota page based on the quota configuration information; if yes, update the quota control item corresponding to the target user based on the specified value.

[0011] In a second aspect, an embodiment of the present invention provides a database table space quota management device, including:

[0012] A first processing module is used to obtain quota configuration information, where the quota configuration information indicates that a quota of a target user in a target tablespace in a database is a specified value;

[0013] A second processing module is used to allocate a quota page to the target tablespace if no quota page exists in the target tablespace, and to establish a quota control item corresponding to the target user in the allocated quota page based on the quota configuration information, wherein the quota control item includes a user ID, a quota, and a used quota of the target user;

[0014] The third processing module is used to determine whether the quota page includes the quota control item corresponding to the target user when there is a quota page in the target tablespace; if not, to establish the quota control item corresponding to the target user in the existing quota page based on the quota configuration information; if yes, to update the quota control item corresponding to the target user based on the specified value.

[0015] In a third aspect, an embodiment of the present invention provides an electronic device, including:

[0016] at least one processor; and

[0017] a memory communicatively connected to the at least one processor; wherein,

[0018] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can perform the method according to the first aspect.

[0019] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in the first aspect.

[0020] The technical solution of the embodiment of the present invention specifies a quota page inside the target tablespace, and maintains the quota and quota usage of the target tablespace users in the target tablespace by establishing and updating quota control items in the quota page. The quota-related information corresponding to the target tablespace is stored inside the target tablespace without having to be obtained from other specified tablespaces. When maintaining the quota, the existing file system's own concurrent control of data page access and data persistence technology can be used, without introducing additional concurrent protection mechanisms and without additionally increasing network overhead.

[0021] 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 invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0023] Figure 1 This is a flowchart of a database table space quota management method provided according to Embodiment 1 of the present invention;

[0024] Figure 2 It is a structural diagram of a database table space quota management device provided according to Embodiment 2 of the present invention;

[0025] Figure 3 It is a schematic diagram of the structure of an electronic device implementing an embodiment of the present invention. DETAILED DESCRIPTION

[0026] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme 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 described embodiments 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 creative work should fall within the scope of protection of the present invention.

[0027] It should be noted that the terms "first", "second", etc. in the present invention are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged 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" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0028] Embodiment 1

[0029] Figure 1 This is a flowchart of a database table space quota management method provided according to Embodiment 1 of the present invention. This embodiment is applicable to the case of performing quota management on a database table space. The method can be executed by a database table space quota management device, which can be implemented in the form of software and / or hardware and integrated in an electronic device. Further, the electronic device includes but is not limited to: a computer, a laptop computer, etc.

[0030] like Figure 1 As shown, the method includes:

[0031] S110, obtaining quota configuration information, wherein the quota configuration information indicates that the quota of the target user in the target table space in the database is a specified value; executing S120 or executing S130.

[0032] In a database, a tablespace can be understood as a logical partition of disk space. All database objects can be logically stored in a tablespace. A tablespace can be used to organize and manage data files in a database. A tablespace can consist of one or more data files, each data file can consist of multiple clusters, and each cluster can consist of multiple data pages.

[0033] Among them, a data page can be the basic unit of data storage. When creating a database, the size of a single data page can be specified, such as 4KB, 8KB, 16KB or 32KB. Once the database is created, the size of a single data page cannot be changed during the entire life cycle of the database. A cluster can be the upper logical unit of a data page. A cluster can be composed of consecutive data pages (such as 16, 32 or 64) in the same data file, so the size of a single cluster is also fixed.

[0034] In the database, tablespace quota can be understood as the usage amount of tablespace allocated to users, that is, the amount of space that users can use in a certain tablespace. Tablespace quota management can be understood as the process of limiting the amount of space that users can use in a certain tablespace. Once a user's quota is set for a tablespace, the user's actual usage of space will not exceed the quota.

[0035] The quota configuration information may be information for configuring the quota of the target user in the target tablespace. The target tablespace may be any tablespace in the database. The target user may be any user who can access the target tablespace. The quota may be in units of the number of clusters or bytes. The present invention is described by taking the number of clusters as an example.

[0036] In actual applications, when creating or modifying a target user in a database, the quota of the target user in the target tablespace may be configured to be a specified value through quota configuration information. The specified value is not limited, for example, it may be 0 or a positive integer such as 1000 clusters.

[0037] Exemplarily, a target user 1 is created, the password corresponding to the target user 1 is xxx, and the quota of the target user 1 in the target tablespace is specified to be 1000.

[0038] Exemplarily, the quota of target user 2 in the target tablespace is modified to 9999.

[0039] In one embodiment, the quota configuration information may also indicate the quotas of the target user in multiple table spaces in batches. In this case, each table space involved may be used as a target table space to perform subsequent operations.

[0040] S120. When no quota page exists in the target tablespace, allocate a quota page for the target tablespace, and establish a quota control item corresponding to the target user in the allocated quota page based on the quota configuration information, wherein the quota control item includes a user ID, quota, and used quota of the target user.

[0041] A quota page may be a data page in a tablespace for tablespace quota management, and the number of quota pages is not limited, and may be one or more. A quota control item may be an item reflecting a user's quota in a tablespace and the usage of the quota.

[0042] In the embodiment of the present invention, each table space can specify its own quota page, and the quota page indicates the quota-related information of the users in the table space through the quota control items, and one quota control item may correspond to one user in the quota page. If the first quota page is used up, the next quota page will be used to meet more quota requirements of the user.

[0043] The quota control item corresponding to the target user may include the user ID, quota and used quota of the target user. The user ID may indicate that the quota control item corresponds to the target user. The quota may indicate that the size of the space that the target user can use on the target tablespace is the above-specified value. The used quota may indicate the size of the space that the target user has already used on the target tablespace.

[0044] In this step, if there is no quota page in the target tablespace, the database system can select one or more data pages in the target tablespace as the quota page of the target tablespace according to certain rules. The quota page is specified by the database system and cannot be changed by the user. For example, in the first data file of the target tablespace (recorded as data file No. 0), the second to fourth data pages are used as quota pages.

[0045] In the quota page allocated for the target tablespace, a quota control item corresponding to the target user is established based on the quota configuration information, so that the quota control item corresponding to the target user includes the user ID, quota and used quota of the target user, and the user ID, quota and used quota can all be stored in the form of an integer data type (i.e., int). It is also necessary to format the quota page, and add a field after the general page header of the quota page, which is used to indicate the number of quota control items currently saved in the quota page.

[0046] It should be noted that if the target user's quota is a specified value of 0, the target user's used quota does not need to be calculated when creating a quota control item. If the target user's quota is a specified positive integer such as 1000, the target user's used quota needs to be calculated when creating a quota control item.

[0047] The used quota of the target user can be calculated in the following ways: make sure to complete the cleanup (also known as purge) operation first, that is, release the resources that are no longer used, etc., otherwise the used quota will not be calculated accurately. Then obtain the cluster usage of the target user in the target tablespace, and then calculate the used quota. Specifically, first collect the schema under the target user, then collect all table objects under the schema, calculate the number of clusters occupied by the table in the target tablespace, and count the used quota of the target user in the target tablespace based on the number of clusters occupied by the table. Among them, the schema can be a logical container used to organize and separate related objects in the database. Each user of the database can have his own schema, and can create, operate, and manage database objects in his own schema.

[0048] S130. When a quota page exists in the target tablespace, determine whether the existing quota page includes a quota control item corresponding to the target user; if not, establish a quota control item corresponding to the target user in the existing quota page based on the quota configuration information; if yes, update the quota control item corresponding to the target user based on the specified value.

[0049] In this step, if there is a quota page in the target tablespace, it is determined whether the user identifier contained in the quota control item in the existing quota page is consistent with the user identifier of the target user. If so, it indicates that the quota page includes the quota control item corresponding to the target user; otherwise, it indicates that the quota page does not include the quota control item corresponding to the target user.

[0050] If the quota page does not include the quota control item corresponding to the target user, the quota control item corresponding to the target user is established in the quota page based on the quota configuration information. The method of establishing the quota control item corresponding to the target user is basically the same as in S120 and will not be repeated here.

[0051] If the quota page includes a quota control item corresponding to the target user, the quota included in the quota control item corresponding to the target user is updated to the above specified value without updating the used quota included in the quota control item corresponding to the target user.

[0052] When creating or updating the quota control item corresponding to the target user, the used quota in the quota control item should never exceed the quota. If it exceeds the quota, an error will be reported.

[0053] It should be noted that if the target user is deleted in the database, the quota control items of the target user stored in the quota pages of each tablespace of the database should be deleted accordingly; if the target tablespace is deleted in the database, all quota pages in the target tablespace should be deleted accordingly.

[0054] The technical solution of the embodiment of the present invention specifies a quota page inside the target tablespace, and maintains the quota and quota usage of the target tablespace users in the target tablespace by establishing and updating quota control items in the quota page. The quota-related information corresponding to the target tablespace is stored inside the target tablespace without having to be obtained from other specified tablespaces. When maintaining the quota, the existing file system's own concurrent control of data page access and data persistence technology can be used, without introducing additional concurrent protection mechanisms and without additionally increasing network overhead.

[0055] In one embodiment, the quota configuration information further indicates that the target user has no quota limit in the target tablespace. Accordingly, the method further includes:

[0056] In a case where a quota page exists in the target tablespace and the existing quota page includes a quota control item corresponding to the target user, the quota control item corresponding to the target user in the quota page is cleared.

[0057] When the quota configuration information indicates that the target user's quota in the target tablespace is unlimited, that is, there is no quota: if there is a quota page in the target tablespace and the existing quota page includes the quota control item corresponding to the target user, then the quota control item corresponding to the target user in the quota page is cleared so that the target user's quota in the target tablespace is unlimited; if there is no quota page in the target tablespace, there is no need to create a new quota page in the target tablespace; if there is a quota page in the target tablespace but the quota page does not include the quota control item corresponding to the target user, there is no need to create a new quota control item corresponding to the target user in the existing quota page.

[0058] In one embodiment, the method further comprises:

[0059] When the quota control item corresponding to the target user in the quota page of the target tablespace changes, a write lock is performed on the quota cache node corresponding to the target tablespace, and the quota cache node is synchronously updated based on the change of the quota control item corresponding to the target user.

[0060] The quota cache node corresponding to the target tablespace may be a node in the target tablespace for caching quota control items corresponding to users of the target tablespace. Specifically, a quota information cache table, i.e., a quota cache node, may be created on the memory structure of the target tablespace to store quota control items (user ID, quota, used quota).

[0061] The changes in the quota control items corresponding to the target user in the quota page of the target tablespace may include creating a new quota control item corresponding to the target user in the quota page of the target tablespace, updating the quota control item corresponding to the target user, or clearing the quota control item corresponding to the target user, which is not limited here.

[0062] When the quota control item corresponding to the target user in the quota page of the target tablespace changes, a write lock, i.e., an X lock, should be executed on the quota cache node, and the quota cache node should be updated synchronously on this basis. If a quota control item corresponding to the target user is created in the quota page, the quota control item corresponding to the target user is created synchronously in the quota cache node; if a quota control item corresponding to the target user is updated in the quota page, the quota control item corresponding to the target user is updated synchronously in the quota cache node; if a quota control item corresponding to the target user is cleared in the quota page, the quota control item corresponding to the target user is cleared synchronously in the quota cache node.

[0063] In one embodiment, the method further comprises:

[0064] When the quota control item corresponding to the target user in the quota page of the target tablespace changes, a read lock and an intention exclusive lock are executed on both the target user and the mode corresponding to the target user.

[0065] When the quota control item corresponding to the target user in the quota page of the target tablespace changes, in order to ensure that the table under the target user will not apply for a new cluster, the concurrency control of the data definition language (DDL) related to the tablespace, such as addition, deletion, migration, and addition, deletion, modification, and query operations of the table, is directly controlled by the mode and the target user itself. The concurrency control scheme is to execute a read lock, i.e., an S lock, and an intention exclusive lock, i.e., an IX lock, on the target user; and an S lock + IX lock is also executed on the mode corresponding to the target user.

[0066] For example, the operation of creating a quota control item corresponding to the target user in the quota page of the target tablespace cannot be concurrent with the DDL operation of the object in the table mode, and cannot be concurrent with the addition, deletion, and modification operations in the data manipulation language (DML) of the object in the table mode. It can only be concurrent with the query operation in the DML of the object in the table mode, otherwise it may cause the calculation error of the used quota of the target user. The corresponding concurrency control strategy is as follows:

[0067] 1. For additions, deletions, and modifications in DML, you need to set S+IX blockade for the target user and all modes under the target user;

[0068] 2. DDL, you need to set S+IX blockade for the target user, and perform IX blockade on the mode corresponding to the target user;

[0069] 3. Set S lock + IX lock on the table space.

[0070] In one embodiment, in the quota page of the target table space, the rollback and cleanup operations of the quota control items are processed in the same way as the records in the ordinary data page, which will not be described in detail here.

[0071] It should be noted that the above contents are instructions for setting quotas for target users in the quota page of the target tablespace. The following is a detailed explanation of the maintenance of quota control items corresponding to the target users in the quota page during the process of the target users using quotas, based on the completion of quota settings.

[0072] In one embodiment, after establishing or updating the quota control item corresponding to the target user, the method further includes:

[0073] When the target user needs to apply for a new cluster in the target tablespace, a read lock is executed on the quota cache node corresponding to the target tablespace;

[0074] Determine the quota and used quota corresponding to the target user in the quota cache node corresponding to the target tablespace by atomic reading;

[0075] Determine whether the sum of the number of clusters to be reserved when applying for a new cluster and the determined used quota exceeds the determined quota;

[0076] If yes, applying for a new cluster is not allowed; otherwise, applying for a new cluster is allowed, and the quota page of the target tablespace and the used quota corresponding to the target user in the quota cache node are updated to the sum value;

[0077] The read lock of the quota cache node is released.

[0078] As the target user continues to operate the database, the target user may need to apply for a new cluster in the target tablespace. For example, database operations cannot be separated from writing data pages, and the application of data pages will be applied from the cluster. If there are insufficient free pages in the cluster or the cluster has not been applied, a new cluster needs to be applied in the target tablespace.

[0079] When the target user needs to apply for a new cluster in the target tablespace, the database itself will first reserve a cluster to prevent insufficient remaining space in the target tablespace, to ensure that the size of the physical file allocated to the target tablespace is not exceeded, and then apply for the cluster.

[0080] The operation of reserving clusters may include checking clusters and adjusting clusters, wherein the number of clusters to be reserved is generally greater than or equal to the number of clusters to be applied for.

[0081] The operation of checking the cluster is as follows: execute a read lock on the quota cache node corresponding to the target tablespace, read the quota control item of the target user in the quota cache node corresponding to the target tablespace based on the user ID of the target user by atomic read, and determine the quota and used quota corresponding to the target user in the quota control item; determine whether the sum of the number of clusters to be reserved when applying for a new cluster and the determined used quota exceeds the determined quota. If so, the check fails and the application for a new cluster is not allowed. Otherwise, the check passes and the application for a new cluster is allowed.

[0082] After the check is passed, the cluster adjustment operation is performed as follows: according to the offset of the target user in the quota cache node, directly locate the quota control item of the target user in the quota page of the target tablespace, update the used quota included in the quota control item of the target user in the quota page to the above sum value, and update the used quota of the target user in the quota cache node to the above sum value. Finally, release the read lock on the quota cache node.

[0083] In one embodiment, after establishing or updating the quota control item corresponding to the target user, the method further includes:

[0084] When the target user deletes a cluster in the target tablespace, a read lock is executed on the quota cache node corresponding to the target tablespace;

[0085] The quota page of the target tablespace and the used quota corresponding to the target user in the quota cache node are updated to the difference between the used quota and the number of deleted clusters;

[0086] The read lock of the quota cache node is released.

[0087] When the target user deletes a cluster in the target tablespace, a read lock is executed on the quota cache node corresponding to the target tablespace; based on the user ID of the target user, the used quota of the target user is updated in the quota cache node corresponding to the target tablespace to the difference between the used quota and the number of deleted clusters; based on the user ID of the target user, the used quota of the target user is updated in the quota page of the target tablespace to the difference between the used quota and the number of deleted clusters; finally, the read lock is released on the quota cache node.

[0088] In one embodiment, the operation of updating the used quota corresponding to the target user in the quota page of the target tablespace and the quota cache node includes:

[0089] Execute a write lock on the quota page, and update the used quota corresponding to the target user in the quota page;

[0090] Updating the used quota corresponding to the target user in the quota cache node by atomic write;

[0091] The write lock on the quota page is released.

[0092] Update the used quota corresponding to the target user in the quota page and quota cache node of the target tablespace, that is, the above-mentioned operation of increasing or decreasing the used quota, as follows: when the read lock, that is, the S lock, is on the quota cache node, execute the write lock, that is, the X lock, on the quota page, and update the used quota in the quota control item of the target user in the quota page to increase or decrease; based on the X lock of the quota page, update the used quota in the quota control item of the target user in the quota cache node by atomic write; release the X lock on the quota page. When the X lock is released on the quota page, release the S lock on the quota cache node.

[0093] In the above process of updating the used quota corresponding to the target user, the X lock on the quota page is used to complete the update of the used quota of the quota page and the quota cache node in the X lock of the quota page, and the competitive access to the quota cache node only uses the S lock. The advantage of this setting is that there are only read-write and write-write conflicts, and no read-read conflicts, thereby reducing read access conflicts.

[0094] In the above process of updating the used quota corresponding to the target user, the used quota in the quota cache node is implemented by atomic write operation. The so-called atomic operation means that the operation will never be interrupted by any other task or event before it is completed, that is, its smallest execution unit cannot be smaller than it.

[0095] Under normal circumstances, only write-write operations and read-write operations will have conflicts. For example, there are conflicts between modifying quotas and modifying quotas, modifying quotas and querying quotas, modifying used quotas and modifying used quotas, and modifying used quotas and querying used quotas. There are no conflicts between read-read operations, for example, there is no conflict between querying used quotas and querying used quotas. In the embodiment of the present invention, the writing and writing of quota pages and the reading and writing are controlled by a physical page lock mechanism. The writing of the quota page is guaranteed by the X lock of the present invention, and the writing of the used quota of the quota cache node is guaranteed by atomic write.

[0096] It should be noted that, in the embodiment of the present invention, the S lock on the quota cache node can be understood as an S lock on the object, and the reading and writing of the quota page can be understood as being implemented by a page lock. Among them, the page lock is a read-write lock of the page, which only temporarily blocks the data page and is generally released soon, which is actually a latch.

[0097] A latch is an internal data structure of a database management system, usually used to coordinate and manage concurrent access to resources such as buffers, dictionary caches, and database files. Unlike a lock that is always held throughout the transaction lifecycle, a latch is usually held for only a very short period of time, such as immediately after the content of a data page in a buffer is modified. The latch's blocking type is also relatively simple, divided into two types: shared and exclusive.

[0098] Embodiment 2

[0099] Figure 2 is a schematic diagram of the structure of a database table space quota management device provided according to the second embodiment of the present invention. This embodiment is applicable to situations where quota management is performed on database table spaces, such as Figure 2 As shown, the specific structure of the device includes:

[0100] The first processing module 21 is used to obtain quota configuration information, where the quota configuration information indicates that the quota of a target user in the database in the target table space is a specified value;

[0101] The second processing module 22 is used to allocate a quota page to the target tablespace if no quota page exists in the target tablespace, and to establish a quota control item corresponding to the target user in the allocated quota page based on the quota configuration information, wherein the quota control item includes a user ID, a quota, and a used quota of the target user;

[0102] The third processing module 23 is used to determine whether the quota page includes the quota control item corresponding to the target user when there is a quota page in the target tablespace; if not, to establish the quota control item corresponding to the target user in the existing quota page based on the quota configuration information; if yes, to update the quota control item corresponding to the target user based on the specified value.

[0103] The database table space quota management device provided by this embodiment obtains quota configuration information through a first processing module, and the quota configuration information indicates that the quota of the target user in the database in the target table space is a specified value; through a second processing module, when there is no quota page in the target table space, the quota page is allocated to the target table space, and the quota control item corresponding to the target user is established in the allocated quota page based on the quota configuration information, and the quota control item includes the user ID, quota and used quota of the target user; through a third processing module, when there is a quota page in the target table space, it is determined whether the existing quota page includes the quota control item corresponding to the target user, if not, the quota control item corresponding to the target user is established in the existing quota page based on the quota configuration information, and if so, the quota control item corresponding to the target user is updated based on the specified value. The quota-related information corresponding to the target table space is stored in the target table space without being obtained from other specified table spaces, and the existing file system itself can be used for maintaining the quota. The concurrent control of data page access and the data persistence technology do not need to introduce additional concurrent protection mechanisms, and the network overhead will not be increased.

[0104] Furthermore, the quota configuration information further indicates that the quota of the target user in the target tablespace is unlimited. Accordingly, the device further includes:

[0105] The clearing module is used to clear the quota control item corresponding to the target user in the quota page when there is a quota page in the target tablespace and the existing quota page includes the quota control item corresponding to the target user.

[0106] Furthermore, the device also includes:

[0107] The update module is used to execute write lock on the quota cache node corresponding to the target tablespace when the quota control item corresponding to the target user in the quota page of the target tablespace changes, and synchronously update the quota cache node based on the change of the quota control item corresponding to the target user.

[0108] Furthermore, the device also includes:

[0109] The blocking module is used to execute a read lock and an intention exclusive lock on both the target user and the mode corresponding to the target user when the quota control item corresponding to the target user in the quota page of the target tablespace changes.

[0110] Furthermore, the device also includes:

[0111] A first execution module is used to execute a read lock on a quota cache node corresponding to the target tablespace when the target user needs to apply for a new cluster in the target tablespace after the quota control item corresponding to the target user is established or updated;

[0112] A determination module, configured to determine the quota and the used quota corresponding to the target user in the quota cache node corresponding to the target tablespace by atomic reading;

[0113] A judgment module, used to judge whether the sum of the number of clusters to be reserved when applying for a new cluster and the determined used quota exceeds the determined quota;

[0114] A cluster application module, configured to: if yes, not allow application for a new cluster; if no, allow application for a new cluster, and update the used quota corresponding to the target user in the quota page of the target tablespace and the quota cache node to the sum value;

[0115] The first releasing module is used to release the read lock of the quota cache node.

[0116] Furthermore, the device also includes:

[0117] A second execution module is configured to execute a read lock on a quota cache node corresponding to the target tablespace when the target user deletes a cluster in the target tablespace after the quota control item corresponding to the target user is established or updated;

[0118] A cluster deletion module, used to update the used quota corresponding to the target user in the quota page of the target tablespace and the quota cache node to the difference between the used quota and the number of deleted clusters;

[0119] The second releasing module is used to release the read lock of the quota cache node.

[0120] Furthermore, the operation of updating the used quota corresponding to the target user in the quota page of the target tablespace and the quota cache node includes:

[0121] Execute a write lock on the quota page, and update the used quota corresponding to the target user in the quota page;

[0122] Updating the used quota corresponding to the target user in the quota cache node by atomic write;

[0123] The write lock on the quota page is released.

[0124] The database table space quota management device provided in the embodiment of the present invention can execute the database table space quota management method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0125] Embodiment 3

[0126] Figure 3 Schematic diagram of the structure of the electronic device implementing the embodiment of the present invention. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.

[0127] like Figure 3 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0128] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0129] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as a database table space quota management method.

[0130] In some embodiments, the database table space quota management method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the database table space quota management method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to execute the database table space quota management method in any other appropriate manner (e.g., by means of firmware).

[0131] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0132] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0133] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, 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), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0134] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0135] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0136] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may 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 to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.

[0137] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.

[0138] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A method for managing database table space quota, characterized in that: include: Acquire quota configuration information, where the quota configuration information indicates that a quota of a target user in a target tablespace in a database is a specified value; In the case that there is no quota page in the target tablespace, a quota page is allocated to the target tablespace, and a quota control item corresponding to the target user is established in the allocated quota page based on the quota configuration information, wherein the quota control item includes a user ID, a quota, and a used quota of the target user; In the case that a quota page exists in the target tablespace, determine whether the existing quota page includes a quota control item corresponding to the target user; if not, establish the quota control item corresponding to the target user in the existing quota page based on the quota configuration information; if yes, update the quota control item corresponding to the target user based on the specified value.

2. The method according to claim 1, characterized in that The quota configuration information further indicates that the target user has no quota limit in the target tablespace. Accordingly, the method further includes: In a case where a quota page exists in the target tablespace and the existing quota page includes a quota control item corresponding to the target user, the quota control item corresponding to the target user in the quota page is cleared.

3. The method according to claim 1 or 2, characterized in that: Also includes: When the quota control item corresponding to the target user in the quota page of the target tablespace changes, a write lock is performed on the quota cache node corresponding to the target tablespace, and the quota cache node is synchronously updated based on the change of the quota control item corresponding to the target user.

4. The method according to claim 1 or 2, characterized in that: Also includes: When the quota control item corresponding to the target user in the quota page of the target tablespace changes, a read lock and an intention exclusive lock are executed on both the target user and the mode corresponding to the target user.

5. The method according to claim 1, characterized in that: After establishing or updating the quota control item corresponding to the target user, the method further includes: When the target user needs to apply for a new cluster in the target tablespace, a read lock is executed on the quota cache node corresponding to the target tablespace; Determine the quota and used quota corresponding to the target user in the quota cache node corresponding to the target tablespace by atomic reading; Determine whether the sum of the number of clusters to be reserved when applying for a new cluster and the determined used quota exceeds the determined quota; If yes, applying for a new cluster is not allowed; otherwise, applying for a new cluster is allowed, and the quota page of the target tablespace and the used quota corresponding to the target user in the quota cache node are updated to the sum value; The read lock of the quota cache node is released.

6. The method according to claim 1, characterized in that After establishing or updating the quota control item corresponding to the target user, the method further includes: When the target user deletes a cluster in the target tablespace, a read lock is executed on the quota cache node corresponding to the target tablespace; The quota page of the target tablespace and the used quota corresponding to the target user in the quota cache node are updated to the difference between the used quota and the number of deleted clusters; The read lock of the quota cache node is released.

7. The method according to claim 5 or 6, characterized in that: The operation of updating the used quota corresponding to the target user in the quota page of the target tablespace and the quota cache node includes: Execute a write lock on the quota page, and update the used quota corresponding to the target user in the quota page; Updating the used quota corresponding to the target user in the quota cache node by atomic write; The write lock on the quota page is released.

8. A database table space quota management device, characterized in that: include: A first processing module is used to obtain quota configuration information, where the quota configuration information indicates that a quota of a target user in a target tablespace in a database is a specified value; A second processing module is used to allocate a quota page to the target tablespace if no quota page exists in the target tablespace, and to establish a quota control item corresponding to the target user in the allocated quota page based on the quota configuration information, wherein the quota control item includes a user ID, a quota, and a used quota of the target user; The third processing module is used to determine whether the quota page includes the quota control item corresponding to the target user when there is a quota page in the target tablespace; if not, to establish the quota control item corresponding to the target user in the existing quota page based on the quota configuration information; if yes, to update the quota control item corresponding to the target user based on the specified value.

9. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can perform the method according to any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.