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

feat: add connectionInfo.atlasMetadata.instanceSize COMPASS-8236 #6178

Merged
merged 5 commits into from
Sep 2, 2024

Conversation

lerouxb
Copy link
Contributor

@lerouxb lerouxb commented Aug 30, 2024

This just puts instanceSize on connectionInfo.atlasMetadata. Will add a hook that uses it in https://jira.mongodb.org/browse/COMPASS-8213

@github-actions github-actions bot added the feat label Aug 30, 2024
// TODO: I'm not sure that we should put instanceSize on here because
// right now we're only using it to calculate supportsRollingIndexes
instanceSize,
supportsRollingIndexes,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmm I'm now wondering if this should even be part of atlas metadata. Maybe it goes higher up somewhere more common to a connection. Then the ui can just check if the connection can do this thing without knowing about atlas 🤔

Copy link
Collaborator

@mcasimir mcasimir Sep 2, 2024

Choose a reason for hiding this comment

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

Good q, that would be somewhere in instance model probably? ConnectionInfo (with the exception of atlas cluster metadata) is an object that should be static cause it gets stored back to disk, probably not a great place for computed props at least as it is right now.

You make a very good point, I would consider it at the same level of "supportsTimeSeries" or other features that activates based on connection data.
Rather than adding this new pattern here it may be time we design one that we can apply consistently for other connection related feats as well.

To that point, did we consider having only the instance size here and have a useSupportsRollingIndexes(connectionInfo) (not necessarily a hook, that's just an example), or if we want to have it more generic maybe useConnectionSupports(feat, connectionInfo) helpers?

Copy link
Collaborator

@gribnoysup gribnoysup Sep 2, 2024

Choose a reason for hiding this comment

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

useConnectionSupports(feat, connectionInfo)

I like the idea of having this hook / an exported util method (we already know we'll at least have global sharding to check against connection, probably more things related to the atlas cluster size and type) and only having instanceSize on the connection info itself

that would be somewhere in instance model probably?

I think domain-wise this sort of flag fits in the InstanceModel. The only reason I'd probably suggest against that is that we all know that we'd need a refactor for the instance model to bring it closer architecturally to what connections storage is doing (maybe even having them as two slices of the same store, they mostly care about the same user actions and logic flows) and so I'd just keep any new flags away from the instance as we have a good enough alternative for how to handle this right now

Copy link
Collaborator

Choose a reason for hiding this comment

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

ah ok, then i wonder, is this an hint we need a service / hook like the others that we have, that doesn't even take the connection info but a connection id?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK I've removed it and I'm putting just instanceSize here now. Then it can be checked in the generic hook useConnectionSupports() or in useSupportsRollingIndexCreation(), depending on what we decide on. I got a separate ticket for a/the hook: https://jira.mongodb.org/browse/COMPASS-8213

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As long as we don't have react components calculating these things themselves like in MMS, I'm happy ;)

Copy link
Collaborator

Choose a reason for hiding this comment

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

100%, this is like n. 1 thing we'd want to avoid 😄

@lerouxb lerouxb changed the title feat: add connectionInfo.atlasMetadata.supportsRollingIndexes feat: add connectionInfo.atlasMetadata.supportsRollingIndexes COMPASS-8236 Sep 2, 2024
@lerouxb lerouxb added the no release notes Fix or feature not for release notes label Sep 2, 2024
@lerouxb lerouxb changed the title feat: add connectionInfo.atlasMetadata.supportsRollingIndexes COMPASS-8236 feat: add connectionInfo.atlasMetadata.instanceSize COMPASS-8236 Sep 2, 2024
@lerouxb lerouxb marked this pull request as ready for review September 2, 2024 10:49
@@ -20,8 +21,10 @@ const deployment = {
],
};

type Test = [string, ClusterDescriptionWithDataProcessingRegion, string];
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 couldn't get TypeScript to be happy with defining this as const, so I ended up just explicitly giving it a type.

function getInstanceSize(
clusterDescription: ClusterDescription
): string | undefined {
return getFirstInstanceSize(clusterDescription.replicationSpecList);
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 copied this kinda literally from MMS code, but I suppose I might as well roll getInstanceSize in here.

@lerouxb lerouxb merged commit d846b32 into main Sep 2, 2024
25 of 27 checks passed
@lerouxb lerouxb deleted the add-supportsRollingIndexes branch September 2, 2024 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat no release notes Fix or feature not for release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants