113677 [Thread-16] ERROR org.apache.solr.handler.dataimport.JdbcDataSource – I
gnoring Error when closing connection
com.mysql.jdbc.PacketTooBigException: Packet for query is too large (11634919 >
4194304). You can change this value on the server by setting the max_allowed_pac
ket' variable.
at com.mysql.jdbc.MysqlIO.readPacket(MysqlIO.java:569)
at com.mysql.jdbc.MysqlIO.getResultSet(MysqlIO.java:414)
at com.mysql.jdbc.MysqlIO.readResultsForQueryOrUpdate(MysqlIO.java:2997)
at com.mysql.jdbc.MysqlIO.readAllResults(MysqlIO.java:2245)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2638)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2526)
at com.mysql.jdbc.ConnectionImpl.rollbackNoChecks(ConnectionImpl.java:47
02)
at com.mysql.jdbc.ConnectionImpl.rollback(ConnectionImpl.java:4594)
at com.mysql.jdbc.ConnectionImpl.realClose(ConnectionImpl.java:4235)
at com.mysql.jdbc.ConnectionImpl.close(ConnectionImpl.java:1510)
at org.apache.solr.handler.dataimport.JdbcDataSource.closeConnection(Jdb
cDataSource.java:446)
at org.apache.solr.handler.dataimport.JdbcDataSource.close(JdbcDataSourc
e.java:431)
at org.apache.solr.handler.dataimport.DocBuilder.closeEntityProcessorWra
ppers(DocBuilder.java:289)
at org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java
:278)
at org.apache.solr.handler.dataimport.DataImporter.doFullImport(DataImpo
rter.java:416)
at org.apache.solr.handler.dataimport.DataImporter.runCmd(DataImporter.j
ava:480)
at org.apache.solr.handler.dataimport.DataImporter$1.run(DataImporter.ja
va:461)
Exception in thread "Thread-16" java.lang.OutOfMemoryError: Java heap space
at com.mysql.jdbc.MysqlIO.nextRowFast(MysqlIO.java:2114)
at com.mysql.jdbc.MysqlIO.nextRow(MysqlIO.java:1921)
at com.mysql.jdbc.MysqlIO.readSingleRowSet(MysqlIO.java:3278)
at com.mysql.jdbc.MysqlIO.getResultSet(MysqlIO.java:462)
at com.mysql.jdbc.MysqlIO.readResultsForQueryOrUpdate(MysqlIO.java:2997)
at com.mysql.jdbc.MysqlIO.readAllResults(MysqlIO.java:2245)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2638)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2526)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2484)
at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:848)
at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:742)
at org.apache.solr.handler.dataimport.JdbcDataSource$ResultSetIterator.<
init>(JdbcDataSource.java:276)
at org.apache.solr.handler.dataimport.JdbcDataSource.getData(JdbcDataSou
rce.java:240)
at org.apache.solr.handler.dataimport.JdbcDataSource.getData(JdbcDataSou
rce.java:44)
at org.apache.solr.handler.dataimport.SqlEntityProcessor.initQuery(SqlEn
tityProcessor.java:59)
at org.apache.solr.handler.dataimport.SqlEntityProcessor.nextRow(SqlEnti
tyProcessor.java:73)
at org.apache.solr.handler.dataimport.EntityProcessorWrapper.nextRow(Ent
ityProcessorWrapper.java:243)
at org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilde
r.java:476)
at org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilde
r.java:415)
at org.apache.solr.handler.dataimport.DocBuilder.doFullDump(DocBuilder.j
ava:330)
at org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java
:232)
at org.apache.solr.handler.dataimport.DataImporter.doFullImport(DataImpo
rter.java:416)
at org.apache.solr.handler.dataimport.DataImporter.runCmd(DataImporter.j
ava:480)
at org.apache.solr.handler.dataimport.DataImporter$1.run(DataImporter.ja
va:461)
此原因可能是mysql默认加载的数据文件不超过1M,mysql加载的数据量太大 导致的 可以加个limit
或者改变系统参数
MySQL的一个系统参数:max_allowed_packet,其默认值为1048576(1M),
可以先查询一下:show VARIABLES like '%max_allowed_packet%';
修改此变量的值:MySQL安装目录下的my.ini文件中的[mysqld]段中的"max_allowed_packet = 1M",如更改为4M(如果没有这行内容,增加一行),保存,重新启动MySQL服务。现在可以load大于1M的文件了。