Skip to content
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

Refactoring TransportSimulateBulkAction to not extend TransportBulkAction #109889

Merged
merged 10 commits into from
Jun 27, 2024

Conversation

masseyke
Copy link
Member

@masseyke masseyke commented Jun 18, 2024

This refactors TransportSimulateBulkAction and TransportBulkAction to inherit from a new common abstract class, rather than having TransportSimulateBulkAction extend TransportBulkAction. No user-observable functionality has changed. The simulate code no longer runs the ShardBulkAction logic (which is not needed for simulate anyway).
The motivation for this change is so that we remove the risk that a simulate request changes any state in the system (index data, cluster state, etc). The tradeoff is that the simulate path now executes less of the logic used by a bulk request (however, most of that logic is irrelevant to a simulation anyway). The core logic of traversing relevant indices and executing pipelines remains shared between simulate and normal bulk.

@masseyke masseyke added :Data Management/Ingest Node Execution or management of Ingest Pipelines including GeoIP >refactoring labels Jun 18, 2024
@masseyke masseyke marked this pull request as ready for review June 20, 2024 22:34
@elasticsearchmachine elasticsearchmachine added the Team:Data Management Meta label for data/management team label Jun 20, 2024
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-data-management (Team:Data Management)

@masseyke
Copy link
Member Author

The build is currently broken because https://auth.docker.io/ is having problems.

@masseyke masseyke requested a review from dakrone June 25, 2024 16:05
Copy link
Contributor

@parkertimmins parkertimmins left a comment

Choose a reason for hiding this comment

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

This looks good to me, nice refactor! That said, I'd definitely suggest not merging until a someone with a better understanding of this code has taken a look

Copy link
Member

@dakrone dakrone left a comment

Choose a reason for hiding this comment

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

LGTM, I left some comments, but they're all around comment stuff. Thanks Keith!

);
}

protected abstract boolean shouldStoreFailure(String indexName, Metadata metadata, long epochMillis);
Copy link
Member

Choose a reason for hiding this comment

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

Can you add javadocs for this method?

@@ -781,13 +552,18 @@ public boolean isForceExecution() {
* @return true if the given index name corresponds to a data stream with a failure store,
* or if it matches a template that has a data stream failure store enabled.
*/
Copy link
Member

Choose a reason for hiding this comment

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

This is probably the javadoc you can copy over

DocWriteRequest<?> request = bulkRequest.requests.get(i);
assert request instanceof IndexRequest; // This action is only ever called with IndexRequests
DocWriteRequest<?> docRequest = bulkRequest.requests.get(i);
assert docRequest instanceof IndexRequest; // This action is only ever called with IndexRequests
Copy link
Member

Choose a reason for hiding this comment

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

Can you change the comment into an assertion message?


@Override
protected boolean shouldStoreFailure(String indexName, Metadata metadata, long time) {
return false;
Copy link
Member

Choose a reason for hiding this comment

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

Can you add a comment about why this is always false?

Copy link
Contributor

@henningandersen henningandersen left a comment

Choose a reason for hiding this comment

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

LGTM.

@masseyke masseyke merged commit 30dd002 into elastic:main Jun 27, 2024
15 checks passed
@masseyke masseyke deleted the transport-bulk-action-refactor branch June 27, 2024 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Data Management/Ingest Node Execution or management of Ingest Pipelines including GeoIP >refactoring Team:Data Management Meta label for data/management team v8.15.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants