Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NC | NSFS | Bucket Logging After Delete Bucket #8540

Closed
shirady opened this issue Nov 19, 2024 · 10 comments
Closed

NC | NSFS | Bucket Logging After Delete Bucket #8540

shirady opened this issue Nov 19, 2024 · 10 comments
Labels

Comments

@shirady
Copy link
Contributor

shirady commented Nov 19, 2024

Environment info

Actual behavior

  1. When trying to send_bucket_op_logs on delete bucket operation, we would not have the bucket_info anymore in the cache; therefore we would see the printing of "Could not log bucket operation".

Expected behavior

  1. Needs to be discussed what is the optimal solution - but the basic expected is not to see those logs.

Steps to reproduce

  1. Deployment in NC NSFS
  2. Create an account and a bucket.
  3. Delete the bucket, and look for the printing of "Could not log bucket operation".

We can see it in the Ceph tests
See this comment in the PR

More information - Screenshots / Logs / Other output

@shirady shirady added the NS-FS label Nov 19, 2024
@shirady shirady changed the title NC | NSFS | Bucket logging after delete bucket NC | NSFS | Bucket Logging After Delete Bucket Nov 19, 2024
@shirady shirady added the Non Containerized Non containerized label Nov 19, 2024
@shirady
Copy link
Contributor Author

shirady commented Nov 19, 2024

Hi,
The main question is to understand what should happen when a bucket is deleted -
Should we create the bucket logging? should we have the bucket notifications?

const bucket_info = await req.object_sdk.read_bucket_sdk_config_info(req.params.bucket);

we don't have the config file anymore, like trying to access to a bucket that don't exist.

@aspandey @alphaprinz
cc: @romayalon @jackyalbo

Note:
In case I can add 'delete_bucket' to outer if it is a simple solution and I can do it in my PR.

    if (req.params && req.params.bucket &&
        !(req.op_name === 'put_bucket' ||
+         req.op_name === 'bucket_delete' ||
          req.op_name === 'put_bucket_notification' ||
          req.op_name === 'get_bucket_notification'
        )) {

But I must understand what you think, and better to have the GAP open than to create a wrong flow.

@alphaprinz
Copy link
Contributor

Regarding notifications, deleting a bucket is not an event that triggers a notification.
(You can see the list of events here).
So your suggested fix is ok for notifications.

@aspandey
Copy link
Contributor

@shirady We can not do bucket logging if bucket does not exist..so in that case we should not even log this message if we do not want such logs.
However, I would not have any issue seeing such logs (may be added info) which could always help to debug.
May be log2 and not error..

@shirady
Copy link
Contributor Author

shirady commented Nov 20, 2024

@aspandey the bucket exists and then the client send a request to delete it (operation is delete bucket).
Do we need to log this information?

@aspandey
Copy link
Contributor

@shirady If I remember correctly, bucket logging was introduced to log bucket operation only, means, get/put/delete objects on a bucket if it is configured to log.
Operation "Delete Bucket", where we want to remove a bucket completely, does not fall in that category and should not be logged.
This is what I remember from my patch. However, @jackyalbo had also sent a detailed PR for persistent bucket logging and should also give his thoughts in case things changed.

@nimrod-becker
Copy link
Contributor

BucketLogging is set on a specific bucket, if the bucket is gone, then the logging config and the need to log.... no?

@shirady
Copy link
Contributor Author

shirady commented Nov 20, 2024

@nimrod-becker, this is what I'm trying to understand - if we need the last log of the operation of delete-bucket (until the cache changes we could have it).
@aspandey do you know why we didn't exclude it like put-bucket? (see comment)

@romayalon
Copy link
Contributor

@shirady @aspandey
I think that in general we don't skip bucket operations here except put_bucket, is there a different place where we avoid logging on bucket operations?

@shirady
Copy link
Contributor Author

shirady commented Nov 20, 2024

I discussed with @aspandey and suggested the following minor changes:

  1. Exclude the delete_bucket from the operations as I suggested here.
  2. Wrap with try_catch when trying to read the bucket info - on a non existing bucket (before the change) we also throw an error there.
  3. Add a check notification part (&& bucket_info) as it might be undefined - @alphaprinz .

If you have any comments regarding the code changes please write them in the PR #8527.

regarding @romayalon's question above - as I understand there many changes, and it is something that needs to be checked. we can open an issue about this gap - related to bucket logging (not related to the Add stat to bucket_namespace_cache).

shirady added a commit to shirady/noobaa-core that referenced this issue Nov 21, 2024
1. Create config option NC_ENABLE_BUCKET_NS_CACHE_STAT_VALIDATION to enable/disable this addition.
2. Add in read_bucket_sdk_info inside bucketspace FS property stat, and add a method stat_bucket that would only implemented in FS (as we stat cofig files, and in NB with DB we don't need this).
3. Edit the _validate_bucket_namespace so before checking the validation by time, in case it is bucketspace FS we will compare the stat and return false (invalidate) in case the config file was changed.
4. Changes in nc_coretest create the functions start_nsfs_process and stop_nsfs_process based on existing implementation to allow us to restart nsfs.
5. Rename the function check_bucket_config to check_stat_bucket_storage_path that it would be less confusing.
6. Edit the printings of "Could not log bucket operation" to have the details of where they were printed.
7. Adding a basic test of running with a couple of forks.
8. Change the default number of forks in the Ceph NSFS tests in the CI to 2.
9. Rename file test_bucketspace.js to test_nsfs_integration.js and the nc_core test log files from src/logfile to nsfs_integration_test_log.
10. Small changes in s3_bucket_logging.js regarding bucket deletion: bucket existed and bucket that did not exist - see NC | NSFS | Bucket Logging After Delete Bucket noobaa#8540.

Signed-off-by: shirady <[email protected]>
@shirady
Copy link
Contributor Author

shirady commented Nov 21, 2024

I'm closing the issue since we added the changes in file s3_bucket_logging.js to avoid the issue of deleting an existing bucket (and also we had before the PR an error thrown on deleting a non-existing bucket).

@shirady shirady closed this as completed Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants