Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

SOLR-18294: Fix flaky IndexFetcherPacketProtocolTest (#4624)

Shubham Ranjaneb59a9a6db4a
diff --git a/solr/core/src/test/org/apache/solr/handler/IndexFetcherPacketProtocolTest.java b/solr/core/src/test/org/apache/solr/handler/IndexFetcherPacketProtocolTest.java
index e9d639f1ab3..36d47427a4f 100644
--- a/solr/core/src/test/org/apache/solr/handler/IndexFetcherPacketProtocolTest.java
+++ b/solr/core/src/test/org/apache/solr/handler/IndexFetcherPacketProtocolTest.java
@@ -227,10 +227,13 @@ public class IndexFetcherPacketProtocolTest extends SolrTestCaseJ4 {
/** Writes file content to a directory and serializes it using the replication packet protocol. */
private byte[] serializeFileToPacketStream(byte[] content, String fileName) throws Exception {
DirectoryFactory directoryFactory = h.getCore().getDirectoryFactory();
+ // Use the same REPLICATION DirContext that the sender (DirectoryFileStream) uses to read the
+ // file, so the write and the read target the same (unwrapped) delegate Directory. For
+ // REPLICATION/BACKUP, CachingDirectoryFactory.filterDirectory() unwraps to the raw delegate.
Directory dir =
directoryFactory.get(
h.getCore().getNewIndexDir(),
- DirectoryFactory.DirContext.DEFAULT,
+ DirectoryFactory.DirContext.REPLICATION,
h.getCore().getSolrConfig().indexConfig.lockType);
try {