Verify: convert block size assertion to warning
authorJakob Cornell <jakob+gpg@jcornell.net>
Fri, 17 Jun 2022 02:35:40 +0000 (21:35 -0500)
committerJakob Cornell <jakob+gpg@jcornell.net>
Fri, 17 Jun 2022 02:35:40 +0000 (21:35 -0500)
disk_jumble/src/disk_jumble/verify.py

index db1bcdcbcf5c12d44032865cedb635e6585494b2..2ed32f245d2bc475231c590aef185cdd38333398 100644 (file)
@@ -1,6 +1,7 @@
 from __future__ import annotations
 from dataclasses import dataclass
 from typing import Iterator, List, Optional
+from warnings import warn
 import argparse
 import contextlib
 import hashlib
@@ -125,7 +126,8 @@ def _get_v1_worklist(conn, disk_id: int, target_ranges: List[NumericRange]) -> L
        ]
 
        for i in infos:
-               assert i.piece_length % BLOCK_SIZE == 0, f"entity {i.id.hex()} has invalid piece length"
+               if i.piece_length % BLOCK_SIZE != 0:
+                       warn(f"entity {i.id.hex()} has invalid piece length")
 
        runs = []
        cursor = conn.cursor()