Skip to content
This repository has been archived by the owner on Nov 14, 2024. It is now read-only.

[AtlasDB Proxy & DbKVS] Part 7: Allow Namespace Overrides for Oracle Connection Config #5942

Merged
merged 14 commits into from
Mar 15, 2022

Conversation

jeremyk-91
Copy link
Contributor

Goals (and why):
Pay down some legacy technical debt, and make configuration in atlasdb-proxy look smoother.
==COMMIT_MSG==
Users may now explicitly override the namespace of an Oracle connection configuration, which is usually the mechanism by which an individual AtlasDB user identifies itself (e.g. to timelock and possibly to the underlying key-value-service). This was previously automatically assumed to be the sid of the Oracle database; however, that is not actually the way an individual AtlasDB user identifies itself.
==COMMIT_MSG==

Implementation Description (bullets):

  • Allow explicit overriding of namespace while defaulting to the old behaviour; see above for discussion.

Testing (What was existing testing like? What have you done to improve it?):

  • Added tests for the new behaviour.

Concerns (what feedback would you like?):

  • This might be bad if someone has explicitly a useless override namespace: X in their config, though in the worst case it'll just mean that they throw as opposed to doing anything explicitly wrong.

Where should we start reviewing?: small

Priority (whenever / two weeks / yesterday): this week please

@jeremyk-91 jeremyk-91 requested review from Jolyon-S and gsheasby March 7, 2022 19:36
@changelog-app
Copy link

changelog-app bot commented Mar 7, 2022

Generate changelog in changelog/@unreleased

Type

  • Feature
  • Improvement
  • Fix
  • Break
  • Deprecation
  • Manual task
  • Migration

Description

Users may now explicitly override the namespace of a DB key value service configuration, which is usually the mechanism by which an individual AtlasDB user identifies itself (e.g. to timelock and possibly to the underlying key-value-service). This was previously automatically assumed to be the sid of the Oracle database or dbname of the Postgres database; however, that is not actually the way an individual AtlasDB user identifies itself in practice.

Check the box to generate changelog(s)

  • Generate changelog entry

Copy link
Contributor

@gsheasby gsheasby left a comment

Choose a reason for hiding this comment

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

Why would we throw if a useless namespace: X is specified? It looks like we would silently use X so far, although of course if there's some validation rules about namespace names, then it could end up being invalidated.

namespaceOverride(),
getSid(),
serviceNameConfiguration().map(ServiceNameConfiguration::namespaceOverride))
.filter(Optional::isPresent)
Copy link
Contributor

Choose a reason for hiding this comment

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

this is clever, but a bit arcane - worth a javadoc here explaining the order of precedence.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep, will add

}

public abstract Optional<String> namespaceOverride();
Copy link
Contributor

Choose a reason for hiding this comment

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

JsonProperty("namespace")? Or do we want oracleNamespace, to explicitly be different from the existing/C* config?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, no harm doing that. I think I went with override for explicit precedence order, though it's a fair argument saying it's implicit.

return getSid();
}
return serviceNameConfiguration().map(ServiceNameConfiguration::namespaceOverride);
return Stream.of(
Copy link
Contributor

Choose a reason for hiding this comment

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

do we want to log (at least at debug, to match other logs in this class) if namespaceOverride is present?

Similarly, noting that check enforces exactly one of sid and serviceNameConfiguration to be present, which may not be needed any more (although I don't have enough context to know if these params are required elsewhere).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we still want the check - the purpose of namespace is mainly to outline how we identify ourselves to timelock (notice that we don't actually reference this field anywhere else in the DbKVS code). It doesn't actually see any use in connecting to the db

... in which case it probably makes sense for this not to be here.

@jeremyk-91
Copy link
Contributor Author

Fair point on useless namespace: X - that is an artifact of the original version of the PR before I decided to pursue a different approach to avoid that risk altogether. I'll reply to the remainder of the comments on-thread

@jeremyk-91
Copy link
Contributor Author

discussed offline: On reflection, I think this should belong in the general DbKVS config as opposed to in the connection config, seeing as it doesn't actually influence the connections to the underlying database (as much as that's where it's computed in the current, incorrect model).

@bulldozer-bot bulldozer-bot bot merged commit 02f0c94 into develop Mar 15, 2022
@bulldozer-bot bulldozer-bot bot deleted the jkong/deprecating-inaccurate-oracle-namespacing branch March 15, 2022 11:37
@svc-autorelease
Copy link
Collaborator

Released 0.575.0

bulldozer-bot bot pushed a commit that referenced this pull request Mar 15, 2022
Although this is not a common operation, internal timelock implementation serializes KVS config, including that of Oracle. In #5942 we accidentally changed the _serialized_ form of the Oracle config. Note that this doesn't affect config _deserialization_, which covers most (non-timelock) AtlasDB users.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants