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

Migrate OpenSearchSink off of plugin Settings #5273

Open
wants to merge 64 commits into
base: main
Choose a base branch
from

Conversation

Galactus22625
Copy link
Member

@Galactus22625 Galactus22625 commented Dec 18, 2024

Description

Migrate OpenSearchSink off of plugin Settings.
Tested that I can write with a pipeline into OpenSearch Sink. Tested that writing to s3 dlq works. Integration tests pass.

Issues

This relates to #5246

Notes:
IndexConfiguration.getPipeline() would always return null since it pulled form a non existent field in pipelineSettings., meaning the pipeline field for objects in bulkRequest is always null. If pipeline field is populated bulkRequest would fail.

Check List

  • New functionality includes testing.
  • New functionality has a documentation issue. Please link to it in this PR.
    • New functionality has javadoc added
  • Commits are signed with a real name per the DCO

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

…nstead of PluginSettings. Rebuild readConnectionConfiguration

Signed-off-by: Maxwell Brown <[email protected]>
…OpenSearchSink. Remove commented out code

Signed-off-by: Maxwell Brown <[email protected]>
Signed-off-by: Maxwell Brown <[email protected]>
Signed-off-by: Maxwell Brown <[email protected]>
Signed-off-by: Maxwell Brown <[email protected]>
Signed-off-by: Maxwell Brown <[email protected]>
Signed-off-by: Maxwell Brown <[email protected]>
Signed-off-by: Maxwell Brown <[email protected]>
Signed-off-by: Maxwell Brown <[email protected]>
Signed-off-by: Maxwell Brown <[email protected]>
Signed-off-by: Maxwell Brown <[email protected]>
Signed-off-by: Maxwell Brown <[email protected]>
Signed-off-by: Maxwell Brown <[email protected]>
Signed-off-by: Maxwell Brown <[email protected]>
Signed-off-by: Maxwell Brown <[email protected]>
Signed-off-by: Maxwell Brown <[email protected]>
@@ -258,22 +259,6 @@ void doOutput_with_invalid_version_expression_catches_NumberFormatException_and_
verify(dynamicDocumentVersionDroppedEvents).increment();
}

@Test
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is this removed?

Copy link
Member Author

Choose a reason for hiding this comment

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

Forgot to re-add when i put routing_field back. fixed

Signed-off-by: Maxwell Brown <[email protected]>
Signed-off-by: Maxwell Brown <[email protected]>
build.gradle Outdated
Copy link
Member Author

Choose a reason for hiding this comment

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

I should move this to opensearch/build.gradle file

Copy link
Member Author

Choose a reason for hiding this comment

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

moved

@Galactus22625 Galactus22625 requested a review from san81 as a code owner January 16, 2025 18:21
Signed-off-by: Maxwell Brown <[email protected]>
@@ -28,7 +28,7 @@ jobs:
run: ./gradlew --parallel --max-workers 2 build
- name: Upload Unit Test Results
if: always()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
Copy link
Member

Choose a reason for hiding this comment

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

These should not show up as changes in this PR since they were already applied. You may need to rebase from main to correct this.

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed by merging main into branch

this.failedBulkOperationConverter = new FailedBulkOperationConverter(pluginSetting.getPipelineName(), pluginSetting.getName(),
pluginSetting.getName());
this.failedBulkOperationConverter = new FailedBulkOperationConverter(pipeline, PLUGIN_NAME,
PLUGIN_NAME);
Copy link
Collaborator

Choose a reason for hiding this comment

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

If passing plugin_name is Ok in the place of plugin_id here then I would recommend not passing it and fixing the FailedBulkOperationConverter to just take one plugin_name

Copy link
Member Author

Choose a reason for hiding this comment

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

changed

configurationMetadata.put("authentication", Map.of("username", TEST_USERNAME, "password", TEST_PASSWORD));
final PluginSetting pluginSetting = getPluginSettingByConfigurationMetadata(configurationMetadata);
assertThrows(IllegalStateException.class,
() -> ConnectionConfiguration.readConnectionConfiguration(pluginSetting));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are these two tests not applicable anymore?

Copy link
Member Author

Choose a reason for hiding this comment

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

The "authentication: username: password:" fields were removed since they aren't listed in the documentation, and "username: password:" already exist separately. Also part of the goal of the migration was to not allow people to put in fields that weren't valid in the configuration and I was under the impression that these fields are not supposed to be valid. since they were removed the tests arent needed anymore

Copy link
Collaborator

Choose a reason for hiding this comment

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

@dlvenable Are you OK with this?

final OpenSearchSink objectUnderTest2 = createObjectUnderTest();
assertThat(objectUnderTest2.getDocument(event).getPipelineField(), equalTo(Optional.of(pipelineValue)));
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is this test removed?

Copy link
Member Author

Choose a reason for hiding this comment

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

PipelineField is always null because of this comment. So test is no longer necessary
#5273 (comment)

metadata.put(PIPELINE, expectedPipelineValue);
final PluginSetting pluginSetting = getPluginSetting(metadata);
final IndexConfiguration indexConfiguration = IndexConfiguration.readIndexConfig(pluginSetting);
assertEquals(expectedPipelineValue, indexConfiguration.getPipeline());
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is this test removed?

Copy link
Member Author

Choose a reason for hiding this comment

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

pipeline value is no longer retrieved from indexConfiguration, comes from pipelineDescription now

final IndexConfiguration indexConfiguration = IndexConfiguration.readIndexConfig(pluginSetting);
assertEquals(expectedRoutingFieldValue, indexConfiguration.getRoutingField());
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is this test removed?

Copy link
Member Author

Choose a reason for hiding this comment

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

forgot to re-add when routing Field was put back. readding

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks!

Signed-off-by: Maxwell Brown <[email protected]>
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.

5 participants