1. Field of the Invention
The invention relates to database management systems (DBMS). More particularly, it relates to improved methods and techniques for efficiently associating temporary information with data-elements in a memory data-space, and the use of those methods and techniques for improving the efficiency and reducing the complexity of on-line database administration utilities.
2. Description of the Related Art
Database administration utilities that use conventional methods and techniques typically require that databases be taken off-line in order to perform certain administrative tasks, such as reorganizing the database. For database systems that use relatively small data stores, taking the database off-line to perform administrative tasks does not raise significant operational issues, because the amount of off-line time required to perform the required administrative task is generally acceptable as it introduces only minimal disruption to operations. However, as the volume of data associated with a database increases, so does the time required to perform administrative tasks upon the database. For example, depending upon the nature of the administrative task to be performed, the time required to execute the administrative task can increase exponentially with the size of the database.
As would be expected, the longer the period of unavailability the greater the likelihood that adverse operational impacts will arise. Furthermore, as customer demands for databases with greater capacity and 24×7 availability increase, system administrators typically find it more and more difficult to schedule much needed maintenance and optimization routines. As a result, many administrative routines are not performed as often as they should to optimize system performance and/or to minimize loss of data in case of system failure resulting, ultimately, in reduced performance and increased operational risk.
Issues associated with database availability can be alleviated by allowing databases to remain on-line while administrative tasks are performed. However, using conventional techniques, allowing a database to remain on-line while performing certain administrative operations can greatly increase the complexity of the administrative utility needed to execute the operation. Such complexity can increase the time required to execute the administrative operation, increase system load, degrade system capacity and performance, and result in unacceptable operational conditions. In a poorly maintained and/or already over-loaded system, such increased load can, in the worst case, result in unrecoverable catastrophic system failure.
Allowing a database to remain on-line while performing an administrative task is being performed typically implies that multiple processes will simultaneously access the data tables and records maintained by the database. Depending upon the administrative operations to be performed, conflicting conditions can arise. For example, if the administrative operation involves copying records from one database table to a second database table, a change must be applied to both database tables if the change imposed by a concurrent process affects a data-element that has already been copied to the second database table. If such conflicts are resolved by locking large segments of the database for extended periods of time, many of the advantages of allowing simultaneous on-line access are negated. If, on the other hand, locks are not strictly imposed, conflicting versions of a database table can arise that must be tracked and later resolved.
Conventional approaches are not capable of efficiently tracking and coordinating the large amount of detailed information that must be maintained to resolve the data integrity and consistency issues that arise during the execution of an on-line reorganization tool. For example, conventional reorganization techniques typically synchronize data across database tables using log files containing a record of the changes made in one or more data tables. Such log-based approaches are relatively slow because they require searching a log file for records relevant to an affected data table, retrieving the relevant records from the log, identifying records in the affected data table that corresponds to the log request (possibly requiring a second search of the copied/reorganized data table), and appropriately applying the logged change. Furthermore, such conventional techniques typically use concatenated strings within the log file to act as unique keys. These keys are used to locate the corresponding records within the related data table, and a change recorded within the log file is then applied. Such concatenated keys are an inefficient mechanism for locating records within a database table. In addition, log files typically contain the actual changed data values, thereby increasing the size of the log file and increasing the amount of information that must be parsed. Furthermore, such log based techniques are sequential in nature, meaning that if five updates are performed against a record in one data table, all five updates are again performed upon the related record in the related data table, even though only the last update is needed to synchronize the two data tables.
Conventional approaches for resolving the discrepancies that arise during the execution of on-line database administrative operations, are I/O intensive, inefficient, time consuming and are not practical for large database systems that require high availability of database tables, and highly optimized performance. A new approach is needed for efficiently tracking and coordinating large amounts of detailed information related to the on-line execution of database administrative operation.
Therefore, in light of the above, and for other reasons that will become apparent when the invention is fully described, apparatuses, articles of manufacture and methods for reorganizing information in a computer system by using data-spaces to manipulate and track information related to a database reorganization using separately addressable memory data-elements. Separate data-spaces are used to store the original data (i.e., an original data-space), receive reorganized copies of data-elements of the original data-space (i.e., a shadow data-space), and to record and track information relative to individual data-elements undergoing reorganization (i.e., a data data-space and an index data-space, respectively).
A data-element in the data data-space stores the original location of an original data-space data-element, the new location of a corresponding data-element in the shadow data-space, and status information that records whether the data-element in the original data-space has been updated or deleted, after the original data-element has been copied to the reorganized data-space and whether any new original data-elements have been added that must be added to the shadow data-space.
Status information in the data data-space is maintained by intercepting log status reports and updating the associated data data-elements to record the changes performed. Data-elements in the data data-space are not required to store the new or modified data, but rather the nature of the change that occurred (i.e., new, update, and delete) is stored. Thus, significant storage space efficiencies are achieved.
Data consistency between data-elements in the original data-space and data-elements in the shadow data-space is achieved by applying recorded changes stored in the data data-space to the related shadowed data-elements. Because the data data-space records the location where changes occurred, the net effect of multiple changes to a data-element in the original data-space can be applied to its associated data-element in the shadow data-space with only a single change. Thus, significant processing efficiencies are achieved in maintaining data consistency across the data-spaces.
Features and advantages of the invention will become apparent upon consideration of the following descriptions and descriptive figures of specific embodiments thereof. While these descriptions go into specific details of the invention, it should be understood that variations may and do exist and would be apparent to those skilled in the art based on the descriptions herein.
The embodiments described below are described with reference to the above drawings, in which like reference numerals designate like components.
Data-spaces are blocks of addressable memory space in a computer readable memory that can hold data, but are not allowed to execute program code. The resources used to access and manipulate data-spaces include a data-space base address that identifies the beginning of the data-space in memory. The location of a data-element within a data-space is determined relative to a data-space base address using a relative base offset address (RBA). An RBA can be represented, for example, as a number of bytes or bits from the data-space base address to the first byte, or bit, of a data-element. The location of a data-element anywhere within a group of data-spaces is identified with a data-space base address/RBA combination, wherein the RBA is an offset from its associated data-space base address. Since data-elements are stored in a data-space in sequential order, a sequence order number (e.g., 0, 1, 2, . . . , N) can be used to specify a relative offset, in data-elements, from the data-space base address. By multiplying the sequence order number associated with a data-element, by the bit/byte length of the data-elements stored in the data-space, a relative base offset address for the data-element in bits/bytes is derived. This computation is simplified when fixed-length data-elements are used in the data-spaces.
The size of data-spaces and data-elements within data-spaces are defined to meet the needs of a specific application, restricted only by the physical memory resources of the operating environment. In an IBM DB2® environment, for example, data-spaces are defined within buffer pools defined in a separate area of memory and are limited to 2 Gigabytes (GB) of memory space. However, multiple data-spaces may be allocated and managed by an application requiring more than 2 GB of data-space storage. Furthermore, database environments are expected to continue to support increasingly larger data-spaces.
Methods and apparatuses are described here that use index data-spaces that point to other data-spaces referred to as data data-spaces to efficiently track and coordinate information associated with data-elements in a data-space. The ability to efficiently store and retrieve large amounts of information related to individual data-elements of a data-space has many useful applications in a database environment. In the case of an on-line reorganization facility (ORF), such methods and techniques are used to allow databases, that would conventionally be taken off-line prior to the execution of certain administrative functions, to remain on-line and accessible during the execution of the same administrative processes. Indexing data-spaces and data data-spaces are used to efficiently track and coordinate information related to the administrative process at the data-element level as well as to track concurrent changes affecting multiple temporary data-spaces used by the administrative process. This information is used to assure that the integrity and consistency of all data-spaces affected by the administrative process are maintained.
The RBA of related data-elements within the original 102/124 and index data-spaces 108/126 is determined based upon the RBA (e.g., 106/110) of one of the related data-elements from either data-space and the fixed data-element size used by each of the respective data-spaces. This novel approach allows indirect addressing, to information contained in one or more data data-spaces, to be applied to any original data-space, without any enhancement or modification to the content of the original data-space.
As shown in
Data-space memory storage requirements associated with the described methods and techniques are optimized to meet the needs of a specific application and operating environment by selecting the original data-space data-element size, data data-space address length, and/or data data-space data-element size. For example, if an application requires that information be stored for each group of thirty-two bytes in an original data-space, the application accesses the original data-space addressable memory space in thirty-two bytes increments, thereby establishing the data-element size within the original data-space as 32-bytes. Although a data-element size of 32-bytes is used here as an example, the data-element size can be selected to be any convenient size. Given that the original data-space is of a fixed size, increasing the data-element size reduces the number of data-elements in the data-space and hence reduces the number of data-elements in the corresponding index data-space. Given that the index data-space data-element has a fixed size, based upon the length of an address for a data data-space data-element, decreasing the number of index data-space data-elements reduces the overhead space required to support the index data-space. Therefore, the original data-space data-element size is selected as large as possible within constraints imposed, directly or indirectly, by application specific requirements.
To further optimize system overhead requirements to meet the needs of a specific application, the number of bytes maintained for each original data-space data-element in the data data-space also can be selectively configured. For example, for one purpose, it may be necessary to store an additional 32 bytes of information for every 4-byte data-element in an original data-space. For another purpose, it may be necessary to store only 16 bytes of information for every 4-byte data-element in an original data-space. The data data-element size in the data data-space can be selected to accommodate those different purposes.
The index data-spaces and data data-spaces shown in
In brief,
A reorganization module 212 copies data-elements from the original data-space 210 to a reorganized shadow copy 214 of the original data-space. Data-elements within the shadow data-space are reorganized in accordance with logic internal to the reorganization module 212. The reorganization module 212 also coordinates with a utility services module 216 to track and store, within a series of index data-spaces 218 and data data-spaces 220, the source and destination addresses of data-elements copied from the original data-space 210 to the reorganized shadow data-space 214.
A log intercept module 206 intercepts log requests and coordinates with the utility services module 216 to track changes to data-elements in the original data-space 210 that have already been copied to the shadow data-space 214. These tracked changes are stored as updates to data-elements created within data data-spaces 220 by the reorganization module 212, as described above.
A pending changes module 208 applies tracked changes retrieved from the data data-space 220, via the utility services module 216, to the shadow data-space 214, thereby assuring consistency between data contained in the original data-space 210 and data contained in the shadow data-space 214. Once all pending changes are applied to the reorganized shadow data-space 214, the original data-space 210 is deactivated and the reorganized shadow data-space 214 is activated to replace the original data-space 210.
The ORF modules described, above, work together to efficiently and effectively reorganize an on-line data-space, with minimal overhead and operational load. The methods and techniques described in relation to
As an example of how the methods and techniques described here are used to efficiently and effectively reorganize an on-line data-space, with minimal overhead and operational load, the inter-relationships between ORF modules and the respective data-spaces are described in additional detail, below.
All of the data-spaces include data-elements, each of which is identified with a relative base address (e.g., 306, 310, 334, and 316) that identifies the start of the data-element relative to the base address of the data-space. The content of data-elements within the original data-space 304 and the shadow data-space 336 is determined by the application programs and is independent of the processes that maintain the data. Although the relative position of data-elements within the shadow data-space may differ from the position of their associated data-elements in the original data-space, in order to optimize organizational efficiency, the content of those data-elements will not be altered.
The index data-elements 309a-e within the index data-space 218 provide an indirect addressing scheme between the original data-elements 303a-e in the original data-space 210 and the data data-elements 315a-e in the data data-space 220. The data data-space 220 serves as a storage area for information necessary for reliably executing an administrative process upon the original data-space 210. Although
Referring again to
In an alternative embodiment, a sequence order number (e.g., 0, 1, . . . N) can be associated with the data-elements of one or more of the respective data-spaces that indicates the position of the data-element within the sequence of data-elements within its respective data-space. Since corresponding data-elements within an original data-space 210 and an index data-space 218 share the same sequence order number, when translating from an index data-space RBA to an original data-space RBA (and vice versa) it is not necessary to divide by the length of the data-element.
In another embodiment, sequence order numbers for data-elements in the respective data-spaces manipulated by an application are stored within data-elements 309a-e/315a-e of the index data-space 218 and/or data data-space 220 to facilitate translation between data-spaces. It should be noted that although “RBA” is depicted in
As shown in
A data data-element 315a-e in a data data-space 220 can be of any length (limited only by the constraints of the operational environment) and can contain any information that an application has been designed to associate with its associated original data-element 303a-e in the original data-space 210. As shown in
With respect to the ORF modules described in relation to
Use of a data-space base address identifier coupled with a RBA sequential data-element identifier to provide the complete address of an element in a data-space is shown in
Updates made to database records already processed by the ORF utility are captured and applied to the shadow data-space 214. This includes updates and newly inserted records earlier in the database than the present position of a ORF utility database cursor. The ORF log intercept module 206 intercepts log requests and compares the database name in the log request with the name of the database being reorganized to determine whether the current log request is a candidate for capture. If the names agree the database cursor is checked to see if the current update is for a record that has been processed by the utility (i.e., is the captured cursor<the current ORF reorganization module 212 cursor). If the affected record has already been copied to the shadow data-space, the change described within the log request is captured for later application to the shadow data-space 214.
Upon intercepting a log request that must be captured for later application to the shadow data-space 214, the log intercept module 206 uses the information within the intercepted log request to search the original data-space 210 to determine the RBA of the data-element(s) affected by the intercepted log request. The RBA value(s) identified are then conveyed to the utility services module 216. If the index data-space 218 indicates that a data data-element 315a-e exists in association with the RBA(s) identified, the flags 321-224 contained within the data data-element are set in accordance with the information contained within the intercepted log request, as described above. If the captured log request indicates newly added data, new data-elements 315a-e/309a-e are added to the data data-space 220 and index data-space 218 and correlated with the corresponding new data-elements 303a-e added to the original data-space 210. In addition, a pending change counter is incremented whenever a data-element is added and/or the first time that an existing data data-element 315a-e is updated to reflect a pending change. In this manner, the pending change counter is updated to reflect the number of data-elements in the shadow data-space 214 that are inconsistent with the original data-space 210.
This approach is efficient with respect to both storage resources and the processing required to track changes as they occur. The data data-elements 315a-e are used to indicate “where” (i.e., the data-space/RBA location) the update has occurred in the original data-space but not “what” has changed, thereby avoiding the need to duplicate change information already stored in the original data-element 303a-e. Furthermore, regardless of the number of times the same data-element in the original data-space is updated, the data data-space 220 requires only one data data-element 315a-e for a corresponding original data-element and does not require additional data data-elements for each change to the original data-element.
When applying pending changes to data-elements 333a-e within the shadow data-space 214, the indirect address and data data-space approach is equally efficient with respect to the processing steps required to apply a tracked change. Pending updates are easily identified based upon the flags within the data data-elements 315a-e, as discussed above. If the flags indicate an update, the contents of the data-element 303a-e located at “old_RBA_ID” are copied to the data-element 333a-e located at “new_RBA_ID.” If the flags indicate a deletion, the shadow data-element 333a-e in shadow data-space 214 at new_RBA_ID is deleted. If the flags indicate an addition, a shadow data-element 333a-e in shadow data-space 214 is added, and the RBA of the added shadow data-element 333a-e in the shadow data-space 214 is stored in the previously created data data-element 315a-e at new_RBA_ID 330 and data is copied from the original data-element 303a-e to the newly created shadow data-element 333a-e.
Such an approach is extremely efficient in that, regardless of how many updates that may have occurred to a data-element in the original data-space prior to the final update, or final deletion, an administrative tool using the techniques described above needs only to apply a single update (i.e., the net end result of the numerous prior changes). A conventional log based tool, on the other hand would sequentially process each recorded update to the original data-space, finally arriving at the same result in the shadow data-space, after the execution of multiple updates, that the present techniques reach after only a single update.
In support of the majority of administrative utilities that are implemented using the data data-space and index data-space techniques addressed above, the data data-space and index data-space are preferably created using data-spaces in high speed volatile memory and are not committed to permanent, non-volatile memory. Index data-spaces and data data-spaces typically can be used to store intermediate information useful to the execution of an administrative application. The data retained in these structures typically would be discarded once the administrative activity is completed. Therefore, even greater speed and efficiency is achieved by maintaining index data-spaces and data data-spaces in non-persistent memory storage, rather than in persistent storage, such as on disk. Furthermore, by storing and retrieving such information in memory storage, access and retrieval times are greatly enhanced, thereby minimizing overhead load.
In the data-space reorganization approach described above, storing such information in memory does not introduce any significant operational risk, for if a system failure occurs, the shadow data-space, index data-space and data data-space may be discarded without losing operational data. The reorganization process can be reinitiated with no loss of data. However, in applications in which such loss of information is unacceptable, index data-spaces and data data-spaces can be committed to persistent storage.
The data structures described in relation to
As described above, the present methods and techniques may be optimized to meet both the needs of an identified application as well as optimization constraints imposed by the operational environment.
The on-line reorganization facility is initiated 402 upon receipt by the initialization module (
After initiation, the reorganization process, proceeds with two sub-processes executing in parallel. The first sub-process, 404, focuses on copying data-elements from the original data-space to the reorganized shadow data-space, as previously described. During this process one data record at a time is locked, thereby prohibiting other users from modifying any segments in the record while the reorganization utility holds the lock. Upon copying/reorganizing all data-elements associated with a record, the lock is released. In this manner, the database may remain accessible throughout the reorganization process for only a small number of records are locked at any one time.
During the process of copying and reorganizing data-elements, performed via sub-process 404, as described above, unlocked records in the original data-space remain on-line and the data-elements contained within those unlocked records remain available to processes external to the ORF processes. Depending upon the nature of the external process, such on-line availability can result in additions, deletions, and/or modification, to information contained within data-elements of the original data-space. Although such availability may be beneficial from an operational perspective, allowing the original data-space to remain on-line creates a likelihood that changes may be applied to a data-element within the original data-space after that same data-element has been copied to the shadow data-space.
While sub-process 404 proceeds to copy and reorganize data-elements to the shadow data-space, the second sub-process 408 monitors log requests and captures changes to data-elements in the original data-space, as described in relation to the discussion of
The reorganization module (
The pending change module communicates with the utility services module (
Having described apparatuses, articles of manufacture and methods of capturing data changes utilizing data-space tracking, it is believed that other modifications, variations and changes will be suggested to those skilled in the art in view of the teachings set forth herein. It is therefore to be understood that all such variations, modifications and changes are believed to fall within the scope of the present invention as defined by the appended claims. Although specific terms are employed herein, they are used in their ordinary and accustomed manner only, unless expressly defined differently herein, and not for purposes of limitation.
IBM is a trademark or registered trademark of International Business Machines, Corporation in the United States and other countries.
DB2 is a trademark or registered trademark of International Business Machines, Corporation in the United States and other countries.
This is a continuation of application Ser. No. 11/295,476 filed Dec. 7, 2005, which is a continuation of application Ser. No. 10/197,810 filed Jul. 19, 2002 which is also related to co-pending and commonly assigned patent application entitled, “Data-Space Tracking with Index Data-Spaces and Data Data-Spaces,” Ser. No. 10/198,151. The entire disclosure of the prior application, application Ser. No. 11/295,476 is hereby incorporated by reference.
Number | Date | Country | |
---|---|---|---|
Parent | 11295476 | Dec 2005 | US |
Child | 12260599 | US | |
Parent | 10197810 | Jul 2002 | US |
Child | 11295476 | US |