steampipe-postgres-fdw
steampipe-postgres-fdw copied to clipboard
Should a get by ID return from the cache of a prior list call?
I'm using v0.7.2 of steampipe and v1.4.1 of the SDK in development.
I have this definition for a table:
func tableFastlyService(ctx context.Context) *plugin.Table {
return &plugin.Table{
Name: "fastly_service",
Description: "Services in the Fastly account.",
List: &plugin.ListConfig{
Hydrate: listService,
},
Get: &plugin.GetConfig{
Hydrate: getService,
KeyColumns: plugin.SingleColumn("id"),
},
I was surprised that this sequence could happen:
> .cache clear
> select * from fastly_service
+------------------------+------+----------------+---------+---------------------+------------------------+------------+--------------+---------------------+
| id | name | active_version | comment | created_at | customer_id | deleted_at | service_type | updated_at |
+------------------------+------+----------------+---------+---------------------+------------------------+------------+--------------+---------------------+
| 1crADDWV5PmZEabiZ9FsJT | Test | 2 | <null> | 2021-08-02 04:04:49 | 2Lz5xBE7r4g5BklvQlrtoP | <null> | vcl | 2021-08-02 04:04:58 |
+------------------------+------+----------------+---------+---------------------+------------------------+------------+--------------+---------------------+
> select * from fastly_service where id = '1crADDWV5PmZEabiZ9FsJT'
+------------------------+------+----------------+---------+---------------------+------------------------+------------+--------------+---------------------+
| id | name | active_version | comment | created_at | customer_id | deleted_at | service_type | updated_at |
+------------------------+------+----------------+---------+---------------------+------------------------+------------+--------------+---------------------+
| 1crADDWV5PmZEabiZ9FsJT | Test | <null> | <null> | 2021-08-02 04:04:49 | 2Lz5xBE7r4g5BklvQlrtoP | <null> | vcl | 2021-08-02 04:04:58 |
+------------------------+------+----------------+---------+---------------------+------------------------+------------+--------------+---------------------+
>
Here is the log:
2021-08-07 09:34:35.737 EDT [13077] LOG: statement: COMMIT
2021-08-07 09:34:37.760 EDT [13077] LOG: statement: BEGIN READ WRITE
2021-08-07 09:34:37.761 EDT [13077] LOG: statement: select * from fastly_service
2021/08/07 09:34:37 [INFO]
******************************************************
steampipe postgres fdw init
******************************************************
2021/08/07 09:34:37 [INFO] Log level info
2021-08-07T09:34:37.783-0400 [INFO] hub: query cache created
2021-08-07T09:34:37.802-0400 [INFO] hub: goFdwBeginForeignScan, connection 'fastly', table 'fastly_service'
2021-08-07T09:34:37.802-0400 [INFO] hub: executing query for connection fastly, caching ENABLED with TTL 300 seconds
2021-08-07T09:34:37.802-0400 [INFO] hub: --------
2021-08-07T09:34:37.802-0400 [INFO] hub: no quals
2021-08-07T09:34:37.802-0400 [INFO] hub: --------
2021-08-07T09:34:37.802-0400 [INFO] hub: CACHE MISS - no index
2021-08-07T09:34:37.802-0400 [INFO] hub: StartScan
table: fastly_service
2021-08-07T09:34:38.202-0400 [INFO] hub: adding 1 rows to cache
2021-08-07 09:34:38.203 EDT [13077] LOG: statement: COMMIT
2021-08-07 09:34:40.637 EDT [13077] LOG: statement: BEGIN READ WRITE
2021-08-07 09:34:40.637 EDT [13077] LOG: statement: select * from fastly_service where id = '1crADDWV5PmZEabiZ9FsJT'
2021-08-07T09:34:40.637-0400 [INFO] hub: goFdwBeginForeignScan, connection 'fastly', table 'fastly_service'
2021-08-07T09:34:40.638-0400 [INFO] hub: executing query for connection fastly, caching ENABLED with TTL 300 seconds
2021-08-07T09:34:40.638-0400 [INFO] hub: connection 'fastly', table 'fastly_service', quals
----------------------------------------------------------------
Column: id, Operator: '=', Value: '1crADDWV5PmZEabiZ9FsJT'
----------------------------------------------------------------
2021-08-07T09:34:40.638-0400 [INFO] hub: CACHE MISS - no index
2021-08-07T09:34:40.638-0400 [INFO] hub: StartScan
table: fastly_service
2021-08-07T09:34:40.807-0400 [INFO] hub: adding 1 rows to cache
2021-08-07 09:34:40.807 EDT [13077] LOG: statement: COMMIT
2021-08-07T09:34:43.110-0400 [INFO] hub: 0 CACHE HITS
2021-08-07T09:34:43.110-0400 [INFO] hub: 2 CACHE MISSES
2021-08-07 09:34:43.226 EDT [13086] LOG: statement: ;
2021-08-07 09:34:43.226 EDT [13086] LOG: statement: select count(*) from pg_stat_activity where client_port IS NOT NULL and application_name='steampipe' and backend_type='client backend';
2021-08-07 09:34:43.282 EDT [13038] LOG: received smart shutdown request
2021-08-07 09:34:43.284 EDT [13038] LOG: background worker "logical replication launcher" (PID 13046) exited with exit code 1
2021-08-07 09:34:43.284 EDT [13042] LOG: shutting down
2021-08-07 09:34:43.294 EDT [13038] LOG: database system is shut down
Specifically, I'd expect the get by id query to return the result from the prior list call?
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.
This issue was closed because it has been stalled for 90 days with no activity.