-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Apple automation for bucket list causing abnormal client IO
Signed-off-by: Vidushi Mishra <[email protected]>
- Loading branch information
Showing
4 changed files
with
121 additions
and
0 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
rgw/v2/tests/s3_swift/configs/test_bucket_listing_fake_mp.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# CEPH-83605383 | ||
# rgw/v2/tests/s3_swift/test_bucket_listing.py | ||
config: | ||
user_count: 1 | ||
bucket_count: 1 | ||
objects_count: 100 | ||
objects_size_range: | ||
min: 10 | ||
max: 10 | ||
test_ops: | ||
create_bucket: true | ||
test_bucket_list_incomplete_mp: true | ||
radoslist: true | ||
meta_entries: 400000 | ||
num_objects: 200000 | ||
object_size: 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import json | ||
import logging | ||
import os | ||
import random | ||
import string | ||
import time | ||
import timeit | ||
from urllib import parse as urlparse | ||
|
||
import boto3 | ||
import v2.lib.manage_data as manage_data | ||
import v2.utils.utils as utils | ||
from botocore.exceptions import ClientError | ||
from v2.lib.exceptions import RGWBaseException, TestExecError | ||
from v2.lib.resource_op import Config | ||
from v2.lib.rgw_config_opts import ConfigOpts | ||
|
||
log = logging.getLogger() | ||
|
||
|
||
|
||
def test_listing_incomplete_multipart( | ||
rgw_client, bucket_name, meta_prefix, num_objects, meta_entries, object_size | ||
): | ||
""" | ||
Perform the following operations: | ||
1. Upload many objects (~10K) to a bucket. | ||
2. Create ~10K incomplete multipart uploads. | ||
3. Perform list_objects_v2 with pagination of 1000 objects. | ||
Parameters: | ||
rgw_client (boto3.client): S3 client instance. | ||
bucket_name (str): Name of the bucket. | ||
meta_prefix (str): Prefix for multipart upload objects. | ||
num_objects (int): Number of objects to upload/create. | ||
object_size (int): Size of each object in bytes. | ||
""" | ||
# Upload objects | ||
log.info(f"Uploading {num_objects} objects of size {object_size} bytes each...") | ||
for i in range(num_objects): | ||
key = f"data/N27/good/193_tasking/2024-10-31/25/compacted-part-f55a5b45-f11f-4dd7-91e0-79658ca61548-0-object-{i}" | ||
content = "".join(random.choices(string.ascii_letters + string.digits, k=object_size)) | ||
|
||
try: | ||
rgw_client.put_object(Bucket=bucket_name, Key=key, Body=content) | ||
if i % 1000 == 0: | ||
log.info(f"Uploaded {i} objects...") | ||
except ClientError as e: | ||
log.error(f"Error uploading object {key}: {e}") | ||
log.info(f"Uploaded {num_objects} objects successfully.") | ||
|
||
# Create fake multipart uploads | ||
log.info( | ||
f"Creating {meta_entries} fake multipart uploads with prefix '{meta_prefix}'..." | ||
) | ||
for i in range(meta_entries): | ||
key = f"{meta_prefix}{i}" | ||
try: | ||
rgw_client.create_multipart_upload(Bucket=bucket_name, Key=key) | ||
if i % 1000 == 0: | ||
log.info(f"Created {i} fake multipart uploads...") | ||
except ClientError as e: | ||
log.error(f"Error creating multipart upload for {key}: {e}") | ||
log.info(f"Created {num_objects} fake multipart uploads successfully.") | ||
|
||
# List objects | ||
log.info(f"Listing objects in the bucket '{bucket_name}'...") | ||
paginator = rgw_client.get_paginator("list_objects_v2") | ||
operation_parameters = {"Bucket": bucket_name, "MaxKeys": 1000} | ||
try: | ||
for page in paginator.paginate(**operation_parameters): | ||
if "Contents" in page: | ||
for obj in page["Contents"]: | ||
log.info(f"Key: {obj['Key']} | Size: {obj['Size']} bytes") | ||
else: | ||
log.info("No objects found in the bucket.") | ||
except ClientError as e: | ||
log.error(f"Error listing objects: {e}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters