Verify tool: add column lists to DB insert statements
authorJakob Cornell <jakob+gpg@jcornell.net>
Sat, 16 Apr 2022 22:03:20 +0000 (17:03 -0500)
committerJakob Cornell <jakob+gpg@jcornell.net>
Sat, 16 Apr 2022 22:03:20 +0000 (17:03 -0500)
disk_jumble/src/disk_jumble/verify.py

index a11a78903b145c25fc1968c3daca4548b3b3bb52..f5db00287fadfa5d69d816c6385ab77ab672957c 100644 (file)
@@ -342,7 +342,10 @@ def _do_verify(conn, disk_id: int, block_ranges: Optional[List[range]], disk_fil
        for result in merge_results(generate_results()):
                if isinstance(result, Pass):
                        cursor.execute(
-                               "insert into diskjumble.verify_pass values (default, %s, %s, %s)",
+                               """
+                                       insert into diskjumble.verify_pass (verify_pass_id, at, disk_id, disk_sectors)
+                                       values (default, %s, %s, %s)
+                               """,
                                (ts, disk_id, result.blocks)
                        )
                else:
@@ -352,18 +355,18 @@ def _do_verify(conn, disk_id: int, block_ranges: Optional[List[range]], disk_fil
                                """
                                        with
                                                new_piece as (
-                                                       insert into diskjumble.verify_piece
+                                                       insert into diskjumble.verify_piece (verify_id, at, entity_id, piece)
                                                        values (default, %(ts)s, %(entity_id)s, %(piece_num)s)
                                                        returning verify_id
                                                ),
                                                _ as (
-                                                       insert into diskjumble.verify_piece_content
+                                                       insert into diskjumble.verify_piece_content (verify_id, seq, disk_id, disk_sectors)
                                                        select verify_id, ordinality - 1, %(disk_id)s, block_range
                                                        from
                                                                new_piece,
                                                                unnest(%(ranges)) with ordinality as block_range
                                                )
-                                       insert into diskjumble.verify_piece_fail
+                                       insert into diskjumble.verify_piece_fail (verify_id)
                                        select verify_id from new_piece
                                """,
                                {