Skip to content

Introduce TransportShardMultiGetFomTranslog#96492

Merged
pxsalehi merged 5 commits intoelastic:mainfrom
pxsalehi:ps230526-TransportMultiGetFromTranslog
Jun 9, 2023
Merged

Introduce TransportShardMultiGetFomTranslog#96492
pxsalehi merged 5 commits intoelastic:mainfrom
pxsalehi:ps230526-TransportMultiGetFromTranslog

Conversation

@pxsalehi
Copy link
Copy Markdown
Member

@pxsalehi pxsalehi commented Jun 1, 2023

The multi-get counterpart of #95998.

Relates ES-5677

@pxsalehi pxsalehi force-pushed the ps230526-TransportMultiGetFromTranslog branch 2 times, most recently from 155310e to 3631dbc Compare June 5, 2023 12:36
@pxsalehi pxsalehi force-pushed the ps230526-TransportMultiGetFromTranslog branch from 3631dbc to 4031e96 Compare June 5, 2023 16:14
@pxsalehi pxsalehi marked this pull request as ready for review June 6, 2023 12:25
@pxsalehi pxsalehi added >non-issue :Distributed/CRUD A catch all label for issues around indexing, updating and getting a doc by id. Not search. labels Jun 6, 2023
@pxsalehi pxsalehi requested review from henningandersen and tlrx June 6, 2023 12:26
@elasticsearchmachine elasticsearchmachine added the Team:Distributed Meta label for distributed team. label Jun 6, 2023
@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-distributed (Team:Distributed)

@pxsalehi
Copy link
Copy Markdown
Member Author

pxsalehi commented Jun 7, 2023

#96581 has been merged, and this is a bit smaller now.

@pxsalehi pxsalehi requested review from Tim-Brooks and kingherc June 7, 2023 15:11
Copy link
Copy Markdown
Contributor

@kingherc kingherc left a comment

Choose a reason for hiding this comment

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

Some passer-by comments. Will review further.

import java.util.Objects;

// TODO(ES-5727): add a retry mechanism to TransportShardMultiGetFromTranslogAction
public class TransportShardMultiGetFomTranslogAction extends HandledTransportAction<
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.

Where is this class used? I don't see it anywhere apart from tests. Will it be used in the future?

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.

To clarify I see handleGetOnUnpromotableShard() in TransportGetAction, but I do not see a similar one in your PR in TransportMultiGetAction.?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Similarly, it will be used in TransportShardMultiGetAction in a follow-up PR.

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.

OK, thanks for clarifying! Looking forward to the follow-up PR.

Copy link
Copy Markdown
Contributor

@kingherc kingherc left a comment

Choose a reason for hiding this comment

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

Did a deeper review today. In general looks good to me, left some comments. My main question still remains, whether you'll including using the new action in this PR or a future PR.

if (this == o) return true;
if (o instanceof MultiGetShardResponse == false) return false;
MultiGetShardResponse other = (MultiGetShardResponse) o;
return Objects.equals(locations, other.locations) && Objects.equals(responses, other.responses);
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.

Is there a reason we do not include the failures variable in equality and hashcode?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Failure includes an Exception, and I think we do not provide logical equality for exceptions. If we include failures, I don't think the serialization tests for objects that have a Failure property would work (since deserializing the same instance would not be equal to the original one because we consider each exception unique). I might be missing something, but I do not think we need to consider failures.

import java.util.Objects;

// TODO(ES-5727): add a retry mechanism to TransportShardMultiGetFromTranslogAction
public class TransportShardMultiGetFomTranslogAction extends HandledTransportAction<
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.

To clarify I see handleGetOnUnpromotableShard() in TransportGetAction, but I do not see a similar one in your PR in TransportMultiGetAction.?

assertThat(getResponses.size(), equalTo(3));
assertNotNull(getResponses.get(0));
assertThat(getResponses.get(0).getId(), equalTo("1"));
assertThat(getResponses.get(0).getVersion(), equalTo(indexResponse.getVersion()));
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 think it might be nice to also assert the returned "field1" value == "value1" here and in all corresponding points below, especially when changed to "value2".

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think last time we agreed that checking version is enough: #95998 (comment)

}

private long randomSegmentGeneration() {
return randomBoolean() ? -1L : randomNonNegativeLong();
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.

nit. randomFrom(-1L, randomNonNegativeLong());

feel free to use randomFrom in other places as well where appropriate.

@pxsalehi pxsalehi requested a review from kingherc June 9, 2023 11:44
Copy link
Copy Markdown
Contributor

@kingherc kingherc left a comment

Choose a reason for hiding this comment

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

Thanks for taking care of feedback. LGTM. Looking forward to the follow-up PR.

import java.util.Objects;

// TODO(ES-5727): add a retry mechanism to TransportShardMultiGetFromTranslogAction
public class TransportShardMultiGetFomTranslogAction extends HandledTransportAction<
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.

OK, thanks for clarifying! Looking forward to the follow-up PR.

@pxsalehi pxsalehi merged commit 2c1cd26 into elastic:main Jun 9, 2023
@pxsalehi
Copy link
Copy Markdown
Member Author

pxsalehi commented Jun 9, 2023

Thanks, Iraklis!

I've merged this so that I can move on with the rest of the MGet PRs. @tlrx and @henningandersen, if you have anything else on this, please let me know. I'll do it in a follow up.

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

Labels

:Distributed/CRUD A catch all label for issues around indexing, updating and getting a doc by id. Not search. >non-issue Team:Distributed Meta label for distributed team. v8.9.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants