diff --git a/solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.java b/solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.java index 5d1a67ccae4..ea9ea298353 100644 --- a/solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.java +++ b/solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.java @@ -842,8 +842,10 @@ public class DirectUpdateHandler2 extends UpdateHandler implements SolrCoreState lst.add("cumulative_deletesById", deleteByIdCommandsCumulative.get()); lst.add("cumulative_deletesByQuery", deleteByQueryCommandsCumulative.get()); lst.add("cumulative_errors", numErrorsCumulative.get()); - lst.add("transaction_logs_total_size", ulog.getTotalLogsSize()); - lst.add("transaction_logs_total_number", ulog.getTotalLogsNumber()); + if (this.ulog != null) { + lst.add("transaction_logs_total_size", ulog.getTotalLogsSize()); + lst.add("transaction_logs_total_number", ulog.getTotalLogsNumber()); + } return lst; } diff --git a/solr/core/src/java/org/apache/solr/update/TransactionLog.java b/solr/core/src/java/org/apache/solr/update/TransactionLog.java index ac13dd172d9..a9cefc657aa 100644 --- a/solr/core/src/java/org/apache/solr/update/TransactionLog.java +++ b/solr/core/src/java/org/apache/solr/update/TransactionLog.java @@ -564,7 +564,10 @@ public class TransactionLog { } public long getLogSize() { - return tlogFile.length(); + if (tlogFile != null) { + return tlogFile.length(); + } + return 0; } /** Returns a reader that can be used while a log is still in use. @@ -579,7 +582,6 @@ public class TransactionLog { return new FSReverseReader(); } - public class LogReader { private ChannelFastInputStream fis; private LogCodec codec = new LogCodec(resolver);