graph/db+sqldb: make node migration idempotent
In this commit, the graph SQL migration is updated so that the node migration step is retry-safe. This is done by using migration specific logic & queries that do not use the same node-update-constraint as the normal node upsert logic. For normal "run-time" logic, we always expect a node update to have a newer timestamp than any previously stored one. But for the migration, we will only ever be dealing with a single announcement for a given node & to make things retry-safe, we dont want the query to error if we re-insert the exact same node.
This commit is contained in:
6 files changed
+175
-5
No files matched your search
@@ -153,6 +153,16 @@ type SQLQueries interface {
|
||||
InsertClosedChannel(ctx context.Context, scid []byte) error
|
||||
IsClosedChannel(ctx context.Context, scid []byte) (bool, error)
|
||||
GetClosedChannelsSCIDs(ctx context.Context, scids [][]byte) ([][]byte, error)
|
||||
|
||||
/*
|
||||
Migration specific queries.
|
||||
|
||||
NOTE: these should not be used in code other than migrations.
|
||||
Once sqldbv2 is in place, these can be removed from this struct
|
||||
as then migrations will have their own dedicated queries
|
||||
structs.
|
||||
*/
|
||||
InsertNodeMig(ctx context.Context, arg sqlc.InsertNodeMigParams) (int64, error)
|
||||
}
|
||||
|
||||
// BatchedSQLQueries is a version of SQLQueries that's capable of batched
|
||||
|
||||
Reference in new issue
Block a user