SOLR: Indexing failed. Rolled back all changes.

2019-04-11 15:01发布

问题:

i have the following in dataconfig_1.xml

<?xml version="1.0" encoding="UTF-8"?>
<dataConfig>
  <dataSource batchSize="-1" convertType="true" driver="com.mysql.jdbc.Driver" password="solrpw" url="jdbc:mysql://127.0.0.1/solrDB" user="solruser"/>
  <document name="items">
    <entity name="root" pk="id" preImportDeleteQuery="data_source:1" query="select a.id, a.body, a.headline  title ,a.date  datecreated, a.title_id ,t.name  publisher_name from article as a inner join title as t on t.id=a.title_id" transformer="TemplateTransformer" deltaImportQuery="select a.id, a.body, a.headline  title ,a.date  datecreated, a.title_id ,t.name  publisher_name from article as a inner join title as t on t.id=a.title_id where last_update_time > '${dataimporter.last_index_time}'" deltaQuery="select id from article where last_update_time > '${dataimporter.last_index_time}'">
      <field column="data_source" template="1"/>
      <field column="data_source_type" template="Jdbc"/>
      <field column="data_source_name" template="syndigate_solr"/>
    </entity>
  </document>
</dataConfig>

and in dataimport_1.properties i have

#Tue Aug 02 06:53:21 UTC 2011
last_index_time=2011-08-02 06\:52\:51
root.last_index_time=2011-08-02 06\:52\:51

now whenever i run deltaimport

http://myip:8888/solr/collection1/dataimport_1?command=delta-import

i got the following response

<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">8</int>
</lst>
<lst name="initArgs">
<lst name="defaults">
<str name="config">dataconfig_1.xml</str>
</lst>
</lst>
<str name="command">delta-import</str>
<str name="status">idle</str>
<str name="importResponse"/>
<lst name="statusMessages">
<str name="Time Elapsed">0:0:1.552</str>
<str name="Total Requests made to DataSource">2</str>
<str name="Total Rows Fetched">18954</str>
<str name="Total Documents Processed">0</str>
<str name="Total Documents Skipped">0</str>
<str name="Delta Dump started">2011-08-02 09:35:52</str>
<str name="Identifying Delta">2011-08-02 09:35:52</str>
<str name="Deltas Obtained">2011-08-02 09:35:52</str>
<str name="Building documents">2011-08-02 09:35:52</str>
<str name="Total Changed Documents">18954</str>
<str name="">Indexing failed. Rolled back all changes.</str>
<str name="Rolledback">2011-08-02 09:35:52</str>
</lst>
<str name="WARNING">
This response format is experimental. It is likely to change in the future.
</str>
</response>

any idea of what i am doing wrong?? Thanks for your help

回答1:

The way I go about debugging jdbc import errors is to use the log4jdbc library. I'd create a new data source like so in the data-config.xml

<dataSource name="logMe" driver="net.sf.log4jdbc.DriverSpy" user="myUserName" password="myPassword" type="JdbcDataSource" url="jdbc:log4jdbc:mysql://myServer:3306/myDB" />

And set all the entities to use this new datasource.

Then I'd run the import. Afterwards, I'd look inside the log file called sql.log. At the bottom of the file, it'd usually tell me where jdbc stopped and at what error.



回答2:

Also, if you're running the jetty server from the command line, its logging will appear in the console. Look for anything marked SEVERE or ERROR and then read down to the "caused by" line.



标签: solr