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
SOLR-14034: remove deprecated min_rf references #2152
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, will wait for another set of eyes before committing. @cpoerschke?
@trdillon can you add an entry to solr/CHANGES
with your preferred attribution?
solr/solrj/src/java/org/apache/solr/client/solrj/impl/BaseCloudSolrClient.java
Show resolved
Hide resolved
if (minRf != null) { | ||
up.setParam(UpdateRequest.MIN_REPFACT, String.valueOf(minRf)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @trdillon - thanks for opening this pull request!
Okay, I think I see it now, so your https://issues.apache.org/jira/browse/SOLR-14034?focusedCommentId=17223427&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-17223427 question is about this sort of test change here i.e. whether or not minRf
should remain an unused sendDoc
argument or whether or not it should be removed. I'm thinking here in HttpPartitionTest
removal makes sense (haven't yet looked at ReplicationFactorTest
). What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cpoerschke Thanks for all your help with this one.
sendDoc
seems OK to remove from HttpPartitionTest
as it's only passed minRf
as an argument, but in ReplicationFactorTest
it is passed expectedRf
as an argument in addDocs
:
sendDoc(idList[0], expectedRf); |
sendDocsWithRetry
is implemented here and used in a few different test classes (DistributedVersionInfoTest
, LeaderFailoverAfterPartitionTest
and ForceLeaderTest
) with minRf
as an argument:
lucene-solr/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java
Line 941 in 98f12f4
protected static int sendDocsWithRetry(CloudSolrClient cloudClient, String collection, List<SolrInputDocument> batch, int minRf, int maxRetries, int waitBeforeRetry) throws Exception { |
But it's also implemented using expectedRfDBQ
and expectedRf
in ReplicationFactorTest
:
sendDocsWithRetry(batch, expectedRfDBQ, 5, 1); sendDocsWithRetry(batch, expectedRf, retries, 1);
I wasn't sure how to proceed with this as looking at the tests it seems that expectedRf
is relied upon quite often.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the code pointers and detailed explanation!
How about we scope this pull request to remove minRf
in almost all code paths i.e. sendDoc
gets its unused argument removed in both the replication factor and http partition tests but sendDocsWithRetry
remains unchanged for now since as you say it's used in other test classes too?
It appears that the minRf
argument in sendDocsWithRetry
is indeed unused already but it might be clearer to tidy that up in a separate follow-up pull request rather than mix it in here at this time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It appears that the minRf argument in sendDocsWithRetry is indeed unused already but it might be clearer to tidy that up in a separate follow-up pull request rather than mix it in here at this time.
I'm wondering if it would be better for this method to actually start using this parameter, and retry in the case of minRf
not achieved? This is not something that was being done in this method, but may help improve some of the tests using it. I don't think such a change should be done in this PR, but maybe lets not remove the parameter yet then. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if it would be better for this method to actually start using this parameter, ...
Ah, yes, I agree, if it's a case of a not-yet-used parameter then keeping it and starting to use it makes sense. Removal would only be for no-longer-used parameter cases. Good catch!
solr/core/src/test/org/apache/solr/cloud/ReplicationFactorTest.java
Outdated
Show resolved
Hide resolved
At https://github.com/apache/lucene-solr/blob/releases/lucene-solr/8.7.0/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java#L754-L756 there's also a |
boolean minRfExplicit = maybeAddMinRfExplicitly(minRf, up); | ||
SolrInputDocument doc = new SolrInputDocument(); | ||
doc.addField(id, String.valueOf(docId)); | ||
doc.addField("a_t", "hello" + docId); | ||
up.add(doc); | ||
return runAndGetAchievedRf(up, minRfExplicit, minRf); | ||
return runAndGetAchievedRf(up); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, so with maybeAddMinRfExplicitly
gone and the minRf
argument in runAndGetAchievedRf
gone the minRf
argument of sendDoc
becomes unused, right? I wonder how the code would work out if sendDoc
had its minRf
argument taken away too? Bit like peeling an onion this here i.e. multiple layers (but it hopefully won't make anyone cry).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tests for ReplicationFactorTest
and HttpPartitionTest
passed on my end after removing the minRf
argument from sendDoc
. I committed the ReplicationFactorTest
changes separately as it meant removing the expectedRf
argument from the sendDoc
call in addDocs
and I wasn't sure if this was OK, even though the test still passed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I appreciate you committing the changes separately, thanks. The ReplicationFactorTest
change looks good to me.
if (minRf != null) { | ||
up.setParam(UpdateRequest.MIN_REPFACT, String.valueOf(minRf)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the code pointers and detailed explanation!
How about we scope this pull request to remove minRf
in almost all code paths i.e. sendDoc
gets its unused argument removed in both the replication factor and http partition tests but sendDocsWithRetry
remains unchanged for now since as you say it's used in other test classes too?
It appears that the minRf
argument in sendDocsWithRetry
is indeed unused already but it might be clearer to tidy that up in a separate follow-up pull request rather than mix it in here at this time.
The comment still seems to be relevant and makes sense without the first sentence that references |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
if (minRf != null) { | ||
up.setParam(UpdateRequest.MIN_REPFACT, String.valueOf(minRf)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It appears that the minRf argument in sendDocsWithRetry is indeed unused already but it might be clearer to tidy that up in a separate follow-up pull request rather than mix it in here at this time.
I'm wondering if it would be better for this method to actually start using this parameter, and retry in the case of minRf
not achieved? This is not something that was being done in this method, but may help improve some of the tests using it. I don't think such a change should be done in this PR, but maybe lets not remove the parameter yet then. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Will aim to proceed to merge the PR about this time tomorrow if there are no further comments etc. Thanks!
boolean minRfExplicit = maybeAddMinRfExplicitly(minRf, up); | ||
SolrInputDocument doc = new SolrInputDocument(); | ||
doc.addField(id, String.valueOf(docId)); | ||
doc.addField("a_t", "hello" + docId); | ||
up.add(doc); | ||
return runAndGetAchievedRf(up, minRfExplicit, minRf); | ||
return runAndGetAchievedRf(up); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I appreciate you committing the changes separately, thanks. The ReplicationFactorTest
change looks good to me.
if (minRf != null) { | ||
up.setParam(UpdateRequest.MIN_REPFACT, String.valueOf(minRf)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if it would be better for this method to actually start using this parameter, ...
Ah, yes, I agree, if it's a case of a not-yet-used parameter then keeping it and starting to use it makes sense. Removal would only be for no-longer-used parameter cases. Good catch!
Description
Remove min_rf and MIN_REPFACT references in code, tests and documentation.
Solution
Incrementally remove min_rf and MIN_REPFACT references.
Tests
./gradlew check
Checklist
Please review the following and check all that apply:
master
branch../gradlew check
.