Compare commits

...

5 Commits

Author SHA1 Message Date
Allan Roger Reid 646be7ba29
Merge e0182b85e0 into e909be6380 2025-07-21 00:13:58 +08:00
Poorna e909be6380 send replication requests to correct pool (#1162)
VulnCheck / Analysis (push) Has been cancelled Details
Fixes incorrect application of ilm expiry rules on versioned objects
when replication is enabled.

Regression from https://github.com/minio/minio/pull/20441 which sends
DeleteObject calls to all pools. This is a problem for replication + ilm
scenario since replicated version can end up in a pool by itself instead of
pool where remaining object versions reside.

For example, if the delete marker is set on pool1 and object versions exist on
pool2, the second rule below will cause the delete marker to be expired by ilm
policy since it is the single version present in pool1
```
{
  "Rules": [
   {
    "ID": "cs6il1ri2hp48g71mdjg",
    "NoncurrentVersionExpiration": {
     "NoncurrentDays": 14
    },
    "Status": "Enabled"
   },
   {
    "Expiration": {
     "ExpiredObjectDeleteMarker": true
    },
    "ID": "cs6inj3i2hp4po19cil0",
    "Status": "Enabled"
   }
  ]
}
```
2025-07-19 13:27:52 -07:00
Allan Roger Reid e0182b85e0
Merge branch 'master' into add-audit-site 2024-12-31 14:50:22 -08:00
Allan Roger Reid 9611aa9b15
Merge branch 'master' into add-audit-site 2024-12-19 12:25:18 -08:00
Allan Reid bebf04e2b6
Add SiteName to both internal and external audit logs 2024-12-19 12:12:03 -08:00
5 changed files with 18 additions and 0 deletions

View File

@ -524,6 +524,7 @@ func lookupConfigs(s config.Config, objAPI ObjectLayer) {
configLogIf(ctx, fmt.Errorf("Invalid site configuration: %w", err))
}
globalSite.Update(siteCfg)
xhttp.SetSiteName(globalSite.Name())
globalAutoEncryption = crypto.LookupAutoEncryption() // Enable auto-encryption if enabled
if globalAutoEncryption && GlobalKMS == nil {

View File

@ -1185,6 +1185,13 @@ func (z *erasureServerPools) DeleteObject(ctx context.Context, bucket string, ob
return z.deleteObjectFromAllPools(ctx, bucket, object, opts, noReadQuorumPools)
}
// All replication requests needs to go to pool with the object.
if opts.ReplicationRequest {
objInfo, err = z.serverPools[pinfo.Index].DeleteObject(ctx, bucket, object, opts)
objInfo.Name = decodeDirObject(object)
return objInfo, err
}
for _, pool := range z.serverPools {
objInfo, err := pool.DeleteObject(ctx, bucket, object, opts)
if err != nil && !isErrObjectNotFound(err) && !isErrVersionNotFound(err) {

View File

@ -37,6 +37,9 @@ var (
// GlobalDeploymentID - is sent in the header to all http targets
GlobalDeploymentID string
// GlobalSiteName - is sent in the header to all http targets
GlobalSiteName string
)
const (
@ -236,3 +239,8 @@ func SetMinIOVersion(version string) {
func SetDeploymentID(deploymentID string) {
GlobalDeploymentID = deploymentID
}
// SetSiteName -- user defined site from environment variable `MINIO_SITE_NAME` or from configuration `site.name`
func SetSiteName(siteName string) {
GlobalSiteName = siteName
}

View File

@ -52,6 +52,7 @@ func GetAuditEntry(ctx context.Context) *audit.Entry {
r = &audit.Entry{
Version: internalAudit.Version,
DeploymentID: xhttp.GlobalDeploymentID,
SiteName: xhttp.GlobalSiteName,
Time: time.Now().UTC(),
}
return r

View File

@ -36,6 +36,7 @@ func NewEntry(deploymentID string) audit.Entry {
return audit.Entry{
Version: Version,
DeploymentID: deploymentID,
SiteName: xhttp.GlobalSiteName,
Time: time.Now().UTC(),
}
}