forked from TrueCloudLab/xk6-frostfs
add logs to delete
Signed-off-by: m.malygina <m.malygina@yadro.com>
parent
3bc1229062
commit
8de580a550
|
@ -108,7 +108,7 @@ func (c *Client) Multipart(bucket, key string, objPartSize, concurrency int, pay
|
|||
|
||||
func (c *Client) Delete(bucket, key string) DeleteResponse {
|
||||
start := time.Now()
|
||||
|
||||
println("Delete bucket:", bucket, " key:", key)
|
||||
_, err := c.cli.DeleteObject(c.vu.Context(), &s3.DeleteObjectInput{
|
||||
Bucket: aws.String(bucket),
|
||||
Key: aws.String(key),
|
||||
|
|
|
@ -71,11 +71,23 @@ if (write_vu_count > 0) {
|
|||
};
|
||||
}
|
||||
|
||||
const read_vu_count = parseInt(__ENV.READERS || '0');
|
||||
if (read_vu_count > 0) {
|
||||
scenarios.read = {
|
||||
executor : 'constant-vus',
|
||||
vus : read_vu_count,
|
||||
duration : `${duration}s`,
|
||||
exec : 'obj_read',
|
||||
gracefulStop : '5s',
|
||||
};
|
||||
}
|
||||
|
||||
const delete_age = __ENV.DELETE_AGE ? parseInt(__ENV.DELETE_AGE) : undefined;
|
||||
let obj_to_delete_selector = undefined;
|
||||
let obj_to_delete_exit_on_null = undefined;
|
||||
if (registry_enabled && delete_age) {
|
||||
obj_to_delete_exit_on_null = write_vu_count == 0;
|
||||
obj_to_delete_exit_on_null = (write_vu_count == 0) && (read_vu_count == 0);
|
||||
console.debug(`obj_to_delete_exit_on_null: ${obj_to_delete_exit_on_null}`);
|
||||
|
||||
let constructor = obj_to_delete_exit_on_null ? registry.getOneshotSelector
|
||||
: registry.getSelector;
|
||||
|
@ -88,16 +100,7 @@ if (registry_enabled && delete_age) {
|
|||
});
|
||||
}
|
||||
|
||||
const read_vu_count = parseInt(__ENV.READERS || '0');
|
||||
if (read_vu_count > 0) {
|
||||
scenarios.read = {
|
||||
executor : 'constant-vus',
|
||||
vus : read_vu_count,
|
||||
duration : `${duration}s`,
|
||||
exec : 'obj_read',
|
||||
gracefulStop : '5s',
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
const delete_vu_count = parseInt(__ENV.DELETERS || '0');
|
||||
if (delete_vu_count > 0) {
|
||||
|
@ -175,12 +178,13 @@ export function obj_read() {
|
|||
if (__ENV.SLEEP_READ) {
|
||||
sleep(__ENV.SLEEP_READ);
|
||||
}
|
||||
|
||||
log.withFields({op : 'obj_read - ENTERED'}).info("INFO");
|
||||
if (obj_to_read_selector) {
|
||||
const obj = obj_to_read_selector.nextObject();
|
||||
if (!obj ) {
|
||||
return;
|
||||
}
|
||||
log.withFields({bucket : obj.s3_bucket, key : obj.s3_key, op : 'READ START'}).info("INFO");
|
||||
const resp = s3_client.get(obj.s3_bucket, obj.s3_key)
|
||||
if (!resp.success) {
|
||||
log.withFields({bucket : obj.s3_bucket, key : obj.s3_key, status: obj.status, op: `READ`})
|
||||
|
@ -188,7 +192,7 @@ export function obj_read() {
|
|||
} else {
|
||||
obj_registry.setObjectStatus(obj.id, obj.status, 'read');
|
||||
}
|
||||
|
||||
log.withFields({bucket : obj.s3_bucket, key : obj.s3_key, op : 'READ FINISHED'}).info("INFO");
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -206,7 +210,7 @@ export function obj_delete() {
|
|||
if (__ENV.SLEEP_DELETE) {
|
||||
sleep(__ENV.SLEEP_DELETE);
|
||||
}
|
||||
|
||||
log.withFields({op : 'obj_delete - ENTERED'}).info("INFO");
|
||||
const obj = obj_to_delete_selector.nextObject();
|
||||
delete_object(obj)
|
||||
}
|
||||
|
@ -218,13 +222,13 @@ export function delete_object(obj) {
|
|||
}
|
||||
return;
|
||||
}
|
||||
|
||||
log.withFields({bucket : obj.s3_bucket, key : obj.s3_key, op : 'DELETED START'}).info("INFO");
|
||||
const resp = s3_client.delete(obj.s3_bucket, obj.s3_key);
|
||||
if (!resp.success) {
|
||||
log.withFields({bucket : obj.s3_bucket, key : obj.s3_key, op : 'DELETE'})
|
||||
.error(resp.error);
|
||||
return;
|
||||
}
|
||||
|
||||
log.withFields({bucket : obj.s3_bucket, key : obj.s3_key, op : 'DELETED SUCCESS'}).info("INFO");
|
||||
obj_registry.deleteObject(obj.id);
|
||||
}
|
Loading…
Reference in New Issue