Introduce TransportShardMultiGetFomTranslog#96492
Conversation
155310e to
3631dbc
Compare
3631dbc to
4031e96
Compare
|
Pinging @elastic/es-distributed (Team:Distributed) |
…ultiGetFromTranslog
|
#96581 has been merged, and this is a bit smaller now. |
kingherc
left a comment
There was a problem hiding this comment.
Some passer-by comments. Will review further.
server/src/main/java/org/elasticsearch/action/get/TransportShardMultiGetFomTranslogAction.java
Show resolved
Hide resolved
| import java.util.Objects; | ||
|
|
||
| // TODO(ES-5727): add a retry mechanism to TransportShardMultiGetFromTranslogAction | ||
| public class TransportShardMultiGetFomTranslogAction extends HandledTransportAction< |
There was a problem hiding this comment.
Where is this class used? I don't see it anywhere apart from tests. Will it be used in the future?
There was a problem hiding this comment.
To clarify I see handleGetOnUnpromotableShard() in TransportGetAction, but I do not see a similar one in your PR in TransportMultiGetAction.?
There was a problem hiding this comment.
Similarly, it will be used in TransportShardMultiGetAction in a follow-up PR.
There was a problem hiding this comment.
OK, thanks for clarifying! Looking forward to the follow-up PR.
kingherc
left a comment
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
Is there a reason we do not include the failures variable in equality and hashcode?
There was a problem hiding this comment.
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.
server/src/main/java/org/elasticsearch/action/get/TransportShardMultiGetFomTranslogAction.java
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/action/get/TransportShardMultiGetFomTranslogAction.java
Show resolved
Hide resolved
| import java.util.Objects; | ||
|
|
||
| // TODO(ES-5727): add a retry mechanism to TransportShardMultiGetFromTranslogAction | ||
| public class TransportShardMultiGetFomTranslogAction extends HandledTransportAction< |
There was a problem hiding this comment.
To clarify I see handleGetOnUnpromotableShard() in TransportGetAction, but I do not see a similar one in your PR in TransportMultiGetAction.?
server/src/internalClusterTest/java/org/elasticsearch/get/ShardMultiGetFomTranslogActionIT.java
Show resolved
Hide resolved
server/src/test/java/org/elasticsearch/action/get/ShardMultiGetFromTranslogUtil.java
Show resolved
Hide resolved
server/src/internalClusterTest/java/org/elasticsearch/get/ShardMultiGetFomTranslogActionIT.java
Show resolved
Hide resolved
| assertThat(getResponses.size(), equalTo(3)); | ||
| assertNotNull(getResponses.get(0)); | ||
| assertThat(getResponses.get(0).getId(), equalTo("1")); | ||
| assertThat(getResponses.get(0).getVersion(), equalTo(indexResponse.getVersion())); |
There was a problem hiding this comment.
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".
There was a problem hiding this comment.
I think last time we agreed that checking version is enough: #95998 (comment)
server/src/internalClusterTest/java/org/elasticsearch/get/ShardMultiGetFomTranslogActionIT.java
Show resolved
Hide resolved
| } | ||
|
|
||
| private long randomSegmentGeneration() { | ||
| return randomBoolean() ? -1L : randomNonNegativeLong(); |
There was a problem hiding this comment.
nit. randomFrom(-1L, randomNonNegativeLong());
feel free to use randomFrom in other places as well where appropriate.
kingherc
left a comment
There was a problem hiding this comment.
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< |
There was a problem hiding this comment.
OK, thanks for clarifying! Looking forward to the follow-up PR.
|
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. |
The multi-get counterpart of #95998.
Relates ES-5677