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

fix(exporters/elasticsearch-exporter): avoid OOM when retrying #4787

Merged
merged 1 commit into from
Jun 22, 2020

Conversation

MiguelPires
Copy link
Contributor

Description

Don't append record again when retrying to export, in order to avoid OOM exception.

Related issues

closes #4668

Pull Request Checklist

  • All commit messages match our commit message guidelines
  • The submitting code follows our code style
  • If submitting code, please run mvn clean install -DskipTests locally before committing

@MiguelPires MiguelPires requested a review from saig0 June 22, 2020 13:05
@MiguelPires MiguelPires self-assigned this Jun 22, 2020
Copy link
Member

@saig0 saig0 left a comment

Choose a reason for hiding this comment

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

👍

Just two small optional suggestions.

@@ -118,7 +125,10 @@ public void bulk(final Map<String, Object> command, final Record<?> record) {
"Failed to serialize bulk request command to JSON", e);
}

bulkRequest.add(serializedCommand + "\n" + record.toJson());
final String jsonCommand = serializedCommand + "\n" + record.toJson();
if (bulkRequest.isEmpty() || !bulkRequest.get(bulkRequest.size() - 1).equals(jsonCommand)) {
Copy link
Member

Choose a reason for hiding this comment

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

We could add a comment here why we're filtering it out. I think it is not so obvious.

Comment on lines 156 to 158
when(recordMock.toJson()).thenReturn("{}");
client.index(recordMock);
Copy link
Member

Choose a reason for hiding this comment

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

A new-line could improve the reading flow.

Suggested change
when(recordMock.toJson()).thenReturn("{}");
client.index(recordMock);
when(recordMock.toJson()).thenReturn("{}");
client.index(recordMock);

@MiguelPires
Copy link
Contributor Author

bors r+

@zeebe-bors
Copy link
Contributor

zeebe-bors bot commented Jun 22, 2020

Build succeeded

@zeebe-bors zeebe-bors bot merged commit f9eeae3 into develop Jun 22, 2020
@zeebe-bors zeebe-bors bot deleted the 4668-limit-bulk branch June 22, 2020 15:39
zeebe-bors bot added a commit that referenced this pull request Jun 23, 2020
4789: [BACKPORT] fix(exporters/elasticsearch-exporter): avoid OOM exception when retrying r=saig0 a=MiguelPires

## Description

Don't append record again when retrying to export, in order to avoid OOM exception.

## Related issues

closes #4668 

backport of #4787

#

Co-authored-by: Miguel Pires <miguel.pires@camunda.com>
zeebe-bors bot added a commit that referenced this pull request Jun 23, 2020
4790: [BACKPORT] fix(exporters/elasticsearch-exporter): avoid OOM exception when retrying r=saig0 a=MiguelPires

## Description

Don't append record again when retrying to export, in order to avoid OOM exception.

## Related issues


closes #4668 

backport of #4787
#

Co-authored-by: Miguel Pires <miguel.pires@camunda.com>
github-merge-queue bot pushed a commit that referenced this pull request Apr 16, 2024
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Vinicius Goulart <vinicius.goulart@camunda.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Elasticsearch exporter bulk is not limited
3 participants