This is an automated email from the ASF dual-hosted git repository.
dsmiley pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/main by this push:
new e849fd0540f SOLR-17456: TransactionLog ctor integrity (#2762)
e849fd0540f is described below
commit e849fd0540fb4f0e013a1f73e93c3e85a933ed83
Author: David Smiley <[email protected]>
AuthorDate: Mon Nov 4 17:32:39 2024 -0500
SOLR-17456: TransactionLog ctor integrity (#2762)
The TransactionLog constructor can't handle an existing file being present;
it shouldn't be there.
Should throw an exception in this case, NOT log a warning which would leave
the object in a partially constructed state.
This should happen in the first place, of course. I see no evidence it has
occurred.
---
solr/core/src/java/org/apache/solr/update/TransactionLog.java | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
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 3174324f859..f8c0d48731d 100644
--- a/solr/core/src/java/org/apache/solr/update/TransactionLog.java
+++ b/solr/core/src/java/org/apache/solr/update/TransactionLog.java
@@ -38,6 +38,7 @@ import java.util.TreeMap;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.lucene.util.BytesRef;
import org.apache.solr.common.SolrException;
+import org.apache.solr.common.SolrException.ErrorCode;
import org.apache.solr.common.SolrInputDocument;
import org.apache.solr.common.util.CollectionUtil;
import org.apache.solr.common.util.DataInputInputStream;
@@ -221,8 +222,9 @@ public class TransactionLog implements Closeable {
}
} else {
if (Files.exists(tlog)) {
- log.warn("New transaction log already exists:{} size={}", tlog,
Files.size(tlog));
- return;
+ throw new SolrException(
+ ErrorCode.SERVER_ERROR,
+ "New transaction log already exists:" + tlog + " size=" +
Files.size(tlog));
}
channel =
@@ -238,9 +240,6 @@ public class TransactionLog implements Closeable {
}
success = true;
-
- assert ObjectReleaseTracker.track(this);
-
} catch (IOException e) {
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, e);
} finally {
@@ -252,6 +251,7 @@ public class TransactionLog implements Closeable {
}
}
}
+ assert ObjectReleaseTracker.track(this);
}
// for subclasses