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 breaking changes in config index fields #2882

Merged
merged 3 commits into from
Sep 4, 2024

Conversation

rbhavna
Copy link
Collaborator

@rbhavna rbhavna commented Sep 3, 2024

Description

fix breaking changes in config index fields

Related Issues

Resolves #[Issue number to be closed when this PR is merged]

Check List

  • New functionality includes testing.
  • New functionality has been documented.
  • API changes companion pull request created.
  • Commits are signed per the DCO using --signoff.
  • Public documentation issue/PR created.

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.

@@ -42,55 +42,93 @@ public class MLConfig implements ToXContentObject, Writeable {
@Setter
private String type;

@Setter
private String configType;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add some comment like this is a new field to replace type field ?

}

@Override
public void writeTo(StreamOutput out) throws IOException {
out.writeOptionalString(type);
out.writeOptionalString(configType);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we consider OS versions ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah I think so. There are going to be like completely new fields now. Not replacing the old ones

Signed-off-by: Bhavana Ramaram <[email protected]>
@rbhavna rbhavna temporarily deployed to ml-commons-cicd-env September 4, 2024 00:21 — with GitHub Actions Inactive
@rbhavna rbhavna temporarily deployed to ml-commons-cicd-env September 4, 2024 00:22 — with GitHub Actions Inactive
out.writeBoolean(false);
}
}
out.writeOptionalInstant(lastUpdatedTime);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why not add this new field to if block above?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

sure, missed it somehow

Signed-off-by: Bhavana Ramaram <[email protected]>
@rbhavna rbhavna temporarily deployed to ml-commons-cicd-env September 4, 2024 00:29 — with GitHub Actions Inactive
@rbhavna rbhavna had a problem deploying to ml-commons-cicd-env September 4, 2024 00:29 — with GitHub Actions Failure
Comment on lines 124 to +134
if (type != null) {
builder.field(CONFIG_TYPE_FIELD, type);
builder.field(TYPE_FIELD, type);
}
if (configType != null) {
builder.field(CONFIG_TYPE_FIELD, configType);
}
if (configuration != null) {
builder.field(ML_CONFIGURATION_FIELD, configuration);
builder.field(CONFIGURATION_FIELD, configuration);
}
if (mlConfiguration != null) {
builder.field(ML_CONFIGURATION_FIELD, mlConfiguration);
Copy link
Member

Choose a reason for hiding this comment

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

What happens when ml_configuration and configuration are both populated. Same with config_type and config? Will this cause any issues in the plugin?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No there wouldn't be any issue but both will be shown in the response.

}

public MLConfig(StreamInput input) throws IOException {
Version streamInputVersion = input.getVersion();
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this be optional since it was not there in previous versions for upgrades?

}

public MLConfig(StreamInput input) throws IOException {
Version streamInputVersion = input.getVersion();
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this be optional since it was not there in previous versions for upgrades?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I didn't quite get it. This is only to ensure these new fields can be used only on domains starting from 2.15

Copy link
Member

Choose a reason for hiding this comment

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

Oh nevermind, I had made some confusion with the parse function. There should be no issues here.

}

public MLConfig(StreamInput input) throws IOException {
Version streamInputVersion = input.getVersion();
Copy link
Member

Choose a reason for hiding this comment

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

Oh nevermind, I had made some confusion with the parse function. There should be no issues here.

@rbhavna rbhavna had a problem deploying to ml-commons-cicd-env September 4, 2024 02:56 — with GitHub Actions Failure
@rbhavna rbhavna merged commit cc402b3 into opensearch-project:main Sep 4, 2024
5 of 6 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Sep 4, 2024
* fix breaking changes in config index fields

Signed-off-by: Bhavana Ramaram <[email protected]>
(cherry picked from commit cc402b3)
@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.15 failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-2.15 2.15
# Navigate to the new working tree
cd .worktrees/backport-2.15
# Create a new branch
git switch --create backport/backport-2882-to-2.15
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 cc402b30d317f0830f9baccdf57c1a663f54a538
# Push it to GitHub
git push --set-upstream origin backport/backport-2882-to-2.15
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.15

Then, create a pull request where the base branch is 2.15 and the compare/head branch is backport/backport-2882-to-2.15.

@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.16 failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-2.16 2.16
# Navigate to the new working tree
cd .worktrees/backport-2.16
# Create a new branch
git switch --create backport/backport-2882-to-2.16
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 cc402b30d317f0830f9baccdf57c1a663f54a538
# Push it to GitHub
git push --set-upstream origin backport/backport-2882-to-2.16
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.16

Then, create a pull request where the base branch is 2.16 and the compare/head branch is backport/backport-2882-to-2.16.

opensearch-trigger-bot bot pushed a commit that referenced this pull request Sep 4, 2024
* fix breaking changes in config index fields

Signed-off-by: Bhavana Ramaram <[email protected]>
(cherry picked from commit cc402b3)
builder.field(TYPE_FIELD, type);
}
if (configType != null) {
builder.field(CONFIG_TYPE_FIELD, configType);
Copy link
Collaborator

@ylwu-amzn ylwu-amzn Sep 4, 2024

Choose a reason for hiding this comment

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

if (configType != null || type != null) {
    builder.field(TYPE_FIELD, configType == null ? type : configType);
}

ylwu-amzn pushed a commit that referenced this pull request Sep 4, 2024
* fix breaking changes in config index fields

Signed-off-by: Bhavana Ramaram <[email protected]>
(cherry picked from commit cc402b3)

Co-authored-by: Bhavana Ramaram <[email protected]>
ylwu-amzn pushed a commit that referenced this pull request Sep 4, 2024
* fix breaking changes in config index fields

Signed-off-by: Bhavana Ramaram <[email protected]>
(cherry picked from commit cc402b3)

Co-authored-by: Bhavana Ramaram <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants