Skip to content

SOLR-18330: RTG requests to TLOG can short-circuit - #4697

Open
dsmiley wants to merge 1 commit into
apache:mainfrom
dsmiley:SOLR-18330-TLOG-RTG-shortCircuit
Open

SOLR-18330: RTG requests to TLOG can short-circuit#4697
dsmiley wants to merge 1 commit into
apache:mainfrom
dsmiley:SOLR-18330-TLOG-RTG-shortCircuit

Conversation

@dsmiley

@dsmiley dsmiley commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Optimization: RTG requests to a TLOG leader replica shouldn't use an extra local HTTP hop.

https://issues.apache.org/jira/browse/SOLR-18330

Optimization: RTG requests to a TLOG leader replica shouldn't use an extra local HTTP hop.
replica ->
!builder.onlyNrt
|| (replica.getType() == Replica.Type.NRT
|| (replica.getType() == Replica.Type.TLOG

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

the TLOG check was needless and isn't friendly to custom/evolving replica types, even though admittedly unlikely.

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.

This change looks good to me too. Would be cool to have a isRealTime() utility.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I agree it'd be nice to have a utility

Comment on lines -278 to +276
private boolean onlyNrt;
private boolean onlyRtg;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

onlyNrt is misleading.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

IMO tracing is a nice way to show the byproduct of this optimization. Without the optimization, there wold be another embedded span for another HTTP request

@HoustonPutman HoustonPutman 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.

So I like the two changes regarding checking the near-real-time-ness of replicas.

Other than that, I don't really agree with the change from onlyNrt to onlyRtg. Maybe a different name would be better, since I understand why onlyNrt would be confusing for non-NRT leaders.

But RTG (I know not through the handler, just through the component) can be used with non-leader TLOG replicas, since a realTimeSearcher is not always needed.

&& (!onlyNrtReplicas || cloudDescriptor.getReplicaType() == Replica.Type.NRT)) {
&& (!onlyRtgReplicas
|| cloudDescriptor.getReplicaType() == Replica.Type.NRT
|| cloudDescriptor.isLeader())) {

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.

This change looks good to me. Though maybe we should have a utility method? Maybe if its gets used somewhere else. (Since this is a CloudDescriptor and the CloudReplicaSource change is using a Replica object, it can't be shared I guess)

replica ->
!builder.onlyNrt
|| (replica.getType() == Replica.Type.NRT
|| (replica.getType() == Replica.Type.TLOG

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.

This change looks good to me too. Would be cool to have a isRealTime() utility.

@dsmiley

dsmiley commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

But RTG (I know not through the handler, just through the component) can be used with non-leader TLOG replicas, since a realTimeSearcher is not always needed.

RTG always requests this:

req.getContext().put(HttpShardHandler.ONLY_NRT_REPLICAS, Boolean.TRUE);

I'm not married to the NRT -> RTG swap but feel it's an improvement.

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