Executes (replays) the specified transactions.
By default, EssReplayTransactions replays everything since the last restored backup time or last replayed request time—whichever is the latest.
It will not replay requests made after the restore, because the recommended way to use restore command is to replay transactions and then open up for new transactions.
You can use the pSeqIds option to force replays.
Syntax
ESS_FUNC_M EssReplayTransactions(hCtx, AppName, DbName, ReplayDat, pSeqIds);
Parameter | Data Type | Description |
---|---|---|
hCtx | ESS_HCTX_T | Login context |
AppName | ESS_STR_T | Application Name |
DbName | ESS_STR_T | Database Name |
ReplayDat | ESS_TRANSACTION_REPLAY_INP_T | Replay input parameters |
pSeqIds | ESS_PSEQID_T | Array of sequence ID ranges if input type is sequence ID |
Return Value
0—If successful
pSeqIds contains a range of sequence IDs
Error number—If unsuccessful
Access
The caller must have Essbase Administrator access to the database.
Example
void ListAndReplayTransactions() { ESS_FUNC_M sts = ESS_STS_NOERR; ESS_USHORT_T TimeSrc; ESS_TIME32_T timestamp = 0; ESS_USHORT_T listOption; ESS_STR_T FileName = ESS_NULL; ESS_ULONG_T Count = 0; ESS_PTRANSACTION_ENTRY_T pResults; ESS_CHAR_T listTime[ESS_TIMESIZE]; ESS_TRANSACTION_REPLAY_INP_T ReplayDat; ESS_PSEQID_T pSeqIds = ESS_NULL; ESS_OBJDEF_T Data; ESS_STR_T Script; ESS_SHORT_T isAbortOnError; ESS_PMBRERR_T pMbrErr = NULL; ESS_PROCSTATE_T pState; /* Load data from server */ Data.hCtx = hCtx; Data.AppName = AppName; Data.DbName = DbName; Data.ObjType = ESS_OBJTYPE_TEXT; Data.FileName = "Calcdat"; isAbortOnError = ESS_TRUE; sts = EssImport (hCtx, ESS_NULL, &Data, &pMbrErr, NULL, isAbortOnError); printf("EssImport sts: %ld\r\n",sts); /* List and replay with a specified time */ TimeSrc = 1; strcpy(listTime, "09/18/2007:00:00:00"); /* mm/dd/yyyy:hh:mm:ss */ timestamp = adtGenericGetTime(listTime); listOption = ESS_LIST_TRANSACTIONS_TOCLIENT; sts = EssListTransactions(hCtx, TimeSrc, timestamp, listOption, FileName, &Count, &pResults); /* This function converts listTime to the number of seconds since January 1, 1970. */ printf("EssListTransactions sts: %ld\r\n",sts); if (Count && pResults) PrintTransactionLog(Count, pResults); memset(&ReplayDat, 0, sizeof (ESS_TRANSACTION_REPLAY_INP_T)); ReplayDat.InpType = ESS_REPLAY_BASED_GIVENTIME; ReplayDat.value.InpTime = timestamp; sts = EssReplayTransactions (hCtx, AppName, DbName, ReplayDat, pSeqIds); printf("EssReplayTransactions sts: %ld\r\n",sts); printf("\n\n"); /* Run a calc*/ Script = "CALC ALL;"; sts = EssCalc(hCtx, ESS_TRUE, Script); printf("EssCalc sts: %ld\r\n",sts); if (!sts) { sts = EssGetProcessState (hCtx, &pState); while (!sts && (pState.State != ESS_STATE_DONE)) sts = EssGetProcessState (hCtx, &pState); } /* List and replay with last replay time */ TimeSrc = 2; timestamp = 0; sts = EssListTransactions(hCtx, TimeSrc, timestamp, listOption, FileName, &Count, &pResults); /* This function converts listTime to the number of seconds since January 1, 1970. */ printf("EssListTransactions sts: %ld\r\n",sts); if (Count && pResults) PrintTransactionLog(Count, pResults); memset(&ReplayDat, 0, sizeof (ESS_TRANSACTION_REPLAY_INP_T)); ReplayDat.InpType = ESS_REPLAY_BASED_LASTREPLAYTIME; sts = EssReplayTransactions (hCtx, AppName, DbName, ReplayDat, pSeqIds); printf("EssReplayTransactions sts: %ld\r\n",sts); if(pSeqIds) EssFree(hInst, pSeqIds); if(pResults) EssFree(hInst, pResults); if(pMbrErr) EssFree(hInst, pMbrErr); }
When you replay using the sequence id array, specify a range of sequence ids.
Enter the range count in num_seq_id_range.
Follow num_seq_id_range with an array of ESS_SEQID_T, and the type data structure and the number of elements in the array should be num_seq_id_range.
The seq_id_upper_start and seq_id_upper_end fields are reserved, and should be filled with zeros.
The seq_id_start and seq_id_end fields should be filled in with start and end values of the range.
If you only have one sequence id, specify that id as the start and end value.
Example 1: To replay the ranges 1-5, 8-10 and 12-16 while skipping 6,7, and 11:
num_seq_id_range = 3 seqid_array[0].seq_id_start = 1 seqid_array[0].seq_id_end = 5 seqid_array[0].seq_id_start_upper = 0 seqid_array[0].seq_id_end_upper = 0 seqid_array[1].seq_id_start = 8 seqid_array[1].seq_id_end = 10 seqid_array[1].seq_id_start_upper = 0 seqid_array[1].seq_id_end_upper = 0 seqid_array[2].seq_id_start = 12 seqid_array[2].seq_id_end = 16 seqid_array[2].seq_id_start_upper = 0 seqid_array[2].seq_id_end_upper = 0
Example 2: To replay one range 3-7, num_seq_id_range = 1:
seqid_array[0].seq_id_start = 3 seqid_array[0].seq_id_end = 7 seqid_array[0].seq_id_start_upper = 0 seqid_array[0].seq_id_end_upper = 0
Example 3: To replay only transaction id 5:
num_seq_id_range = 1 seqid_array[0].seq_id_start = 5 seqid_array[0].seq_id_end = 5 seqid_array[0].seq_id_start_upper = 0 seqid_array[0].seq_id_end_upper = 0
See Also