Skip to content

Commit 898dba7

Browse files
committed
Update logging
1 parent 7808b11 commit 898dba7

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
_Whats new_
33
* Re-add support for legacy command-schema. ([#313](https://github.com/turbot/steampipe-postgres-fdw/issues/313))
44

5-
65
## v1.7.1 [2023-05-18]
76
Rebuild to avoid Linux Arm build error
87

fdw.go

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,6 @@ func goFdwBeginForeignScan(node *C.ForeignScanState, eflags C.int) {
188188
FdwError(fmt.Errorf("%v", r))
189189
}
190190
}()
191-
log.Printf("[TRACE] goFdwBeginForeignScan")
192191
// read the explain flag
193192
explain := eflags&C.EXEC_FLAG_EXPLAIN_ONLY == C.EXEC_FLAG_EXPLAIN_ONLY
194193

@@ -269,9 +268,10 @@ func goFdwIterateForeignScan(node *C.ForeignScanState) *C.TupleTableSlot {
269268
C.ExecClearTuple(slot)
270269
pluginHub, _ := hub.GetHub()
271270

271+
log.Printf("[INFO] goFdwIterateForeignScan, table '%s' (%p)", s.Opts["table"], s.Iter)
272272
// if the iterator has not started, start
273273
if s.Iter.Status() == hub.QueryStatusReady {
274-
log.Printf("[TRACE] goFdwIterateForeignScan calling pluginHub.StartScan")
274+
log.Printf("[INFO] goFdwIterateForeignScan calling pluginHub.StartScan, table '%s' (%p)", s.Opts["table"], s.Iter)
275275
if err := pluginHub.StartScan(s.Iter); err != nil {
276276
FdwError(err)
277277
return slot
@@ -281,12 +281,13 @@ func goFdwIterateForeignScan(node *C.ForeignScanState) *C.TupleTableSlot {
281281
// row is a map of column name to value (as an interface)
282282
row, err := s.Iter.Next()
283283
if err != nil {
284+
log.Printf("[INFO] goFdwIterateForeignScan Next returned error: %s (%p)", err.Error(), s.Iter)
284285
FdwError(err)
285286
return slot
286287
}
287288

288289
if len(row) == 0 {
289-
log.Printf("[TRACE] goFdwIterateForeignScan returned empty row - this scan complete (%p)", s.Iter)
290+
log.Printf("[INFO] goFdwIterateForeignScan returned empty row - this scan complete (%p)", s.Iter)
290291
// add scan metadata to hub
291292
pluginHub.AddScanMetadata(s.Iter)
292293
logging.LogTime("[fdw] IterateForeignScan end")
@@ -333,7 +334,10 @@ func goFdwReScanForeignScan(node *C.ForeignScanState) {
333334
FdwError(fmt.Errorf("%v", r))
334335
}
335336
}()
336-
log.Printf("[TRACE] goFdwReScanForeignScan")
337+
rel := BuildRelation(node.ss.ss_currentRelation)
338+
opts := GetFTableOptions(rel.ID)
339+
340+
log.Printf("[INFO] goFdwReScanForeignScan, connection '%s', table '%s'", opts["connection"], opts["table"])
337341
// restart the scan
338342
goFdwBeginForeignScan(node, 0)
339343
}
@@ -349,11 +353,12 @@ func goFdwEndForeignScan(node *C.ForeignScanState) {
349353
s := GetExecState(node.fdw_state)
350354
pluginHub, _ := hub.GetHub()
351355
if s != nil && pluginHub != nil {
352-
log.Printf("[TRACE] goFdwEndForeignScan, iterator: %p", s.Iter)
356+
log.Printf("[INFO] goFdwEndForeignScan, iterator: %p", s.Iter)
353357
pluginHub.EndScan(s.Iter, int64(s.State.limit))
354358
}
355359
ClearExecState(node.fdw_state)
356360
node.fdw_state = nil
361+
357362
}
358363

359364
//export goFdwAbortCallback
@@ -364,7 +369,7 @@ func goFdwAbortCallback() {
364369
// DO NOT call FdwError or we will recurse
365370
}
366371
}()
367-
log.Printf("[TRACE] goFdwAbortCallback")
372+
log.Printf("[INFO] goFdwAbortCallback")
368373
if pluginHub, err := hub.GetHub(); err == nil {
369374
pluginHub.Abort()
370375
}

hub/hub.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ func (h *Hub) Close() {
244244

245245
// Abort shuts down currently running queries
246246
func (h *Hub) Abort() {
247-
log.Printf("[TRACE] Hub Abort")
247+
log.Printf("[INFO] Hub Abort")
248248
// for all running iterators
249249
for _, iter := range h.runningIterators {
250250
// read the scan metadata from the iterator and add to our stack

0 commit comments

Comments
 (0)