Add an option to make bucket notifications synchronous (#17406)

With the current asynchronous behaviour in sending notification events
to the targets, we can't provide guaranteed delivery as the systems
might go for restarts.

For such event-driven use-cases, we can provide an option to enable
synchronous events where the APIs wait until the event is successfully
sent or persisted.

This commit adds 'MINIO_API_SYNC_EVENTS' env which when set to 'on'
will enable sending/persisting events to targets synchronously.
This commit is contained in:
Praveen raj Mani
2023-06-21 06:08:59 +05:30
committed by GitHub
parent 02c2ec3027
commit 7c72b25ef0
8 changed files with 74 additions and 60 deletions
+9
View File
@@ -52,6 +52,7 @@ type apiConfig struct {
disableODirect bool
gzipObjects bool
rootAccess bool
syncEvents bool
}
const cgroupLimitFile = "/sys/fs/cgroup/memory/memory.limit_in_bytes"
@@ -166,6 +167,7 @@ func (t *apiConfig) init(cfg api.Config, setDriveCounts []int) {
t.disableODirect = cfg.DisableODirect
t.gzipObjects = cfg.GzipObjects
t.rootAccess = cfg.RootAccess
t.syncEvents = cfg.SyncEvents
}
func (t *apiConfig) isDisableODirect() bool {
@@ -353,3 +355,10 @@ func (t *apiConfig) getTransitionWorkers() int {
return t.transitionWorkers
}
func (t *apiConfig) isSyncEventsEnabled() bool {
t.mu.RLock()
defer t.mu.RUnlock()
return t.syncEvents
}