If I carry out a cache refresh by using /lib/resource/RefreshResourceCache, is there a way to find the cache refresh status?

If I carry out a cache refresh by using /lib/resource/RefreshResourceCache, is there a way to find the cache refresh status?

book

Article ID: KB0080193

calendar_today

Updated On:

Products Versions
TIBCO Data Virtualization v7.0.0 and higher

Description

When /lib/resource/RefreshResourceCache() is executed to carry out a cache refresh, is there any way to find the status of the cache refresh?

Issue/Introduction

If I carry out a cache refresh by using /lib/resource/RefreshResourceCache, is there a way to find the cache refresh status?

Resolution

Below are three methods to check the cache refresh status. Method #1 is recommended as it gives you a very high degree of control (you can write your own message to a log, send an email to an administrator, or INSERT information regarding the status into your own table).

Method # 1: Write a Procedure

Write a TDV procedure to carry out the cache refresh. You can either run the procedure in Studio, or else publish it and run it in a third-party client application (e.g DBVisualizer).

An example procedure is below:

PROCEDURE pCacheRefresh()
BEGIN
call /lib/resource/RefreshResourceCache('/shared/examples/aaa_ds_orders/tutorial/orders','TABLE');
EXCEPTION
   ELSE IF (LENGTH(CURRENT_EXCEPTION.MESSAGE) > 1 )
THEN
      CALL LOG ('MyCacheStatus :  ' || CURRENT_EXCEPTION.MESSAGE) ;
END IF;
END
 
If the cache refresh fails,  TDV will return an exception.The procedure can trap the exception and proceed to take an appropriate action. 

Examples of actions are:
- Send an email to the administrator to inform the administrator that a cache refresh failed.
- Retry the cache refresh.
- Write an entry to the cs_server.log (as shown in the above example procedure).
- INSERT a message into a table of your choice, to maintain a record of cache refreshes.

Method #2: Look for cache refresh entries in the Events log

The cs_server_events.log will contain an entry  to indicate that the request started, followed by a second entry  (later in the log) to indicate whether the request completed successfully or failed.

To illustrate, below are example log entries for a successful cache refresh:

cs_server_events.log:2018-11-01 09:41:47.809 -0700      INFO    START   cache refresh=/shared/examples/aaa_ds_orders/tutorial/orders started, params=    3       admin   composite       20303   6164362031245   6164362031245   /shared/examples/aaa_ds_orders/tutorial/orders   N/A

cs_server_events.log:2018-11-01 09:41:47.876 -0700      INFO    END     cache refresh=/shared/examples/aaa_ds_orders/tutorial/orders end, params=        3       admin   composite       20304   6164362031505   6164362031245   /shared/examples/aaa_ds_orders/tutorial/orders   N/A

Below are example log entries for a failed cache refresh:

cs_server_events.log:2018-11-01 09:26:57.477 -0700      INFO    START   request id=4309560 started      1       admin   composite        20100   6164358469909   6164358469909   4309560 CALL /lib/resource/RefreshResourceCache N/A     4336279 4400096  aprabhu-P51.na.tibco.com        WEB_API admin   composite       false

cs_server_events.log:2018-11-01 09:26:57.478 -0700      ERROR   FAIL    request id=4309560 failed. exception=Cannot refresh cache because caching is disabled for resource "/shared/examples/aaa_ds_orders/tutorial/orders".     1       admin   composite        20103   6164358469913   6164358469909   4309560 Cannot refresh cache because caching is disabled for resource "/shared/examples/aaa_ds_orders/tutorial/orders".  4336279 4400096 aprabhu-P51.na.tibco.com    WEB_API     admin   composite        false   0       0       0       N/A     N/A

Method 3: Query the "/services/databases/system/SYS_CACHES" table

IMPORTANT: This approach has a limitation in that the SYS_CACHES only stores the results of the most recent cache refresh.
You can retrieve the status of the most recent cache refresh  by querying the systems table /services/databases/system/SYS_CACHES in Studio . Alternatively,  publish the systems table and run the query from an external client application (e.g. DBVisualizer).

If the last cache refresh was successful: 
The STATUS column will contain UP. 

If the last cache refresh was not successful: 
The STATUS column will contain a value other than UP (i.e. DOWN, DISABLED, “CONFIG ERROR, NOT LOADED).