It is found that after inserting a data file ( not for every data file), the
hang problem will happend. So we opened the debug information for database.
From debug information of postgresql, we knew after registering the data file
into xml_documents table, then the next xml documents couldn't insert into
xml_documents table and stopped there when the problem happened. From the
observation, the data file seemed successfully registered into xml_documents
table. Howerver, it didn't. I think the unsuccessful registering of data file
caused the stopping of next xml document inserting.
So we think, for some reason, the registerDocument method check out a db
connection which autoCommit value equlas false ( I am not sure why this
happend), but after insert into xml_documents table, we didn't commit it ( the
defualt value of autoCommit is true). So the data file didn't insert into
database.
Our solution is simple. In registerDocument method, before excecute the insert
sql command, set autoCommit value false for the dbconnection. Then commit it.
Before check the dbconnection in, set autoCommit value true.
I tested the code by replication 347 document from one metacat to another
metacat. The hang problem didn't happend again.