Skip to content

SOLR-18332: More 'qt' removal, rd 6 - #4773

Open
gerlowskija wants to merge 5 commits into
apache:mainfrom
gerlowskija:qt-removal-rd6
Open

SOLR-18332: More 'qt' removal, rd 6#4773
gerlowskija wants to merge 5 commits into
apache:mainfrom
gerlowskija:qt-removal-rd6

Conversation

@gerlowskija

Copy link
Copy Markdown
Contributor

The 'qt' parameter and several related methods in SolrJ are deprecated.
This deprecation may not stick, but it's still worth minimizing use of this
feature as much as possible.

Many tests rely on it unnecessarily; this PR is one in a number of batches
slowly removing these test usages. Unlike previous batches, the removals
in this PR are a bit more of a catch-all. A number of different patterns are
addressed here. (They've been broken up into separate commits, for the
purpose of making review easier.)

CacheHeaderTest/CacheHeaderTestBase built raw /select URLs with a
vestigial qt=standard param that's never read (HttpSolrCall dispatches
by URL path alone), so it's dropped outright. SolrRequestParserTest
used "qt" purely as an arbitrary param name to test percent-decoding,
unrelated to handler dispatch, so it's renamed to "misc"/"misc2".
checkQueries() switches to the explicit-handler query(String, SolrParams)
overload instead of embedding qt in the varargs. getIndexVersion(Replica)
and logReplicationDetails(Replica, StringBuilder) build a QueryRequest with
an explicit path instead of relying on SolrClient.query(SolrParams)'s
client-side qt-to-path conversion.

Also closes out the ShardRoutingTest.java doRTG() call site deferred from
the earlier BaseDistributedSearchTestCase.query(...) cleanup, via a new
doQuery(List<String>, String, String...) overload that takes the expected
doc ids as a List<String> instead of a comma-delimited String.
TestJavaBinResponseWriter, TestSubQueryTransformer, EnumFieldTest, and
TestGroupingSearch read qt off a request that never had it set (built
via req(...)/lrf.makeRequest(...) with no qt param), then passed the
always-null result to h.queryAndResponse(...)/core.execute(...). Same
shape in BasicFunctionalityTest's 3 remaining call sites. Replaced with
literal null, a behavior-preserving simplification since the value was
always null anyway.

ConvertedLegacyTest is the one real case: makeParams(...) embedded qt
in a SolrParams fed directly into `new SolrQueryRequestBase(core, params)`,
which never sets getPath(), so assertQ's handler resolution fell back to
reading qt. Every caller passed "/select", so qtype is dropped from
makeParams entirely and call sites switch to reqWithPath("/select", ...).
Clarify that a null handlerName doesn't just return null - it resolves
to the core's default request handler via the empty-string alias
RequestHandlers registers at startup.
TestTlogReplayVsRecovery already dispatched via an explicit path on its
GenericSolrRequest, so the "qt","/get" pair alongside it was pure vestige.

DistribCursorPagingTest.assertFullWalkNoDups read qt off its params (with
a "/select" default) to pick a request handler for QueryRequest. Mirrors
the fix already applied to the analogous non-distributed CursorPagingTest:
add an explicit-handler overload, have assertFullWalkNoDupsElevated call
it with "/elevate" instead of embedding qt in params, and have the
no-handler overload default to "/select" explicitly (QueryRequest's
2-arg constructor requires a non-null path, unlike GenericSolrRequest).

@dsmiley dsmiley left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice progress

* Get the request handler registered to a given name.
*
* <p>A {@code null} handlerName resolves to the core's default request handler (whichever handler
* is aliased to the empty string, normally the one registered at "/select", or "standard" for

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@epugh I recall you killed the "standard" pattern

assertEquals(expectedIds, obtainedIds);
}

void doQuery(List<String> expectedIds, String path, String... queryParams) throws Exception {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I very much disklike the param structure. Can you please require a QueryRequest?

params.set("qt", "/replication");
params.set(ReplicationHandler.COMMAND, ReplicationHandler.CMD_SHOW_COMMITS);
try {
QueryResponse response = client.query(params);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

another one bites the dust; thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants