SOLR-6950: Ensure TransactionLogs are closed with test ObjectReleaseTracker.

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1650781 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark Robert Miller 2015-01-10 18:09:14 +00:00
parent 5e8eb5cd46
commit d97b1cef28
2 changed files with 9 additions and 0 deletions

View File

@ -33,6 +33,7 @@ import org.apache.solr.common.util.DataInputInputStream;
import org.apache.solr.common.util.FastInputStream;
import org.apache.solr.common.util.FastOutputStream;
import org.apache.solr.common.util.JavaBinCodec;
import org.apache.solr.common.util.ObjectReleaseTracker;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -114,6 +115,8 @@ public class HdfsTransactionLog extends TransactionLog {
success = true;
assert ObjectReleaseTracker.track(this);
} catch (IOException e) {
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, e);
} finally {
@ -305,6 +308,7 @@ public class HdfsTransactionLog extends TransactionLog {
log.error("Exception closing tlog.", e);
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, e);
} finally {
assert ObjectReleaseTracker.release(this);
if (deleteOnClose) {
try {
fs.delete(tlogFile, true);

View File

@ -40,6 +40,7 @@ import org.apache.solr.common.util.DataInputInputStream;
import org.apache.solr.common.util.FastInputStream;
import org.apache.solr.common.util.FastOutputStream;
import org.apache.solr.common.util.JavaBinCodec;
import org.apache.solr.common.util.ObjectReleaseTracker;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -177,6 +178,8 @@ public class TransactionLog {
}
success = true;
assert ObjectReleaseTracker.track(this);
} catch (IOException e) {
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, e);
@ -553,6 +556,8 @@ public class TransactionLog {
}
} catch (IOException e) {
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, e);
} finally {
assert ObjectReleaseTracker.release(this);
}
}