Skip to content

Conversation

@paf31
Copy link

@paf31 paf31 commented Oct 27, 2020

@rakeshkky Please let me know what you think. There are a few TODO items that I'm not sure about.


schemaCacheE <- runExceptT
$ peelMetadataRun (RunCtx adminUserInfo httpManager sqlGenCtx) metadata
$ peelMetadataRun (RunCtx adminUserInfo httpManager sqlGenCtx {- TODO: -} defaultResolveCustomSource) metadata
Copy link
Owner

Choose a reason for hiding this comment

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

Here, we initialize and build the RebuildableSchemaCache for the OSS server. No other customization exist (via type classes). We can use default here for OSS.

Copy link
Author

Choose a reason for hiding this comment

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

Isn't this also where we build the cache for Pro then? So wouldn't we need to add the type class here?

Copy link
Author

Choose a reason for hiding this comment

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

Or do you mean it's just the connection used to read the Postgres metadata? I guess what I'm asking is - will the ResolvedSources be stored in the schema cache?

Copy link
Owner

@rakeshkky rakeshkky Oct 29, 2020

Choose a reason for hiding this comment

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

Isn't this also where we build the cache for Pro then?

I'm not sure about this. If yes, then we should add the type class here too.

runAsAdmin sqlGenCtx httpManager metadata m =
fmap (fmap fst) $ runExceptT $
peelMetadataRun (RunCtx adminUserInfo httpManager sqlGenCtx) metadata m
peelMetadataRun (RunCtx adminUserInfo httpManager sqlGenCtx {- TODO: -} defaultResolveCustomSource) metadata m
Copy link
Owner

@rakeshkky rakeshkky Oct 28, 2020

Choose a reason for hiding this comment

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

Here too we can use the default one.

Just jVal -> decodeValue jVal
Nothing -> throw400 InvalidJSON "invalid json"
let runCtx = RunCtx adminUserInfo httpManager (SQLGenCtx False)
let runCtx = RunCtx adminUserInfo httpManager (SQLGenCtx False) {- TODO: -} defaultResolveCustomSource
Copy link
Owner

Choose a reason for hiding this comment

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

Here too we can use the default one.

let tableMetadatas = mapFromL _tmTable $ HM.elems postRelMap
sources = HM.singleton defaultSource $
SourceMetadata defaultSource tableMetadatas functions defaultSourceConfig
SourceMetadata defaultSource tableMetadatas functions defaultSourceConfig [] {- TODO: not sure what to do here -}
Copy link
Owner

Choose a reason for hiding this comment

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

I do think there's no notion of read_replicas in the OSS server before. This line of code is trying to migrate the metadata of the older single source database to the newer multi source support. Hence we can safely use [] which specifies there's no read_replica configuration.

@paf31
Copy link
Author

paf31 commented Oct 30, 2020

I'm going to wait until the monorepo merge is done, and then pick this back up. Hopefully it should be easier to collaborate on a single shared branch at that point. cc @ecthiender

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants