Open jbbehar opened 6 years ago
we need this utility and instructions how to run ASAP as well
We ran the tokenization utility today for a customer, and it failed.
The error message is super long, but the bottom line of the error message is:
2018-01-30T14:21:18.97789 ERROR STP SmartThreadPool Thread #97 ServiceStackHost ServiceBase1 wrapCloseInAction) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData() at System.Data.SqlClient.SqlDataReader.get_MetaData() at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource
1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
at ServiceStack.OrmLite.OrmLiteResultsFilterExtensions.ExprConvertToList[T](IDbCommand dbCmd, String sql, IEnumerable1 sqlParams, HashSet
1 onlyFields)
at ServiceStack.OrmLite.ReadExpressionCommandExtensions.Select[T](IDbCommand dbCmd, Expression1 predicate) at ServiceStack.OrmLite.OrmLiteExecFilter.Exec[T](IDbConnection dbConn, Func
2 filter)
at NCR.CP.CPAPI.Base.Repositories.CustomerRepository.NCR.CP.CPAPI.Base.Repositories.ICustomerRepository.GetCustomersByStore(String storeId)
at NCR.CP.CPAPI.Base.Business.StoreBusiness.TokenizeStore(String storeId, Boolean statusOnly)
at NCR.CP.CPAPI.Base.Business.StoreBusiness.<>cDisplayClass6.1.ForEach(Action
1 action)
at NCR.CP.CPAPI.Base.Business.StoreBusiness.GetStoresTokenizedInfo()
at CPAPI.Services.StoresTokenizedService.Get(StoresTokenizedRequest request)
at ServiceStack.Host.ServiceRunner`1.Execute(IRequest request, Object instance, TRequest requestDto)
ClientConnectionId:4a320a56-7d2f-44e8-8450-d1b8844d5bdd
Error Number:8003,State:1,Class:16
I had originally posted this as a separate issue, but as it appears to be a duplicate of this one, I'll post the additional info that I found digging in the CP API log files:
Browsing through the log file, there are two queries that run before the error above is returned that are the cause of this issue. The first one is:
SELECT "CUST_NO", "NAM", "NAM_UPR", "FST_NAM", "FST_NAM_UPR", "LST_NAM", "LST_NAM_UPR", "SALUTATION", "CUST_TYP", "ADRS_1", "ADRS_2", "ADRS_3", "CITY", "STATE", "ZIP_COD", "CNTRY", "PHONE_1", "PHONE_2", "FAX_1", "FAX_2", "CONTCT_1", "CONTCT_2", "EMAIL_ADRS_1", "EMAIL_ADRS_2", "URL_1", "URL_2", "PROMPT_NAM_ADRS", "SLS_REP", "CATEG_COD", "SHIP_VIA_COD", "SHIP_ZONE_COD", "STR_ID", "STMNT_COD", "TAX_COD", "TERMS_COD", "COMMNT", "TAX_EXEMPT_NO", "TAX_EXEMPT_DAT", "ALLOW_AR_CHRG", "ALLOW_TKTS", "NO_CR_LIM", "CR_LIM", "CR_RATE", "NO_MAX_CHK_AMT", "MAX_CHK_AMT", "UNPSTD_BAL", "BAL_METH", "AR_ACCT_NO", "BAL", "ORD_BAL", "NO_OF_ORDS", "USE_ORD_SHIP_TO", "ALLOW_ORDS", "LST_AGE_DAT", "LST_AGE_BAL", "LST_AGE_BAL_1", "LST_AGE_BAL_2", "LST_AGE_BAL_3", "LST_AGE_BAL_4", "LST_AGE_BAL_5", "LST_AGE_BAL_2_5", "LST_AGE_BAL_3_5", "LST_AGE_BAL_4_5", "LST_AGE_BAL_OPN", "LST_AGE_FUTR_DOCS", "LST_AGE_METH", "LST_AGE_AS_OF_DAT", "LST_AGE_CUTOFF_DAT", "LST_AGE_MAX_PRD_1", "LST_AGE_MAX_PRD_2", "LST_AGE_MAX_PRD_3", "LST_AGE_MAX_PRD_4", "LST_AGE_NO_OF_PRDS", "LST_AGE_EVENT_NO", "LST_AGE_NO_CUTOFF", "LST_AGE_PAST_CUTOFF", "LST_AGE_NON_STD", "LST_STMNT_DAT", "LST_STMNT_BAL", "LST_STMNT_BAL_1", "LST_STMNT_BAL_2", "LST_STMNT_BAL_3", "LST_STMNT_BAL_4", "LST_STMNT_BAL_5", "LST_STMNT_BAL_2_5", "LST_STMNT_BAL_3_5", "LST_STMNT_BAL_4_5", "LST_STMNT_BAL_OPN", "LST_STMNT_METH", "LST_STMNT_BEG_DAT", "LST_STMNT_END_DAT", "LST_STMNT_MAX_PRD_1", "LST_STMNT_MAX_PRD_2", "LST_STMNT_MAX_PRD_3", "LST_STMNT_MAX_PRD_4", "LST_STMNT_NO_OF_PRDS", "LST_STMNT_PAST_CTOFF", "FST_SAL_DAT", "LST_SAL_DAT", "LST_SAL_AMT", "LST_PMT_DAT", "LST_PMT_AMT", "PROF_ALPHA_1", "PROF_ALPHA_2", "PROF_ALPHA_3", "PROF_ALPHA_4", "PROF_ALPHA_5", "PROF_COD_1", "PROF_COD_2", "PROF_COD_3", "PROF_COD_4", "PROF_COD_5", "PROF_DAT_1", "PROF_DAT_2", "PROF_DAT_3", "PROF_DAT_4", "PROF_DAT_5", "PROF_NO_1", "PROF_NO_2", "PROF_NO_3", "PROF_NO_4", "PROF_NO_5", "LST_MAINT_DT", "LST_MAINT_USR_ID", "LST_LCK_DT", "WRK_STMNT_ACTIV", "LWY_BAL", "NO_OF_LWYS", "USE_LWY_SHIP_TO", "ALLOW_LWYS", "IS_ECOMM_CUST", "ECOMM_CUST_NO", "ECOMM_AFFIL_COD", "DISC_PCT", "ECOMM_INIT_PWD", "ECOMM_NXT_PUB_UPDT", "ECOMM_NXT_PUB_FULL", "ECOMM_LST_PUB_DT", "ECOMM_LST_PUB_TYP", "ECOMM_LST_IMP_DT", "ECOMM_CREATED_CUST", "ECOMM_LST_ORD_NO", "ECOMM_LST_ORD_DT", "ECOMM_LST_IMP_TYP", "ECOMM_LST_IMP_EVENT_NO", "PROMPT_FOR_CUSTOM_FLDS", "LOY_PGM_COD", "LOY_PTS_BAL", "TOT_LOY_PTS_EARND", "TOT_LOY_PTS_RDM", "TOT_LOY_PTS_ADJ", "LST_LOY_EARN_TKT_DAT", "LST_LOY_EARN_TKT_TIM", "LST_LOY_PTS_EARN", "LST_LOY_EARN_TKT_NO", "LST_LOY_RDM_TKT_DAT", "LST_LOY_RDM_TKT_TIM", "LST_LOY_PTS_RDM", "LST_LOY_RDM_TKT_NO", "LST_LOY_ADJ_DAT", "LST_LOY_PTS_ADJ", "LST_LOY_ADJ_DOC_NO", "LOY_CARD_NO", "FCH_COD", "LST_FCH_DAT", "LST_FCH_AMT", "LST_FCH_PAST_DUE_AMT", "LST_FCH_DOC_NO", "REQ_PO_NO", "RS_UTC_DT", "CUST_NAM_TYP", "CUST_FST_LST_NAM", "LST_LOY_EARN_TKT_DT", "LST_LOY_RDM_TKT_DT", "PS_HDR_CUST_FLD_FRM_ID", "EMAIL_STATEMENT", "RS_STAT", "INCLUDE_IN_MARKETING_MAILOUTS", "MARKETING_MAILOUT_OPT_IN_DAT", "RPT_EMAIL", "MBL_PHONE_1", "MBL_PHONE_2"
FROM "AR_CUST"
WHERE ("STR_ID" = @0)
PARAMS: @0=1
And the second one is:
SELECT "CUST_NO", "CARD_SEQ_NO", "DEFAULT_CARD", "CARD_DESCR", "PAY_COD", "CARD_NO", "CARD_NO_MSK", "CARD_EXP_DAT", "CARD_NAM", "CARD_NO_ENC", "CARD_NO_KID"
FROM "AR_CUST_CARDS"
WHERE "CUST_NO" In (@0,@1,@2,@3,@4,@5,@6,@7,@8,@9,@10,@11,@12 .. @64578)
--For the sake of brevity, the above query is much longer, listing each parameter sequentially from 0 to 64578.--
What's happening here is that the Tokenization Utility first runs a SELECT statement on AR_CUST in order to enumerate the amount of records in this table and generates the total number of parameters that will be passed to the second query. This means that if a Counterpoint database has more than 2,100 customer records, the Tokenization Utility will fail, regardless of the number of credit card records in AR_CUST_CARDS.
A possible solution to this issue is to limit the SELECT query of AR_CUST above from generating more than 2,100 parameters and then having the utility perform multiple passes, with each subsequent pass starting from the 2,101st record (so the first pass would be 0 - 2100, second pass would be 2101 - 4200, and so on).
Per https://counterpoint.knowledgebase.co/article-674.html Request CP-2991 Please provide the utility required to re-tokenize existing cards on file ASAP Thank you!