From 4409fa44d36d571c42ad503576816e6562c86831 Mon Sep 17 00:00:00 2001 From: Puskar Basu <45908484+pskrbasu@users.noreply.github.com> Date: Thu, 1 Aug 2024 20:26:18 +0530 Subject: [PATCH] Fix caching in standalone FDW extension. Closes #480 --- fdw.go | 13 +------------ hub/hub_local.go | 1 + 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/fdw.go b/fdw.go index 889a55af..c81140b5 100644 --- a/fdw.go +++ b/fdw.go @@ -133,20 +133,9 @@ func goFdwGetRelSize(state *C.FdwPlanState, root *C.PlannerInfo, rows *C.double, pluginHub := hub.GetHub() - // get connection name - connName := GetSchemaNameFromForeignTableId(types.Oid(state.foreigntableid)) - - log.Println("[TRACE] connection name:", connName) - - serverOpts := GetForeignServerOptionsFromFTableId(types.Oid(state.foreigntableid)) - err := pluginHub.ProcessImportForeignSchemaOptions(serverOpts, connName) - if err != nil { - FdwError(sperr.WrapWithMessage(err, "failed to process options")) - } - // reload connection config // TODO remove need for fdw to load connection config - _, err = pluginHub.LoadConnectionConfig() + _, err := pluginHub.LoadConnectionConfig() if err != nil { log.Printf("[ERROR] LoadConnectionConfig failed %v ", err) FdwError(err) diff --git a/hub/hub_local.go b/hub/hub_local.go index c49341de..46c53802 100644 --- a/hub/hub_local.go +++ b/hub/hub_local.go @@ -155,6 +155,7 @@ func (l *HubLocal) ProcessImportForeignSchemaOptions(opts types.Options, connect // do we already have this connection connectionConfig, ok := l.connections[connection] if ok { + log.Println("[INFO] connection already exists, updating ") // we have already set the config - update it connectionConfig.Config = config return l.UpdateConnectionConfig(connection, config)