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

[Refactor] XContentFactory contentType introspection to MediaTypeRegistry #8826

Merged
merged 1 commit into from
Jul 28, 2023

Conversation

nknize
Copy link
Collaborator

@nknize nknize commented Jul 21, 2023

XContentFactory is tightly coupled to concrete XContentType. This PR builds on the MediaType abstractions, specifically MediaTypeRegistry, to decouple contentType( introspection (e.g., determining type from byte streams) from concrete XContentType implementations. This removes the tight coupling of :libs:opensearch-x-content with abstract interface contracts currently defined in :server further enabling the ability to refactor those contracts from :server to the proper library for modularity and extensibility.

relates #5910
relates #8110

depends on #8636

@nknize
Copy link
Collaborator Author

nknize commented Jul 21, 2023

Reminder: this PR is larger than it's actual change because it includes (depends on) #8636

@nknize
Copy link
Collaborator Author

nknize commented Jul 21, 2023

I ran across a flaky test w/ RemoteFSTranslogTests when running :server:test locally. It does not repro on it's own (hence "flaky") so I could not chase the failure.

./gradlew ':server:test' --tests "org.opensearch.index.translog.RemoteFSTranslogTests.testConcurrentWriteViewsAndSnapshot" -Dtests.seed=11209ED8456F2E6A -Dtests.security.manager=true -Dtests.jvm.argline="-XX:TieredStopAtLevel=1 -XX:ReservedCodeCacheSize=64m" -Dtests.locale=sr-ME -Dtests.timezone=Pacific/Johnston -Druntime.java=20

I documented this on #5823 for posterity.

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@nknize nknize force-pushed the xcontentFactoryAbstraction branch from f2da36a to d3787ae Compare July 21, 2023 23:35
@nknize nknize force-pushed the xcontentFactoryAbstraction branch from e6cf81f to bdecf35 Compare July 28, 2023 15:39
@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

…erRegistry

XContentFactory is tightly coupled to concrete XContentType. This commit
builds on the MediaType abstractions, specifically
MediaTypeParserRegistry, to decouple contentType introspection (e.g.,
determining type from byte streams) from concrete XContentTypes. This
enables downstream extensions (e.g., serverless or cloud native
implementations) to register their own custom XContentType and define
the serialization format for proper content introspection. This also
removes the tight coupling of :libs:opensearch-x-content with abstract
interface contracts further enabling modularity.

Signed-off-by: Nicholas Walter Knize <nknize@apache.org>
@nknize nknize force-pushed the xcontentFactoryAbstraction branch from bdecf35 to 4899c0d Compare July 28, 2023 18:16
@nknize
Copy link
Collaborator Author

nknize commented Jul 28, 2023

@reta this one will be ready to go as well

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@reta reta merged commit 36c37ac into opensearch-project:main Jul 28, 2023
baba-devv pushed a commit to baba-devv/OpenSearch that referenced this pull request Jul 28, 2023
…erRegistry (opensearch-project#8826)

XContentFactory is tightly coupled to concrete XContentType. This commit
builds on the MediaType abstractions, specifically
MediaTypeParserRegistry, to decouple contentType introspection (e.g.,
determining type from byte streams) from concrete XContentTypes. This
enables downstream extensions (e.g., serverless or cloud native
implementations) to register their own custom XContentType and define
the serialization format for proper content introspection. This also
removes the tight coupling of :libs:opensearch-x-content with abstract
interface contracts further enabling modularity.

Signed-off-by: Nicholas Walter Knize <nknize@apache.org>
baba-devv pushed a commit to baba-devv/OpenSearch that referenced this pull request Jul 29, 2023
…erRegistry (opensearch-project#8826)

XContentFactory is tightly coupled to concrete XContentType. This commit
builds on the MediaType abstractions, specifically
MediaTypeParserRegistry, to decouple contentType introspection (e.g.,
determining type from byte streams) from concrete XContentTypes. This
enables downstream extensions (e.g., serverless or cloud native
implementations) to register their own custom XContentType and define
the serialization format for proper content introspection. This also
removes the tight coupling of :libs:opensearch-x-content with abstract
interface contracts further enabling modularity.

Signed-off-by: Nicholas Walter Knize <nknize@apache.org>
willyborankin pushed a commit to opensearch-project/security that referenced this pull request Jul 31, 2023
…3069)

There are multiple PRs in core affecting the security plugin that the
security plugin needs to adapt to.

- opensearch-project/OpenSearch#7792
- opensearch-project/OpenSearch#8826
- opensearch-project/OpenSearch#8668

I am opening a Draft PR that includes a fix for the Lucene-related test
failures which was caused by
opensearch-project/OpenSearch#7792

Resolves: #3064

Signed-off-by: Craig Perkins <cwperx@amazon.com>
cwperks added a commit to cwperks/security that referenced this pull request Jul 31, 2023
…pensearch-project#3069)

There are multiple PRs in core affecting the security plugin that the
security plugin needs to adapt to.

- opensearch-project/OpenSearch#7792
- opensearch-project/OpenSearch#8826
- opensearch-project/OpenSearch#8668

I am opening a Draft PR that includes a fix for the Lucene-related test
failures which was caused by
opensearch-project/OpenSearch#7792

Resolves: opensearch-project#3064

Signed-off-by: Craig Perkins <cwperx@amazon.com>
(cherry picked from commit 08d1734)
@nknize nknize added the backport 2.x Backport to 2.x branch label Aug 1, 2023
@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.x failed:

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

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.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/backport-2.x
# Create a new branch
git switch --create backport/backport-8826-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 36c37ace30cdf9d2f92176a3aa38b60865c33056
# Push it to GitHub
git push --set-upstream origin backport/backport-8826-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/backport-2.x

Then, create a pull request where the base branch is 2.x and the compare/head branch is backport/backport-8826-to-2.x.

@nknize nknize added backport 2.x Backport to 2.x branch and removed backport 2.x Backport to 2.x branch labels Aug 1, 2023
@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.x failed:

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

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.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/backport-2.x
# Create a new branch
git switch --create backport/backport-8826-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 36c37ace30cdf9d2f92176a3aa38b60865c33056
# Push it to GitHub
git push --set-upstream origin backport/backport-8826-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/backport-2.x

Then, create a pull request where the base branch is 2.x and the compare/head branch is backport/backport-8826-to-2.x.

nknize added a commit to nknize/OpenSearch that referenced this pull request Aug 1, 2023
…erRegistry (opensearch-project#8826)

XContentFactory is tightly coupled to concrete XContentType. This commit
builds on the MediaType abstractions, specifically
MediaTypeParserRegistry, to decouple contentType introspection (e.g.,
determining type from byte streams) from concrete XContentTypes. This
enables downstream extensions (e.g., serverless or cloud native
implementations) to register their own custom XContentType and define
the serialization format for proper content introspection. This also
removes the tight coupling of :libs:opensearch-x-content with abstract
interface contracts further enabling modularity.

Signed-off-by: Nicholas Walter Knize <nknize@apache.org>
(cherry picked from commit 36c37ac)
reta pushed a commit that referenced this pull request Aug 1, 2023
…erRegistry (#8826) (#9050)

XContentFactory is tightly coupled to concrete XContentType. This commit
builds on the MediaType abstractions, specifically
MediaTypeParserRegistry, to decouple contentType introspection (e.g.,
determining type from byte streams) from concrete XContentTypes. This
enables downstream extensions (e.g., serverless or cloud native
implementations) to register their own custom XContentType and define
the serialization format for proper content introspection. This also
removes the tight coupling of :libs:opensearch-x-content with abstract
interface contracts further enabling modularity.

Signed-off-by: Nicholas Walter Knize <nknize@apache.org>
(cherry picked from commit 36c37ac)
kaushalmahi12 pushed a commit to kaushalmahi12/OpenSearch that referenced this pull request Sep 12, 2023
…erRegistry (opensearch-project#8826)

XContentFactory is tightly coupled to concrete XContentType. This commit
builds on the MediaType abstractions, specifically
MediaTypeParserRegistry, to decouple contentType introspection (e.g.,
determining type from byte streams) from concrete XContentTypes. This
enables downstream extensions (e.g., serverless or cloud native
implementations) to register their own custom XContentType and define
the serialization format for proper content introspection. This also
removes the tight coupling of :libs:opensearch-x-content with abstract
interface contracts further enabling modularity.

Signed-off-by: Nicholas Walter Knize <nknize@apache.org>
Signed-off-by: Kaushal Kumar <ravi.kaushal97@gmail.com>
brusic pushed a commit to brusic/OpenSearch that referenced this pull request Sep 25, 2023
…erRegistry (opensearch-project#8826)

XContentFactory is tightly coupled to concrete XContentType. This commit
builds on the MediaType abstractions, specifically
MediaTypeParserRegistry, to decouple contentType introspection (e.g.,
determining type from byte streams) from concrete XContentTypes. This
enables downstream extensions (e.g., serverless or cloud native
implementations) to register their own custom XContentType and define
the serialization format for proper content introspection. This also
removes the tight coupling of :libs:opensearch-x-content with abstract
interface contracts further enabling modularity.

Signed-off-by: Nicholas Walter Knize <nknize@apache.org>
Signed-off-by: Ivan Brusic <ivan.brusic@flocksafety.com>
shiv0408 pushed a commit to Gaurav614/OpenSearch that referenced this pull request Apr 25, 2024
…erRegistry (opensearch-project#8826)

XContentFactory is tightly coupled to concrete XContentType. This commit
builds on the MediaType abstractions, specifically
MediaTypeParserRegistry, to decouple contentType introspection (e.g.,
determining type from byte streams) from concrete XContentTypes. This
enables downstream extensions (e.g., serverless or cloud native
implementations) to register their own custom XContentType and define
the serialization format for proper content introspection. This also
removes the tight coupling of :libs:opensearch-x-content with abstract
interface contracts further enabling modularity.

Signed-off-by: Nicholas Walter Knize <nknize@apache.org>
Signed-off-by: Shivansh Arora <hishiv@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x Backport to 2.x branch enhancement Enhancement or improvement to existing feature or request pending backport Identifies an issue or PR that still needs to be backported skip-changelog v2.10.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants