mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-10-13 07:22:32 +00:00
ci: delete the benchmark S3 prefix one object at a time
boto3 now sends a CRC checksum instead of Content-MD5 with DeleteObjects, which the MinIO fixture of the smoke run rejects. DeleteObject needs neither and the prefix of one run holds at most a few thousand objects. Signed-off-by: jeremyhi <fengjiachun@gmail.com>
This commit is contained in:
@@ -153,14 +153,12 @@ def probe(args) -> None:
|
||||
|
||||
|
||||
def cleanup(args) -> None:
|
||||
# One DeleteObject per key: DeleteObjects needs a checksum header the MinIO fixture rejects.
|
||||
client, deleted = s3_client(args), 0
|
||||
for page in client.get_paginator("list_objects_v2").paginate(Bucket=args.bucket, Prefix=f"{args.prefix}/"):
|
||||
keys = [{"Key": item["Key"]} for item in page.get("Contents", [])]
|
||||
if keys:
|
||||
result = client.delete_objects(Bucket=args.bucket, Delete={"Objects": keys, "Quiet": True})
|
||||
if result.get("Errors"):
|
||||
raise RuntimeError(f"delete failed for {len(result['Errors'])} objects")
|
||||
deleted += len(keys)
|
||||
for item in page.get("Contents", []):
|
||||
client.delete_object(Bucket=args.bucket, Key=item["Key"])
|
||||
deleted += 1
|
||||
print(f"deleted {deleted} objects under s3://{args.bucket}/{args.prefix}/")
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user