Conversation
23916f0 to
bd95746
Compare
a2f8e39 to
2f3523d
Compare
c5c647d to
9c03560
Compare
This pulls in cosi-project/state-sqlite#2 This is just PoC for now, it misses the migration step. See siderolabs#1770 See siderolabs#1768 Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
This pulls in cosi-project/state-sqlite#2 This is just PoC for now, it misses the migration step. See siderolabs#1770 See siderolabs#1768 Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
|
|
||
| rows, err := st.db.QueryContext(ctx, `SELECT spec | ||
| FROM `+st.options.TablePrefix+`resources | ||
| WHERE namespace = ? AND type = ? AND `+filter.CompileLabelQueries(options.LabelQueries), |
There was a problem hiding this comment.
isn't this label query opening up to sql injection? shouldnt you parameterise it with ? ?
There was a problem hiding this comment.
not really, if you look into filter package - it creates a valid/escaped/quoted SQL which we inject here.
We can't use ? for a part of SQL query
There was a problem hiding this comment.
I updated with more tests which verify explicitly escaping
| // pick cutoff event ID based on max events to keep | ||
| cutoffEventID := maxEventID - int64(s.options.CompactMaxEvents) + 1 | ||
|
|
||
| // perform binary search on events table in the range [minEventID, cutoffEventID) |
There was a problem hiding this comment.
Couldn't we use index on the events timestamp and just select the events without filtering them on the client?
There was a problem hiding this comment.
we could, but this index would add overhead on each operation (insert, modify delete of resources) , while deleting lots of events from the table from my point of view is anyways closer to full scan, so we don't add extra indexes which will be hard to maintain due to high rate of changes to the table and the index
9c03560 to
d710fda
Compare
Initial implementation goal: pass conformance tests. Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
d710fda to
ff68677
Compare
|
/m |
1 similar comment
|
/m |
This pulls in cosi-project/state-sqlite#2 This is just PoC for now, it misses the migration step. See siderolabs#1770 See siderolabs#1768 Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
This pulls in cosi-project/state-sqlite#2 This is just PoC for now, it misses the migration step. See siderolabs#1770 See siderolabs#1768 Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
This pulls in cosi-project/state-sqlite#2 This is just PoC for now, it misses the migration step. See siderolabs#1770 See siderolabs#1768 Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
This pulls in cosi-project/state-sqlite#2 This is just PoC for now, it misses the migration step. See siderolabs#1770 See siderolabs#1768 Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
This pulls in cosi-project/state-sqlite#2 This is just PoC for now, it misses the migration step. See siderolabs#1770 See siderolabs#1768 Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
This pulls in cosi-project/state-sqlite#2 Fixes siderolabs#1770 See siderolabs#1768 Sample migration logs: ``` 2025-11-05T11:18:47.340Z ESC[34mINFOESC[0m omni/state_sqlite.go:122 migrated resources from BoltDB to SQLite {"namespace": "metrics" , "type": "EtcdBackupOverallStatuses.omni.sidero.dev", "count": 1} 2025-11-05T11:18:47.340Z ESC[34mINFOESC[0m omni/state_sqlite.go:122 migrated resources from BoltDB to SQLite {"namespace": "metrics" , "type": "EtcdBackupStatuses.omni.sidero.dev", "count": 0} 2025-11-05T11:18:47.342Z ESC[34mINFOESC[0m omni/state_sqlite.go:122 migrated resources from BoltDB to SQLite {"namespace": "metrics" , "type": "MachineStatusLinks.omni.sidero.dev", "count": 2} 2025-11-05T11:18:47.342Z ESC[34mINFOESC[0m omni/state_sqlite.go:67 removed old BoltDB database after migration {"path": "_out/secondary-storag e/bolt.db"} ``` Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
This pulls in cosi-project/state-sqlite#2 Fixes siderolabs#1770 See siderolabs#1768 Sample migration logs: ``` 2025-11-05T11:18:47.340Z ESC[34mINFOESC[0m omni/state_sqlite.go:122 migrated resources from BoltDB to SQLite {"namespace": "metrics" , "type": "EtcdBackupOverallStatuses.omni.sidero.dev", "count": 1} 2025-11-05T11:18:47.340Z ESC[34mINFOESC[0m omni/state_sqlite.go:122 migrated resources from BoltDB to SQLite {"namespace": "metrics" , "type": "EtcdBackupStatuses.omni.sidero.dev", "count": 0} 2025-11-05T11:18:47.342Z ESC[34mINFOESC[0m omni/state_sqlite.go:122 migrated resources from BoltDB to SQLite {"namespace": "metrics" , "type": "MachineStatusLinks.omni.sidero.dev", "count": 2} 2025-11-05T11:18:47.342Z ESC[34mINFOESC[0m omni/state_sqlite.go:67 removed old BoltDB database after migration {"path": "_out/secondary-storag e/bolt.db"} ``` Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
Initial implementation goal: pass conformance tests.
Pending items:
optimize list/watch queriesadd some benchmarksconsider some optimizations/tuningcompact events tableproper in-process notifications