-
Notifications
You must be signed in to change notification settings - Fork 2
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
Fix triggering replication when multiple destinations are set #331
base: development/1.15
Are you sure you want to change the base?
Conversation
Hello kerkesni,My role is to assist you with the merge of this Available options
Available commands
Status report is not available. |
00a5b99
to
09ccadb
Compare
Request integration branchesWaiting for integration branch creation to be requested by the user. To request integration branches, please comment on this pull request with the following command:
Alternatively, the |
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
The following options are set: create_pull_requests |
09ccadb
to
4efccfb
Compare
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
The following options are set: create_pull_requests |
if (!objMD.getReplicationInfo() | ||
|| !objMD.getReplicationSiteStatus(storageClass)) { | ||
let replicationInfo = objMD.getReplicationInfo(); | ||
if (!replicationInfo || !replicationInfo.status) { | ||
const { Rules, Role } = repConfig; | ||
const destination = Rules[0].Destination.Bucket; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this may not be correct, if there is more than 1 desitination....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
crrExistingObjects
doesn't currently support triggering replication for multiple sites at once. So this would work as it will initialize the replication info when triggering the first site and then append the other sites' info to the fields when the other ones are triggered.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
even without triggering multiple sites at once : if a user requests replicatoin to the second "site", this will initialize with the 1st destination (--> trigger replication!), then we will add the second one...
When there is no replicationInfo (i.e. typically when it is empty), should we not just initialize an empty replicationInfo, and let the next block ("Update replication info with site specific info") fill the details for the requested destination?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in cloudserver, it seems this is initialized to bucketMD.replicationConfig.destination
: should we do the same?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a weird one... So, we currently only support having a single destination bucket for all replication rules of a bucket. When creating the rules/workflows via UI it's even worse, the destination bucket becomes the name of the bucket we are replicating from.
The value of this field is not used in Zenko. When creating a location, Cloudserver initializes a client class for the respective backend (aws/azure/...) that keeps the name of the destination bucket in memory, that's the value we use when replicating and not what's in the replication rule (only the storageClass is used to know which client to use).
storageClass: '', | ||
role: Role, | ||
storageType: this.storageType, | ||
storageType: '', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what are these 2 fields (storageClass
and storageType
) used for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
storageClass
is what each location's replication queue processor uses to check if it should replicate an object or not.
storageType
is used by Cloudserver in Backbeat routes to do some pre-checks (check if versioning is supported on the backend and that the location is valid)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that is how these fields are used... my question is really what information do they actually store, what these fields represent (for example, the storageClass of the object is already known, and stored in .location[]
and dataStoreName
; and this cannot be the storageClass of the 'remote' object, since there may be multiple destinations...)
same for destination
btw, I don't understand this field initialize with a single bucket name :-/ Or maybe this is a left-over from the first replication (not supporting multi-targets)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the code which initializes these in cloudserver:
function _getReplicationInfo(rule, replicationConfig, content, operationType,
objectMD, bucketMD) {
const storageTypes = [];
const backends = [];
const storageClasses = _getStorageClasses(rule);
if (!storageClasses) {
return undefined;
}
storageClasses.forEach(storageClass => {
const storageClassName =
storageClass.endsWith(':preferred_read') ?
storageClass.split(':')[0] : storageClass;
const location = s3config.locationConstraints[storageClassName];
if (location && replicationBackends[location.type]) {
storageTypes.push(location.type);
}
backends.push(_getBackend(objectMD, storageClassName));
});
if (storageTypes.length > 0 && operationType) {
content.push(operationType);
}
return {
status: 'PENDING',
backends,
content,
destination: replicationConfig.destination,
storageClass: storageClasses.join(','),
role: replicationConfig.role,
storageType: storageTypes.join(','),
isNFS: bucketMD.isNFS(),
};
}
--> it seems these fields (along with role
) are not multi-destination/rule aware?
--> these should be mostly useless for Zenko's multibackend replication (otherwise we probably have bugs), but may still be needed for CRR (and may cause bugs if multiple rules/destinations were used in that case)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
storageClass
and storageType
are multi-destination aware (although their name suggests otherwise), they contain the list of all storage classes and storage types we are replicating to.
Example:
storageClass: "aws-location,azure-blob"
storageType: "aws_s3,azure"
In Zenko, these fields are duplicates of information we already have, as backbeat/cloudserver have a list of all location information, we could just use the storage class stored in the rules to get the info we want. I think these are more of a relic from S3C that we can't really remove right now as S3C uses them.
In CRR, the role is also a list. I don't think this works in Zenko tho.
The destination
field is a weird one, i explained how it works in the previous comment
- Issue 1: In Artesca "SITE_NAME" is never passed, so we always trigger objects that are replicated to the first storageClass in the replication rule. - Issue 2: We check the global replication status when verifying wether or not an object should be retriggered. This doesn't necessarily work all the time, especially when replicating to multiple destinations. As if one destination fails the global status becomes failed, which will make it impossible to trigger objects with a completed status for example. - Issue 3: replication info is completely overwritten when it does not contain info about a specific site. This will cause an issue when replicating to multiple destinations as the script can only be launched for one site at a time, so when having a object with non initialized replication info, we won't be able to set the replication info propely for all destinations. Issue: S3UTILS-184
4efccfb
to
55c1b97
Compare
Issue 1: In Artesca "SITE_NAME" is never used, so we always
trigger objects that are replicated to the first storageClass in
the replication rule.
Issue 2: We check the global replication status when verifying
wether or not an object should be retriggered. This doesn't necessarily
work all the time, especially when replicating to multiple destinations.
As if one destination fails the global status becomes failed, which will
make it impossible to trigger objects with a completed status for example.
Issue 3: replication info is completely overwritten when it does not contain
info about a specific site. This will cause an issue when replicating to multiple
destinations as the script can only be launched for one site at a time, so when
having a object with non initialized replication info, we won't be able to set
the replication info properly for all destinations.
Issue: S3UTILS-184