Skip to content

Oracle data volume following readonly convention#3908

Merged
danmoseley merged 3 commits intomicrosoft:mainfrom
cmdkeen:update-oracle-datavolume
Apr 29, 2024
Merged

Oracle data volume following readonly convention#3908
danmoseley merged 3 commits intomicrosoft:mainfrom
cmdkeen:update-oracle-datavolume

Conversation

@cmdkeen
Copy link
Copy Markdown
Contributor

@cmdkeen cmdkeen commented Apr 24, 2024

Closes #3907 - Oracle needs the data volume to be writeable. Following the convention on other database implementations to use a default false parameter.

Also fixes inconsistency between the readonly states of WithDataVolume and WithDataBindMount

Microsoft Reviewers: Open in CodeFlow

cmdkeen added 2 commits April 24, 2024 10:44
Following convention on other database implementations
Updating public API
@ghost ghost added the area-integrations Issues pertaining to Aspire Integrations packages label Apr 24, 2024
@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Apr 24, 2024
@cmdkeen
Copy link
Copy Markdown
Contributor Author

cmdkeen commented Apr 24, 2024

@dotnet-policy-service agree

@davidfowl davidfowl requested a review from mitchdenny April 24, 2024 14:09
Comment on lines +63 to +64
public static IResourceBuilder<OracleDatabaseServerResource> WithDataVolume(this IResourceBuilder<OracleDatabaseServerResource> builder, string? name = null, bool isReadOnly = false)
=> builder.WithVolume(name ?? VolumeNameGenerator.CreateVolumeName(builder, "data"), "/opt/oracle/oradata", isReadOnly);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This will be a source breaking change in 8.1, right? Default parameters are fine to add, but it changes the default. If this change is important, perhaps we need it in 8.0
@eerhardt

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

From my perspective the current default is hard broken - the default Oracle image does not come up if the data volume is mounted as read-only. I'll add a bit more detail on the linked issue.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If the current default is "hard broken", why are we making it an option at all? If someone passes isReadOnly: true wouldn't they be just as broken?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@cmdkeen I have the same question..?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If it isn't possible for the mount to be read only we should remove the read only option entirely.

@DamianEdwards do you know if the other container types we have any issues with read only volumes?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I believe some of them work if the volume already exists and has been initialized by a container of the same image already. The scenario is multiple containers using the same volume but only one has write access. That was the only reason we had an option for read only data volumes.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

OK thanks. Let me just confirm that also works with Oracle here and if it does we should keep the parameter (with isReadOnly = false as the default).

/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
public static IResourceBuilder<OracleDatabaseServerResource> WithDataVolume(this IResourceBuilder<OracleDatabaseServerResource> builder, string? name = null)
=> builder.WithVolume(name ?? VolumeNameGenerator.CreateVolumeName(builder, "data"), "/opt/oracle/oradata", true);
public static IResourceBuilder<OracleDatabaseServerResource> WithDataVolume(this IResourceBuilder<OracleDatabaseServerResource> builder, string? name = null, bool isReadOnly = false)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Are there any tests we can write for these APIs?

@davidfowl
Copy link
Copy Markdown
Contributor

Feels important to get this for GA since it's a breaking change

cc @mitchdenny

@danmoseley danmoseley added this to the GA milestone Apr 28, 2024
@mitchdenny
Copy link
Copy Markdown
Member

@cmdkeen I updated your PR to remove the isReadOnly flag entirely. There may be some voodoo that we can do to make Oracle support read-only volumes but it is safer for GA to not expose the property and pretend we have a working solution for it.

If/when we figure out readonly volume/bindmount support for Oracle then we can add it back in. And if someone is so inclined they can make this work themselves with the general purpose bind mount/volume methods.

/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
public static IResourceBuilder<OracleDatabaseServerResource> WithDataVolume(this IResourceBuilder<OracleDatabaseServerResource> builder, string? name = null)
=> builder.WithVolume(name ?? VolumeNameGenerator.CreateVolumeName(builder, "data"), "/opt/oracle/oradata", true);
=> builder.WithVolume(name ?? VolumeNameGenerator.CreateVolumeName(builder, "data"), "/opt/oracle/oradata", false);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nit, nice to name the parameter at the call site when passing a bool

@danmoseley danmoseley enabled auto-merge (squash) April 29, 2024 00:23
@danmoseley danmoseley merged commit d40d6a8 into microsoft:main Apr 29, 2024
@mitchdenny
Copy link
Copy Markdown
Member

/backport to release/8.0

@github-actions
Copy link
Copy Markdown
Contributor

Started backporting to release/8.0: https://github.com/dotnet/aspire/actions/runs/8871863329

@github-actions
Copy link
Copy Markdown
Contributor

@mitchdenny backporting to release/8.0 failed, the patch most likely resulted in conflicts:

$ git am --3way --ignore-whitespace --keep-non-patch changes.patch

Applying: Adding readonly default false
Applying: Update PublicAPI.Unshipped.txt
Using index info to reconstruct a base tree...
A	src/Aspire.Hosting.Oracle/PublicAPI.Unshipped.txt
Falling back to patching base and 3-way merge...
CONFLICT (modify/delete): src/Aspire.Hosting.Oracle/PublicAPI.Unshipped.txt deleted in HEAD and modified in Update PublicAPI.Unshipped.txt. Version Update PublicAPI.Unshipped.txt of src/Aspire.Hosting.Oracle/PublicAPI.Unshipped.txt left in tree.
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0002 Update PublicAPI.Unshipped.txt
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
Error: The process '/usr/bin/git' failed with exit code 128

Please backport manually!

@github-actions
Copy link
Copy Markdown
Contributor

@mitchdenny an error occurred while backporting to release/8.0, please check the run log for details!

Error: git am failed, most likely due to a merge conflict.

danmoseley pushed a commit that referenced this pull request Apr 29, 2024
Co-authored-by: Chris <cmdkeen@users.noreply.github.com>
@cmdkeen cmdkeen deleted the update-oracle-datavolume branch April 29, 2024 07:55
@cmdkeen
Copy link
Copy Markdown
Contributor Author

cmdkeen commented Apr 29, 2024

@cmdkeen I updated your PR to remove the isReadOnly flag entirely. There may be some voodoo that we can do to make Oracle support read-only volumes but it is safer for GA to not expose the property and pretend we have a working solution for it.

If/when we figure out readonly volume/bindmount support for Oracle then we can add it back in. And if someone is so inclined they can make this work themselves with the general purpose bind mount/volume methods.

Very happy, thanks for getting this in and sorted everyone. Absolutely agree that it is easy enough to do a read only volume via an underlying method if needed.

@github-actions github-actions Bot locked and limited conversation to collaborators Jun 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-integrations Issues pertaining to Aspire Integrations packages community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Oracle WithDataVolume should not be readonly

6 participants