Showing posts with label Solr Preprocess Command failed to run. Show all posts
Showing posts with label Solr Preprocess Command failed to run. Show all posts

WebSphere Commerce 7 | Solr | Preprocess Command failed to run | Queries to find the Data Issues

You might have noticed Solr Preprocess might have failed because of the Data issues in the Master Catalog.

Here are the few queries to check the Data Issues in the Master Catalog and making the Solr Preprocess to fail,

Query 1:  Same Products/SKUs has been assigned to Multiple Catalog Groups in the Master Catalog,
select catentry_id, (select partnumber from catentry where catentry_id = c.catentry_id) partnumber,
        catgroup_id, (select identifier from catgroup where catgroup_id = c.catgroup_id) catgroup_identifier
from catgpenrel c
where catentry_id in
        (select catentry_id
        from catgpenrel
        where catalog_id = 10001
        group by catentry_id
        having count(catentry_id) > 1
        )


Query 2:  One Category is assigned with multiple Categories in the Master Catalog

select catentry_id, catgroup_id
from catgpenrel
where catentry_id in
    (select catentry_id from catgpenrel where catalog_id = 10001
        group by catentry_id having count(catentry_id) > 1
    )


Query 3:  One SKU assigned to multiple Parent Products in the Master Catalog
select child_catentry_id, count(catentry_id_parent) parents_count from (
select c1.partnumber as parent_partnumber, c1.catentry_id as catentry_id_parent,
c2.partnumber as child_partnumber, c2.catentry_id as child_catentry_id, cgr.catalog_id
from catentry c1, catentry c2, catentrel cr, catgpenrel cgr
where c1.catentry_id = cr.catentry_id_parent
and c2.catentry_id = cr.catentry_id_child
and cgr.catentry_id = c1.catentry_id
and cgr.catalog_id = 10001
and c1.markfordelete = 0
and c1.buyable = 1)
group by child_catentry_id
having count(catentry_id_parent) > 1


Query 4:  SKU (Item) assigned as Child to one Parent Product and also marked as Parent to another Child
select catentry_id, partnumber, c2.catentry_id_child as markedasparent
from catentry c1, catentrel c2
where c1.catentry_id = c2.catentry_id_parent
and catenttype_id = 'ItemBean'


Query 5:  Product assigned as Child to another Product
select catentry_id, partnumber, c2.catentry_id_parent as markedaschild
from catentry c1, catentrel c2
where c1.catentry_id = c2.catentry_id_child
and catenttype_id = 'ProductBean'

WebSphere Commerce 7 | Solr | Preprocess Command failed to run | ERRORCODE=-4229, SQLSTATE=null | SQLCODE=-803, SQLSTATE=23505 | TI_APGROUP_0

Sometimes, we might face issue of Solr Preprocess failed with the following exceptions and it is because of Data issue in Categories and Catalog entries,
com.ibm.commerce.foundation.dataimport.preprocess.CatalogHierarchyDataPreProcessor determineCatalogEntriesForCatalog(Connection connection, String catalogID)
INFO: The catalog with ID: 10001 contains 18769 catalog entries.
com.ibm.db2.jcc.am.BatchUpdateException: [jcc][t4][102][10040][4.19.49] Batch failure.  The batch was submitted, but at least one exception occurred on an individual member of the batch.
Use getNextException() to retrieve the exceptions for specific batched elements. ERRORCODE=-4229, SQLSTATE=null
        at com.ibm.db2.jcc.am.kd.a(Unknown Source)
        at com.ibm.db2.jcc.am.Agent.endBatchedReadChain(Unknown Source)
        at com.ibm.db2.jcc.am.gp.a(Unknown Source)
        at com.ibm.db2.jcc.am.gp.c(Unknown Source)
        at com.ibm.db2.jcc.am.gp.executeBatch(Unknown Source)
        at com.ibm.commerce.foundation.dataimport.preprocess.CatalogHierarchyDataPreProcessor.populateTable(CatalogHierarchyDataPreProcessor.java:1271)
        at com.ibm.commerce.foundation.dataimport.preprocess.CatalogHierarchyDataPreProcessor.process(CatalogHierarchyDataPreProcessor.java:676)
        at com.ibm.commerce.foundation.dataimport.preprocess.CatalogHierarchyDataPreProcessor.process(CatalogHierarchyDataPreProcessor.java:448)
        at com.ibm.commerce.foundation.dataimport.preprocess.DataImportPreProcessorMain.processDataConfig(DataImportPreProcessorMain.java:1072)
        at com.ibm.commerce.foundation.dataimport.preprocess.DataImportPreProcessorMain.execute(DataImportPreProcessorMain.java:942)
        at com.ibm.commerce.foundation.dataimport.preprocess.DataImportPreProcessorMain.main(DataImportPreProcessorMain.java:385)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
        at java.lang.reflect.Method.invoke(Method.java:611)
        at com.ibm.ws.bootstrap.WSLauncher.main(WSLauncher.java:267)
Aug 9, 2016 2:21:04 PM com.ibm.commerce.foundation.dataimport.preprocess.DataImportPreProcessorMain processDataConfig(DataProcessingConfig, String)
INFO: Error for batch element #172: DB2 SQL Error: SQLCODE=-803, SQLSTATE=23505, SQLERRMC=1;WCSDB.TI_APGROUP_0, DRIVER=4.19.49
Aug 9, 2016 2:21:04 PM com.ibm.commerce.foundation.dataimport.preprocess.DataImportPreProcessorMain processDataConfig(DataProcessingConfig, String)
INFO: SQL:
Aug 9, 2016 2:21:04 PM com.ibm.commerce.foundation.dataimport.preprocess.DataImportPreProcessorMain logExitCode
INFO:
The program exiting with exit code: 1.
Data import pre-processing was unsuccessful. An unrecoverable error has occurred.


This issue might have happend because one Category is mapped with multiple Categories or One Product might be mapped with multiple Categories. Here are the queries to find these entries,

select catentry_id, catgroup_id from catgpenrel where catentry_id in (select catentry_id from catgpenrel where catalog_id = 10001 group by catentry_id having count(catentry_id) > 1)

select catgroup_id_parent, catgroup_id_child from catgrprel where catalog_id = 10001 and catgroup_id_child in (select catgroup_id_child from catgrprel where catalog_id = <catalogId> group by catgroup_id_child having count(catgroup_id_child) > 1)

Once these Catalog entries and groups issue has been fixed, re run Preprocesss command and it should work fine.

My Writings........

Salesforce | Administration | Email-to-Case | Create Cases using Email-to-Case

Email to Case Setup ·        Click on Email-to-Case ·         Enable the following flags, ·        Provide the Routing Addres...