Prefetching objects

To use the prefetch feature, you call the DKLobICM and DKDatastoreICM APIs within your application.

When calling the APIs, you specify that you want a particular item, or in the case of batch operations, a collection of items, to be pre-fetched. The APIs send a request to the resource manager to prefetch the object from the collection it resides in and place it in the collection that you specified as the prefetch collection at define time. The following figure depicts the flow of a prefetch transaction:

Figure 1. Prefetching objects
Prefetch process flow in transaction

Prefetching from the resource manager is an asynchronous transaction. Therefore, the successful completion of a prefetch transaction consists of the two parts described as follows:

  1. The application calls the resource manager by using a prefetch order. The prefetch order is then processed by the resource manager, inserting an entry into the ICMRMPREFETCH table. If this table insert is successful, a 0 return code is sent back to the calling application. At this stage, the object exists only in its original location or source collection. The table update process is as follows:
    1. An entry is inserted into the ICMRMPREFETCH table.
    2. REQUESTTIMESTAMP and STATETIMESTAMP are set to the current timestamp.
    3. The PREFETCHSTATE is set to INITIATED.
  2. The actual processing, which is copying an object from the source to the prefetch collection, is done by the ICMMOSAP asynchronous process. This process performs a select on the ICMRMCONTROL table for PREFETCHENABLED. If this value is set to 1, ICMMOSAP processes the entries in the ICMRMPREFETCH table if any exist. This process is as follows:
    1. PREFETCHSTATE is updated to WORKING and STATETIMESTAMP is updated with the current timestamp.
    2. An OAM_Query is performed to see if the object exists within OAM by searching on its extobjname and source collection name.
    3. If the object exists within OAM, an OAM_Retrieve operation is performed.
    4. Once retrieved, an OAM_Store, for the existing extobjname, within OAM at the prefetch collection name, is performed.
    5. If the OAM_Store is successful, PREFETCHSTATE is updated to COMPLETE and STATETIMESTAMP is updated with the current timestamp.
    6. If a failure occurs, OAMRETURNCODE and OAMREASONCODE are updated with error codes from OAM, and PREFETCHSTATE is updated to FAILED.
Support for the prefetch methods is limited to Java™ only. The following methods are the methods you work with to prefetch an object:
  • DKDatastoreICM public dkCollection prefetchObjects(dkCollection prefetchColl,DKNVPair[] nvPairs) throws DKException,Exception
  • DKLobICM public boolean prefetchContent(DKNVPair[] nvPairs) throws DKException, java.lang.Exception public boolean prefetchContent(DKNVPair[] nvPairs) throws DKException, java.lang.Exception
For more specific information about these methods, see the Application Programming Reference.