Verify tool: process v1 sectors in disk order
authorJakob Cornell <jakob+gpg@jcornell.net>
Sat, 9 Apr 2022 21:30:42 +0000 (17:30 -0400)
committerJakob Cornell <jakob+gpg@jcornell.net>
Sat, 9 Apr 2022 21:30:42 +0000 (17:30 -0400)
disk_jumble/src/disk_jumble/db.py
disk_jumble/src/disk_jumble/verify.py

index 278d12dc6444eb823fa44757d1b0e1a3fbffeda9..4a82ebad4d703905ec157e9e8a8ad123e26ad102 100644 (file)
@@ -107,7 +107,7 @@ class Wrapper:
                                        )
                                        and (incomplete_edge.end_off - slab.entity_offset) %% %(sector_size)s = 0
                        where disk_id = %(disk_id)s
-                       order by slab.entity_id, entity_offset, slab_id
+                       order by disk_blocks
                        ;
                """
                with self.conn.cursor() as cursor:
index 2f61e3c5b6d1a769aab708b87d3a08ac4436f770..759876f452810ba181a74b3e67efb6924a025c9c 100644 (file)
@@ -44,7 +44,7 @@ class _BadSector(Exception):
        pass
 
 
-def do_verify(conn, disk_id: int, sector_size: int, disk_file: io.BufferedIOBase, read_size: int, read_tries: int) -> None:
+def do_verify_v1(conn, disk_id: int, sector_size: int, disk_file: io.BufferedIOBase, read_size: int, read_tries: int) -> None:
        db = DbWrapper(conn)
 
        tasks = []
@@ -274,7 +274,7 @@ def _gen_verify_results(conn, disk_id: int, disk_file: io.BufferedIOBase, read_s
                                                slab_plus.entity_id = elh.entity_id
                                                and slab_plus.entity_blocks && elh.block_range
                                        )
-                                       left outer join public.entity on elh.entity_id=entity.entity_id
+                                       left outer join public.entity on elh.entity_id = entity.entity_id
                                )
                                where slab_plus.disk_id = %(disk_id)s
                                order by sector
@@ -382,5 +382,5 @@ if __name__ == "__main__":
                conn.autocommit = True
                path = f"/dev/mapper/diskjumble-{args.disk_id}"
                with open(path, "rb", buffering = _READ_BUFFER_SIZE) as disk_file:
-                       do_verify(conn, args.disk_id, SECTOR_SIZE, disk_file, _READ_BUFFER_SIZE, args.read_tries)
+                       do_verify_v1(conn, args.disk_id, SECTOR_SIZE, disk_file, _READ_BUFFER_SIZE, args.read_tries)
                        do_verify_v2(conn, args.disk_id, disk_file, _READ_BUFFER_SIZE, args.read_tries)