我索引了许多用 data-config.xml 中的实体编写的表。但是在索引一个表之后,即使我设置了'holdability="CLOSE_CURSORS_AT_COMMIT"',数据库连接仍然存在。
索引表后如何删除连接?
<dataConfig>
<dataSource type="JdbcDataSource"
driver="com.mysql.jdbc.Driver"
url="jdbc:mysql://hostname/dbname"
batchSize="2000"
user="id"
password="passwd"
readOnly="true"
transactionIsolation="TRANSACTION_READ_COMMITTED"
holdability="CLOSE_CURSORS_AT_COMMIT"
connectionTimeout="10000" readTimeout="240000" />
<document name="doc">
<entity name="testTbl_0"
transformer="RegexTransformer"
onError="continue"
query="SELECT Title, url, DocID, substring_index(body,' ',2048) \
description FROM testTbl_0 WHERE status in ('1','s') ">
<field column="DocID" name="id" />
<field column="Title" name="title_t" />
<field column="description" name="contents_txt" />
<field column="url" name="url" />
</entity>
<entity name="testTbl_1"
transformer="RegexTransformer"
onError="continue"
query="SELECT Title, url, DocID, substring_index(body,' ',2048) \
description FROM testTbl_1 WHERE status in ('1','s') ">
<field column="DocID" name="id" />
<field column="Title" name="title_t" />
<field column="description" name="contents_txt" />
<field column="url" name="url" />
</entity>
....
+-------+------+----------------+------+---------+------+-------+--------+
| Id | User | Host | db | Command | Time | State | Info |
+-------+------+----------------+------+---------+------+-------+--------+
| 88757 | id | hostname:38843 | tmp | Sleep | 2268 | | NULL |
| 88758 | id | hostname:38844 | tmp | Sleep | 2196 | | NULL |
| 88759 | id | hostname:38845 | tmp | Sleep | 2134 | | NULL |
| 88760 | id | hostname:47822 | tmp | Sleep | 2074 | | NULL |
| 88761 | id | hostname:47823 | tmp | Sleep | 2013 | | NULL |
| 88762 | id | hostname:47824 | tmp | Sleep | 1953 | | NULL |
| 88763 | id | hostname:47825 | tmp | Sleep | 1896 | | NULL |
| 88764 | id | hostname:47826 | tmp | Sleep | 1838 | | NULL |
| 88765 | id | hostname:39795 | tmp | Sleep | 1778 | | NULL |
| 88766 | id | hostname:39796 | tmp | Sleep | 1717 | | NULL |
| 88767 | id | hostname:39797 | tmp | Sleep | 1658 | | NULL |
| 88768 | id | hostname:39798 | tmp | Sleep | 1594 | | NULL |
| 88769 | id | hostname:39799 | tmp | Sleep | 1535 | | NULL |
| 88770 | id | hostname:50275 | tmp | Sleep | 1470 | | NULL |
| 88771 | id | hostname:50276 | tmp | Sleep | 1411 | | NULL |
| 88772 | id | hostname:50277 | tmp | Sleep | 1352 | | NULL |
| 88773 | id | hostname:50278 | tmp | Sleep | 1291 | | NULL |
| 88774 | id | hostname:57385 | tmp | Sleep | 1165 | | NULL |
| 88775 | id | hostname:57386 | tmp | Sleep | 1044 | | NULL |
| 88776 | id | hostname:57387 | tmp | Sleep | 923 | | NULL |
| 88777 | id | hostname:53484 | tmp | Sleep | 801 | | NULL |
| 88778 | id | hostname:53485 | tmp | Sleep | 682 | | NULL |
| 88779 | id | hostname:58343 | tmp | Sleep | 560 | | NULL |
| 88780 | id | hostname:58344 | tmp | Sleep | 438 | | NULL |
| 88781 | id | hostname:58345 | tmp | Sleep | 314 | | NULL |
| 88782 | id | hostname:50474 | tmp | Sleep | 193 | | NULL |
| 88783 | id | hostname:50475 | tmp | Sleep | 72 | | NULL |
我阅读了某人关于数据库连接的问答。有人说,db connection 还存活了 10 秒。但我在 1 小时前开始索引(数据导入),所有数据库连接保持 1 小时。
| 88757 | id | localhost:38843 | tmp | Sleep | 3696 | | NULL |
| 88758 | id | localhost:38844 | tmp | Sleep | 3624 | | NULL |