Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix TestReplicationHandler #3142

Merged

Conversation

HoustonPutman
Copy link
Contributor

This actually stems from two commits on the same day, kind of eerie.

SOLR-17306

This uncommented out:

System.setProperty("solr.directoryFactory", "solr.StandardDirectoryFactory");

Apparently when using the StandardDirectoryFactory, we see core snapshot directories when we don't see them using the default DirectoryFactory. The code already accounted for snapshot metadata, but not snapshots themselves. I updated the check to ignore any snapshot directory when counting index directories. @dsmiley, you wrote the snapshot metadata filtering, so can you check this for me?

SOLR-17548

In ReplicationTestHelper, this changed

FileUtils.copyFile(
        new File(SolrTestCaseJ4.TEST_HOME(), "solr.xml"),
        new File(instance.getHomeDir(), "solr.xml"));

to

Files.copy(
        Path.of(SolrTestCaseJ4.TEST_HOME(), "solr.xml"),
        Path.of(instance.getHomeDir(), "solr.xml"));

However, this forgot to allow for overwrites, as was done in other cases in this PR. Probably because nightly tests are usually forgotten.

@epugh
Copy link
Contributor

epugh commented Jan 28, 2025

@mlbiscoc I should have reminded/and or run the nightly tests when I was reviewing the path stuff.. Let's remember to do that as we continue!

@epugh
Copy link
Contributor

epugh commented Jan 28, 2025

Thanks @HoustonPutman for looking at these, and sorry I didn't catch them, as I think I reviewed both of those PR's. Is there some more unit testing that we need that would have prevented these regressions?

@@ -1037,8 +1036,7 @@ private int indexDirCount(String ddir) {
@Override
public boolean accept(File dir, String name) {
File f = new File(dir, name);
return f.isDirectory()
&& !SolrSnapshotMetaDataManager.SNAPSHOT_METADATA_DIR.equals(name);
return f.isDirectory() && !name.startsWith("snapshot");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems so "magical" that you have to know about a "snapshot".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed, it's just in the error output that the snapshot is there. I know no magic 😅

Copy link
Contributor

@epugh epugh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@HoustonPutman
Copy link
Contributor Author

Thanks @HoustonPutman for looking at these, and sorry I didn't catch them, as I think I reviewed both of those PR's. Is there some more unit testing that we need that would have prevented these regressions?

We should have another crave job that runs the nightly tests. I looked into it, but I don't know where our crave config lives, so I don't know how to enable that.

@dsmiley
Copy link
Contributor

dsmiley commented Jan 29, 2025

I raised the topic on the dev list but FYI I'm our resident Crave expert.

@HoustonPutman
Copy link
Contributor Author

@dsmiley do you have any opinion on adding the snapshot directories to the filter?

Copy link
Contributor

@dsmiley dsmiley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't recall. I used git blame and see that I was reviewing the contribution of a contributor "Hrishikesh Gadre" in SOLR-9269. Back then we used subversion; no contributor metadata in the commit message.

Change seems fine I guess. Basically you loosened from equals to startsWith.

@HoustonPutman HoustonPutman merged commit a5b0b98 into apache:main Jan 29, 2025
3 checks passed
@HoustonPutman HoustonPutman deleted the fix-replication-handler-tests branch January 29, 2025 18:45
HoustonPutman added a commit that referenced this pull request Jan 29, 2025
Addresses a combination of SOLR-17306 and SOLR-17548.

(cherry picked from commit a5b0b98)
HoustonPutman added a commit that referenced this pull request Jan 29, 2025
Addresses a combination of SOLR-17306 and SOLR-17548.

(cherry picked from commit a5b0b98)
@mlbiscoc
Copy link
Contributor

@mlbiscoc I should have reminded/and or run the nightly tests when I was reviewing the path stuff.. Let's remember to do that as we continue!

Got it. Thanks @HoustonPutman for fixing the regression!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants