1. Technical Field
The present invention relates to an improved data processing and in particular to a method, apparatus, and computer instructions. Still more particularly, the present invention relates to a method, apparatus, and computer instructions for managing version of objects.
2. Description of Related Art
Data storage components, variables, collections, and multi-dimensional collections are used throughout all computer applications. During the execution of an application, the contents of these types of data storage elements will change or evolve. These changes occur due to modifications or updates to the data. These changes may be made by user input or through programmatic means. As the program logic of an application progresses, situations often arise in which the program state and the content of the data storage elements need to be reset to a prior state. This state may be an arbitrary state selected by the user or programmatically by an application. Mechanisms for incrementally saving and resetting data to a prior known state are present in many applications.
Currently available mechanisms are found in applications, such as word processors, for resetting or rolling back to a previous state. A word processor may allow a user to undo changes to a document, such as deletions, insertions, or formatting changes. A significant problem with existing mechanisms is that they are prone to inefficiencies and require explicit management by the application programmer or end user. Therefore, it would be advantageous to have an improved method, apparatus, and computer instructions for data versioning and recovery management.
The present invention provides a method, apparatus, and computer instructions for managing object properties. A setter call is received from an application, wherein the setter call includes data. A determination is made as to whether the setter call is versionable. The setter call is executed is the call is a versionable call, wherein versioning data is saved in executing the setter call.
The novel features believed characteristic of the invention are set forth in the appended claims. The invention itself, however, as well as a preferred mode of use, further objectives and advantages thereof, will best be understood by reference to the following detailed description of an illustrative embodiment when read in conjunction with the accompanying drawings, wherein:
With reference now to the figures and in particular with reference to
Referring to
Peripheral component interconnect (PCI) bus bridge 214 connected to I/O bus 212 provides an interface to PCI local bus 216. A number of modems may be connected to PCI local bus 216. Typical PCI bus implementations will support four PCI expansion slots or add-in connectors. Communications links to other data processing systems may be provided through modem 218 and network adapter 220 connected to PCI local bus 216 through add-in connectors.
Additional PCI bus bridges 222 and 224 provide interfaces for additional PCI local buses 226 and 228, from which additional modems or network adapters may be supported. In this manner, data processing system 200 allows connections to multiple network computers. A memory-mapped graphics adapter 230 and hard disk 232 may also be connected to I/O bus 212 as depicted, either directly or indirectly.
Those of ordinary skill in the art will appreciate that the hardware in
With reference now to
Runtime data areas 304 contain native method stacks 316, Java stacks 318, PC registers 320, method area 322, and heap 324. These different data areas represent the organization of memory needed by JVM 300 to execute a program.
Java stacks 318 are used to store the state of Java method invocations. When a new thread is launched, the JVM creates a new Java stack for the thread. The JVM performs only two operations directly on Java stacks: it pushes and pops frames. A thread's Java stack stores the state of Java method invocations for the thread. The state of a Java method invocation includes its local variables, the parameters with which it was invoked, its return value, if any, and intermediate calculations. Java stacks are composed of stack frames. A stack frame contains the state of a single Java method invocation. When a thread invokes a method, the JVM pushes a new frame onto the Java stack of the thread. When the method completes, the JVM pops the frame for that method and discards it. The JVM does not have any registers for holding intermediate values; any Java instruction that requires or produces an intermediate value uses the stack for holding the intermediate values. In this manner, the Java instruction set is well defined for a variety of platform architectures.
Program counter (PC) registers 320 are used to indicate the next instruction to be executed. Each instantiated thread gets its own PC register and Java stack. If the thread is executing a JVM method, the value of the PC register indicates the next instruction to execute. If the thread is executing a native method, then the contents of the PC register are undefined. Native method stacks 316 stores the state of invocations of native methods. The state of native method invocations is stored in an implementation-dependent way in native method stacks, registers, or other implementation-dependent memory areas. In some JVM implementations, native method stacks 316 and Java stacks 318 are combined.
Method area 322 contains class data while heap 324 contains all instantiated objects. A heap is an area of memory reserved for data that is created at runtime. The constant pool is located in method area 322 in these examples. The JVM specification strictly defines data types and operations. Most JVMs choose to have one method area and one heap, each of which is shared by all threads running inside the JVM, such as JVM 300. When JVM 300 loads a class file, it parses information about a type from the binary data contained in the class file. JVM 300 places this type of information into the method area. Each time a class instance or array is created, the memory for the new object is allocated from heap 324. JVM 300 includes an instruction that allocates memory space within the memory for heap 324 but includes no instruction for freeing that space within the memory. Memory management 310 in the depicted example manages memory space within the memory allocated to heap 324. Memory management 310 may include a garbage collector, which automatically reclaims memory used by objects that are no longer referenced. Additionally, a garbage collector also may move objects to reduce heap fragmentation.
The present invention provides a memory management subsystem to provide for data versioning and recovery management for objects in a heap. The mechanism of the present invention saves modifications or deltas in data when objects in memory are changed. A delta in data is the difference between the data in its prior version and its current version. The different deltas may be used to restore objects to a prior state. These deltas also are referred to as delta data. In these illustrative examples, the memory management subsystem may include, for example, memory management 310 and heap 324 in
The mechanism of the present invention modifies this heap to include objects for restoring delta data. In these examples, delta data represents change values or data for a particular memory object. This delta data is associated with an index. This index may take various forms, such as a number or a timestamp. In particular, these changes are stored in a data structure, for example, a linked list in a heap. The mechanism of the present invention modifies the memory management system to automatically generate this linked list in the heap of a JVM without requiring any special requests from applications or the user. Alternatively, the objects may be allocated in the heap to include the delta data.
Turning now to
In these examples, the requests from application 402 and application 404 take the form of application programming interface (API) call 412 and API call 414. An API is a language and message format used by an application program to communicate with the operating system. APIs are implemented by writing function calls in the program, which provide the linkage to the required subroutine for execution. If these API call include an argument or parameter indicating that delta data should be stored for restoring prior versions of an object, objects 406 and 408 are allocated in a manner to allow for versioning of the objects to occur. In other words, changes in data in these objects are stored in a manner to allow the objects to be restored to a prior version.
In these illustrative examples, this delta data is maintained using delta object linked list 416, which is a data structure located within heap 410. This list is allocated by memory management process 400. This particular data structure contains a linked list of entries that identify delta data for various objects, such as object 406 and object 408.
In this example, object 406 includes object header 418 and object data 420. Object 408 includes object header 422 and object data 424. Object data 420 and object data 424 contain the data for the object in its current state. Object header 414 includes a pointer or offset to delta object linked list 416. In a similar fashion, object header 422 also includes a pointer or offset in the delta object linked list 416.
In allocating object 406 and 408, memory management process 400 also includes an indicator or tag with object headers 418 and 422. As depicted, object header 418 contains tag 426, and object header 422 contains tag 428. These indicators or tags are used to identify objects 406 and 408 as objects for which delta data will be stored to allow restoring these objects to a prior state.
When application 402 changes an object, such as object 406, memory management process 400 creates an entry within delta object linked list 410 to store the delta data. Specifically, any changed values in object 406 are stored within delta object linked list 410 in association with the identification of object 406 and an index, such as a numerical value or a timestamp.
This change in data may be stored every time an object is changed. Alternatively, the changes may be stored only when an application changes the data through an API call that includes an additional parameter or argument that indicates that the change is to occur. An example of an API call is set_version (object reference, object version). The object reference is the identification of the object, and the object version provides an identifier. Alternatively, the object version may be excluded from the call. In this case, memory management process 400 may generate a version identifier to return to the application making the call.
In this manner, all changes to object 406 are stored within delta object linked list 410. Thus, object 406 may be returned to any prior state desired using this data structure.
If a request is received by memory management process 400 to restore one of the objects in the heap to a prior state, the process identifies the object and an index to identify the state that is desired. An example of an API call is restore_version (object reference, object version). The object reference is a pointer to the object that is to be restored. The object version is an index used to identify the version of the object that is to be restored.
This index may be, for example, a numerical value or a timestamp. If, for example, object 406 is identified in the request, the object header is used to find delta object linked list 410. The index in the request is used to identify the desired state for object 406. Based on the particular entry identified in linked list 410, the linked list may be traversed to make the appropriate changes to object 406 to return that object to its original state.
In these depicted examples, all of the delta data for all objects is stored within delta object linked list 410. The entries that apply to a particular object may be identified through an object identifier that is found within each entry of delta object linked list 410.
In other illustrative examples, a separate linked list data structure may be used for each object. In this case, the object header provides an offset to the particular linked list data structure for that object.
Turning next to
In this illustrative example, memory management process 500 receives requests from application 502 and application 504 in the form of API calls 506 and 508 to create objects 510 and 512 for use by the applications. In this example, object 510 is created for use by application 502, and object 512 is created for use by application 504. Memory management process 500 may be implemented within memory management 310. In these examples, objects 510 and 512 contain delta data that allows these objects to be restored to a prior version or state.
Objects 510 and 512 are located in heap 514. Object 510 includes object header 516, object data 518, and delta object linked list 520. Object header 516 includes an offset to point to the beginning of delta object linked list 520 in this illustrative example. Object data 518 contains the current data for object 510. Delta object linked list 520 contains entries that identify all of the delta data for object 510. In a similar fashion, object header 522 provides an offset to the beginning of delta object linked list 524. Object data 526 contains the current data for object 512. Delta object linked list 524 contains all the delta data for changes made to object data 526. These types of objects are created when a call to allocate an object includes an additional parameter or argument that indicates that the object should be restorable to a prior state. If this additional argument or parameter is missing, the object s allocated normally.
In this illustrative example, memory management process 500 automatically increases the size of object 510 in response to a request to allocate object 510 in which the request includes an indication that that object 510 is to store data needed to restore object 510 to a prior version or state. This increased size includes space needed to store the delta data.
In addition to allocating these objects in response to a specific call requesting data versioning for the objects, this type of allocation for objects 510 and 512 may be performed automatically without requiring an application or a user to request the additional memory to store delta data. Additionally, memory management process 500 may allocate more space for object 510 and object 512 as the object data and the delta data increase for these objects.
In this particular illustrative embodiment, these objects may be moved and copied such that the delta data automatically is moved or copied with the objects. In this manner, an object may be saved and reloaded at a later time with its delta data intact. In this fashion, an object may be restored to a prior state at any time without having to locate or save data objects from the heap and restore those objects separately.
Turning now to
In these illustrative examples, delta object linked list 600 contains entries 602, 604, 606, 608, 610, 612, and 614. As shown, each of these entries contains a time stamp, an object reference, an array index, and a value. The time stamp indicates when the entry was made. The object reference is the pointer to the object for the entry. The array index identifies the location in which data has changed, and the value indicates the change in the data at that location.
In this illustrative example, the prior state is identified through a timestamp. If the memory management subsystem receives a request identifying a particular timestamp and object, the object may be returned to that state. Entry 614 is the most recent entry, while entry 602 is the oldest entry. Entries 602, 604, 606, and 610 are entries for one object, MS 1. Entries 608, 612, and 614 are entries for another object, MS 2. The mechanism of the present invention traverses the linked list from the most current entry to the entry identified by the timestamp. Entries for objects other than the selected object are ignored.
This type of traversal and restoration of data is provided as one manner in which an object may be restored to a prior state. Of course, any process used to return an object to a prior state using delta data may be employed in these illustrative examples.
The delta in data may be identified or calculated in a number of different ways. In these examples, the delta data may be calculated using an exclusive OR (XOR). In other words, the value of prior data may be XOR'd with the value of the current data to identify the change in the current data as compared to the prior data. The result of this function is considered the delta in the data in this example. With this delta the current data may be restored to the value of the current data. The data may be, for example, the values for data in all of the heaps managed by a memory management system. The delta in the data also may be calculated using Moving Picture Experts Group processes, such as MPEG 2. With these processes every delta is similar to a video frame with respect to normal use in processing video data. Instead, the deltas are for one or more memory segments. As with a video, in which not every pixel necessarily changes from frame to frame, not all of the data elements within a memory segment may change from one delta to another delta. Compression algorithms, similar to MPEG2, can be employed which minimize the amount of memory required to store the necessary information, or delta, to restore the memory segments to prior values.
Turning next to
As shown, delta object linked list 700 includes entries 702, 704, and 706. Each entry includes a time stamp, an array index, and a value. An object reference is not included in this list as with delta object linked list 600 in
Although
Additionally, the mechanism of the present invention allows for portions of code to be marked in which objects on the marked portions are tracked for changes. This mechanism is implemented in a memory management process, such as memory management process 500 in
In
Any alterations or changes to objects in marked portion 806 and marked portion 812 are tracked in the manner described above. This type of tracking does not require calls to be made by the application to identify particular objects.
With reference to
When line 902 is encountered during the execution of code 900, any changes to objects are tracked. Execution of line 906 results in the changes to object ACCT1 being tracked. In other words, the change is stored in a data structure such as delta object linked list 700 in FIG. 7. In this manner, this object may be restored to a prior version or state. Execution of line 908 results in a similar storing of data for object ACCT2. When line 904 is encountered, tracking changes to objects no longer occurs when execution of line 910 occurs incrementing the object ACCT3.
The tags illustrated in
Further, the present invention also includes a mechanism for object based access application programming interface. The mechanism adds an ability to access data elements in a class. In these examples, a specific instance of a class is referred to as an object. A version of getter and setter calls are provided in which versioning may occur through these calls. Getters and setters are calls in Java that provide direct access to properties in a class. A getter is used to read a value for a particular property, while a setter is used to write a value for a property. The mechanism of the present invention extends these calls to provide for versioning.
The versioning version of these functions is initiated when an overload occurs. As described above, an overload is present when an additional parameter or argument is present in the setter or getter call. For example, if a setter or getter includes a version identifier as an additional parameter, the version of the function that provides for versioning of data is used. Although, the versioning function is initiated in these examples though the use of an additional parameter, versioning may be initiated in other ways. For example, the versioning function may be initiated if the object in which data is changed is a versionable object, such as those shown in
Turning next to
Class 1000 may be allocated in the manner illustrated in
In line 1102, a setter is illustrated in which versioning is initiated for the object. In this example, the property “city” is set to the value “New York” by this setter for the object “lawyer”. The additional parameter “new” is used to initiate the versioning function for this setter.
In this manner, the mechanism of the present invention provides for versioning in getter and setter calls. A call that includes a parameter or argument that indicates versioning is present may be implemented using the marking process described above. In this case, tags or statements are inserted around the code for a class for which versioning is to occur. With this type of getter and setter, changes to data for a class may be detected and retrieved.
The mechanism of the present invention allows for grouping objects in handling versioning information for the objects. In this manner, a call may be applied to an entire group of objects, rather than a single group of objects. Turning to
A new instance of an object in this group is created by line 1202. The property for all of the objects in the group are obtained using the statement in line 1204. This same property may be set for all of the objects in line 1206. In this manner, setter and getter functions may be applied to a group of objects with versioning. Further, this grouping of objects allows for an entire set of objects to be restored to a prior version.
In
In entry 1302, the property “city” is “Dallas” and is associated with the version “old”. In entry 1304, the property “city” is “New York” and is associated with the version “new”. Entry 1304 represents data created for the setter statement in line 1102 in
All of this versioning information is stored in association with the object “lawyer” in a data structure, such as delta object linked list 514 in
Turning now to
The process begins by receiving a request to allocate an object (step 1400). In these examples, the request is received from an application, such as application 402 in
Next, an offset is calculated and stored in the object header (step 1406). This offset is used by the memory management subsystem to point to the delta object linked list. The object is then allocated and tagged (step 1408). The object is tagged by including a tag or indicator within the object. This tag or indicator is used to identify the object as one in which delta data is stored for versioning. An object reference is then returned to the requester (step 1410). This object reference is by the requester to write or read the object.
At this point, the requestor may access the allocated object. In these illustrative examples, step 1404 may be an optional step depending on the particular implementation. In the instance in which the delta object linked list is allocated as a separate data structure from the object, this step may be skipped.
Turning now to
The process begins by detecting an alteration of the data in the object (step 1500). This step may occur in different ways; for example, when the memory management process receives a request to change data in an object. When that change is processed, a determination is made as to whether the object is tagged (step 1502). The tag is used to indicate whether the object is set up such that changes in data can be stored for the object. If the object is tagged, an entry is created in the delta object linked list (step 1504) with the process terminating thereafter. Otherwise, the process terminates without storing the delta data. The linked list in step 1504 may be a combined linked list for all objects being managed. Alternatively, the linked list may be one that was created within the object when the object was allocated or as a separate linked list associated with the object.
Turning now to
The process begins by receiving a request to restore an object to an earlier state (step 1600). This request may be received from an application or a user input. Additionally, the request may be received from another process, such as an operating system or JVM process requiring the object to be returned to some other state. An index and an object identifier are identified from the request (step 1602). The location of the delta object linked list is identified from the object (step 1604). In step 1604, the location of the delta object linked list is identified using the offset from the object header. Thereafter, the object is restored to the earlier state using the delta data in the delta object linked list using the index (step 1606) with the process terminating thereafter.
Turning now to
The process begins by selecting a most recent unprocessed entry in the delta object linked list (step 1700). The object is then altered to include the value from the entry (step 1702). Next, a determination is made as to whether an entry identified by the index has been processed (step 1704). This step determines whether the particular index, such as a timestamp for the object, has been processed. If this entry has been processed, the object has then been returned to the desired state with the process terminating thereafter.
Otherwise, the process returns to step 1700 to select the next most recent unprocessed entry in the delta object linked list. In the instance in which the linked list includes entries for other object, a determination may be included to determine whether the object identifier is for the object that is being restored.
Turning now to
The process begins by receiving a marking API call (step 1800). This call may be, for example, an API call that includes the name of a class as a parameter. Begin and end statements are inserted in to the code (step 1802). Next, a determination is made as to whether an unprocessed object is present in the marked code (step 1804). If an unprocessed object is present, the object is processed by creating a versioning object for the identified object (step 1806). Step 1806 allows for delta data to be stored during execution of the code. Thereafter, the process returns to step 1804 to determine whether additional unprocessed objects are present. The process terminates when all of the objects in the marked code have been processed.
With reference to
The process begins by detecting a begin statement (step 1900). Code execution is then monitored (step 1902). A determination is made as to whether an object has been altered (step 1904). If the object is altered, the change is tracked (step 1906). Next, a determination is then made as to whether an end statement has been encountered (step 1908). If an end statement has been encountered, the process is then terminated.
Turning back to step 1904, if a determination is made that no object has been altered, the process returns back to monitor code execution step 1902. The process also returns to step 1902 if an end statement is not found.
Turning to
The process begins by receiving a getter call (step 2000). The process then identifies the object (step 2002. The object is identified in the call. Further, this object may actually be a group or set of objects. A determination is made as to whether a versioning ID is present in a call (step 2004). The presence of a version ID is considered an additional argument or parameter used to initiate the versioning feature of this call.
If a version ID is present in the call, a call is made for data using the version identifier (step 2006). Step 2006 is employed to retrieve data for a particular version as identified by the version identifier. Next, a determination is made as to whether unprocessed objects are present in the call (step 2008). Step 2008 is used to determine whether the call is for a group of objects rather than a single object. If unprocessed objects are not present in the call, the value for each object is returned (step 2010) with the process terminating thereafter.
Turning back to step 2004, if a version ID is not present in the call, the process then calls for default data (step 2012) with the process returning to step 2008. This default data is the value normally returned for the property when versioning is not present or supported. With reference again to step 2008, if more unprocessed objects are present in the call, the process returns to step 2002 to identify another object for processing.
Turning to
The process begins by receiving a setter call (step 2100). The process then identifies the object (step 2102. The object is identified in the call. Further, this object actually may be a group or set of objects. A determination is made as to whether a versioning ID is present in a call (step 2104). The presence of a version ID is considered an additional argument or parameter used to initiate the versioning feature of this call.
If a version ID in the call is present, a marking application programming interface is called (step 2106). Step 2106 is employed to mark the object for tracking. This process is described in more detail in
Turning back to step 2104, if a version ID is not present in the call, the process proceeds directly to step 2108 as described above. In step 2110, if additional unprocessed objects are present, the process returns to step 2102.
It is important to note that while the present invention has been described in the context of a fully functioning data processing system, those of ordinary skill in the art will appreciate that the processes of the present invention are capable of being distributed in the form of a computer readable medium of instructions and a variety of forms and that the present invention applies equally regardless of the particular type of signal bearing media actually used to carry out the distribution. Examples of computer readable media include recordable-type media such a floppy disc, a hard disk drive, a RAM, and CD-ROMs and transmission-type media such as digital and analog communications links.
The description of the present invention has been presented for purposes of illustration and description, but is not intended to be exhaustive or limited to the invention in the form disclosed. Many modifications and variations will be apparent to those of ordinary skill in the art. The embodiment was chosen and described in order to best explain the principles of the invention, the practical application, and to enable others of ordinary skill in the art to understand the invention for various embodiments with various modifications as are suited to the particular use contemplated.
The present invention is related to the following patent applications: entitled “Method and Apparatus for Dimensional Data Versioning and Recovery Management”, Ser. No. ______, attorney docket no. AUS920040309US1; entitled “Method and Apparatus for Data Versioning and Recovery Using Delta Content Save and Restore Management”, Ser. No. ______, attorney docket no. AUS920040638US1; entitled “Platform Infrastructure to Provide an Operating System Based Application Programming Interface Undo Service”, Ser. No. _____, attorney docket no. AUS920040639US1; entitled “Virtual Memory Management Infrastructure for Monitoring Deltas and Supporting Undo Versioning in a Paged Memory System”, Ser. No. ______, attorney docket no. AUS920040640US1; entitled “Infrastructure for Device Driver to Monitor and Trigger Versioning for Resources”, Ser. No. ______, attorney docket no. AUS920040641US1; entitled “Method and Apparatus for Managing Versioning Data in a Network Data Processing System”, Ser. No. AUS920040642US1, attorney docket no. ______; entitled “Heap Manager and Application Programming Interface Support for Managing Versions of Objects”, Ser. No. ______, attorney docket no. AUS920040643US1; and entitled “Method and Apparatus for Marking Code for Data Versioning”, Ser. No. ______, attorney docket no. AUS920040644US1 filed even date hereof, assigned to the same assignee, and incorporated herein by reference.