yandrey321 commented on code in PR #8871: URL: https://github.com/apache/ozone/pull/8871#discussion_r2534896960
########## hadoop-hdds/docs/content/design/event-notification-schema.md: ########## @@ -0,0 +1,396 @@ +--- +title: Event notification schema discussion +summary: Event notifications schema discussion +date: 2025-06-29 +jira: HDDS-13513 +status: design +author: Colm Dougan, Donal Magennis +--- +<!-- + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. See accompanying LICENSE file. +--> + +## Overview + +This document outlines the schema requirements for event notification +within Ozone and discusses the suitability of 2 widely used event +notification schemas (S3 and HDFS) as candidates to use as a basis for +the transmission format for notifications within Ozone. + +# General schema requirements + +## File/Directory creation/modification + +event notifications should be raised to inform consumers of completed +operations which modify the filesystem and specifically the requests: + +#### CreateRequest + +we should emit some **create** event + +required fields: +- path (volume + bucket + key) +- isfile + +nice to have fields: +- overwrite +- recursive + +#### CreateFileRequest + +we should emit some **create** event + +required fields: +- path (volume + bucket + key) +- isfile + +nice to have fields: +- overwrite +- recursive + +#### CreateDirectoryRequest + +we should emit some **create** event + +required fields: +- path (volume + bucket + key) +- isfile + +#### CommitKeyRequest + +we should emit some **commit/close** event + +required fields: +- path (volume + bucket + key) + +nice to have fields: +- data size +- hsync? + +#### DeleteKeyRequest + +we should emit some **delete** event + +required fields: +- path (volume + bucket + key) + +nice to have fields: +- recursive (if known) + +### RenameKeyRequest + +we should emit some **rename** event + +required fields: +- fromPath (volume + bucket + key) +- toPath (volume + bucket + toKeyName) + +nice to have fields: +- recursive (if known) +- is directory (if known) + +NOTE: in the case of a FSO directory rename there is a dillema +(discussed later in this document) as to whether we should emit a single +event for a directory rename (specifying only the old/new directory names) +or whether we should emit granular events for all the child objects impacted by +the rename. + +## ACLs + +event notifications should be raised to inform consumers that ACL events +have happened. The relevant requests are: + +* AddAclRequest +* SetAclRequest +* RemoveAclRequest + +The fields provided could vary based on the implementation complexity. + +Minimally we have a requirement that we be informed that "some ACL update +happened" to a certain key (or prefix). + +Ideally the details would include the full context of the change made as +per the request. (perhaps by mirroring the full request details as a JSON +sub-object) e.g. : + +```json + ... + + "acls": [ + { + type: "GROUP", + name: "mygroup" + rights: "\000\001", + aclScope: "ACCESS", + } + ] +``` + +The precise details we would need to revisit with guidance from the +community but this is just to set broad brush expectations. + +## SetTimes + +event notifications should be raised to inform consumers that +mtime/atime has changed, as per **SetTimesRequest** + +# Transmission format + +This section discusses 2 widely used transmission formats for event +notifiations (S3 and HDFS) and their suitability as candidates for +adoption within Ozone. + +It is not assumed that these are the only options available but they are +good examples to test against our requirements and discuss trade-offs. + +## 1. S3 Event Notification schema + +The S3 event notification schema: + +[https://docs.aws.amazon.com/AmazonS3/latest/userguide/notification-how-to-event-types-and-destinations.html#supported-notification-event-types](https://docs.aws.amazon.com/AmazonS3/latest/userguide/notification-how-to-event-types-and-destinations.html#supported-notification-event-types) + +has become a standard for change notifications in S3 compatible storage services such as S3 itself, Ceph, MinIO etc + +Notification events are produced as a list of JSON records. + +To illustrate we can look at a sample "create" event from the Ceph docs +(https://docs.ceph.com/en/quincy/radosgw/notifications/#events): + +```json + +{"Records":[ + { + "eventVersion":"2.1", + "eventSource":"ceph:s3", + "awsRegion":"us-east-1", Review Comment: how do we set regions for private deployments? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
