Skip to content

Commit

Permalink
Fix double detach (#252)
Browse files Browse the repository at this point in the history
* fix problem

* up msg
  • Loading branch information
k-morozov authored Nov 5, 2024
1 parent 707e6ff commit 6360f35
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions ch_tools/chadmin/cli/data_store_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,12 +397,15 @@ def detect_broken_partitions(ctx, root_path, reattach, detach):
repaired_partitions.add(table_partition)

logging.debug(
"Add part to check with path={}, table={}, partition={}",
"Found the partition with missing blob in the object storage: path={} table={} partition={} ",
path,
table_partition.table,
table_partition.partition,
)
try_repair_partition(ctx, table_partition, detach, reattach)
if detach:
try_repair_partition(ctx, table_partition, False)
elif reattach:
try_repair_partition(ctx, table_partition)
else:
logging.debug(
"Partition {} for table {} was already repared. Skip.",
Expand All @@ -421,16 +424,15 @@ def detect_broken_partitions(ctx, root_path, reattach, detach):


def try_repair_partition(
ctx: Context, table_partition: TablePartition, detach: bool, attach: bool
ctx: Context, table_partition: TablePartition, attach: bool = True
) -> None:
"""
Try to repair broken partition with DETACH and ATTACH.
Try to repair broken partition with DETACH and optional ATTACH.
"""
if detach:
detach_partition(ctx, table_partition)
detach_partition(ctx, table_partition)

if attach:
detach_partition(ctx, table_partition)
attach_partition(ctx, table_partition)


def check_key_in_object_storage(s3_client: boto3.client, bucket: str, key: str) -> bool:
Expand Down

0 comments on commit 6360f35

Please sign in to comment.