Added headers for CRR Cascaded#24
Conversation
Hello sylvainsenechal,My role is to assist you with the merge of this Available options
Available commands
Status report is not available. |
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
|
e2a81bf to
798a647
Compare
There was a problem hiding this comment.
First I added some tests in this codebase, but they were too functional and not really oriented toward just testing the client itself. + we already have test testing the client itself for putData/putMetadata
So I added the tests in Cloudserver : They are functional tests using CloudserverClient with the micro version id, testing 409 error, actual api behavior etc. I think they are better in cloudserver than in here
| RequestUids: String, | ||
|
|
||
| @httpHeader("x-scal-micro-version-id") | ||
| MicroVersionId: String, |
There was a problem hiding this comment.
as discussed (late) in the design, not an input parameter : PutData should minimize work/logic related to metadata, and should simply return the current microVersionId (instead of "x-scal-cascade-loop-detected")
this will reduce coupling, while giving all flexibility for backbeat to take all decisions.
| @httpHeader("x-scal-cascade-loop-detected") | ||
| CascadeLoopDetected: Boolean |
There was a problem hiding this comment.
PutMetadata is a generic api, used in many more cases than CRR.
→ api should stay generic, no reason to introduce "crr cascaded" vocabulary : stick to some generic concept, like "conflict" or "already have microVersionId"
There was a problem hiding this comment.
I thought about this but I thought it would be better for future maintainers to understand what this field is used for.
I dont wanna go with conflict as this would already be used for microVersionId that are too old, but I'll find something for the equality around "already have micro version id"
There was a problem hiding this comment.
edit: name updated, let me know if you have other name ideas
|
|
||
|
|
||
| @httpHeader("x-scal-micro-version-id") | ||
| MicroVersionId: String, |
There was a problem hiding this comment.
nit: to make the semantic explicit, field could be name something like IfMicroVersionIdOlderThan (i.e. semantics is part of the API)
There was a problem hiding this comment.
Leaving for now, what do other ppl think about the naming ?
There was a problem hiding this comment.
@scality/raving-robots WDYT?
There was a problem hiding this comment.
x-scal-micro-version-id is simpler and easier to understand.
798a647 to
a072957
Compare
| versionId: String, | ||
|
|
||
| @httpHeader("x-scal-micro-version-id-exists") | ||
| MicroVersionIdExists: Boolean |
There was a problem hiding this comment.
nit: when it exists, should it return just a bool or actually the value itself ?(previous or current, not sure what we need)
There was a problem hiding this comment.
Bool works, although yeah, we could return a microVersionId and let backbeat decide for itself what it should do with it
| SSEKMSKeyId: String, | ||
|
|
||
| @httpHeader("x-scal-micro-version-id") | ||
| ExistingMicroVersionId: String |
There was a problem hiding this comment.
just MicroVersionId, consistent with the x-scal header
There was a problem hiding this comment.
yeah and actually i did some rework to integrate this with the error of handling of smithy, this is defined and returned with the VersionIdCollisionException now
| @httpHeader("X-Scal-Request-Uids") | ||
| RequestUids: String, | ||
|
|
||
| @httpHeader("x-scal-source-version-id") |
There was a problem hiding this comment.
why "source" ? you usual header is x-scal-version-id I think, should stick to it ?
There was a problem hiding this comment.
In a code that's already not super easy to read, I think its easy to mix up ids, and being able to write this on cloudserver just make thing very clear 🤔
const incomingVersionIdEncoded = request.headers['x-scal-source-version-id'];
edit: Yeah actually in cloudserver, we already have similar pattern in routebackbeat (x-scal-source-version-id, x-scal-source-bucket), so I prefer to keep it like this
| @httpHeader("X-Scal-Request-Uids") | ||
| RequestUids: String, | ||
|
|
||
| @httpHeader("x-scal-source-version-id") |
There was a problem hiding this comment.
should be marked as "optional" : if not set, we should keep previous/existing behavior (no conflict detection etc)
There was a problem hiding this comment.
To be confirmed, but I think it's optional by default.
There was a problem hiding this comment.
thats right, there is an @required field
that will produce this for example.
Else the field is optional

|
|
||
|
|
||
| @httpHeader("x-scal-micro-version-id") | ||
| MicroVersionId: String, |
There was a problem hiding this comment.
x-scal-micro-version-id is simpler and easier to understand.
| versionId: String, | ||
|
|
||
| @httpHeader("x-scal-micro-version-id-exists") | ||
| MicroVersionIdExists: Boolean |
There was a problem hiding this comment.
Should be x-scal-replication-loop to differentiate between a success write and a loop skip.
There was a problem hiding this comment.
I used
if data.MicroVersionIdExists to check if we had a success or a loop
edit:
nvm yeah I reviewed the naming and used
x-scal-replication-loop
replicationLoop
| versionId: String, | ||
|
|
||
| @httpHeader("x-scal-micro-version-id-exists") | ||
| MicroVersionIdExists: Boolean |
| input: PutMetadataInput, | ||
| output: PutMetadataOutput | ||
| output: PutMetadataOutput, | ||
| errors: [ConflictException] |
There was a problem hiding this comment.
Should also be added to putData
There was a problem hiding this comment.
I removed it from putData, it doesn't raise a 409 anymore, and instead just return 200 with micro version id, and backbeat do the check.
But honestly this is all a bit complicated, having to deal with both error code and returned values that are either booleans or microVersionId..
There was a problem hiding this comment.
Yeah i'm a bit starting to question the current implementation, as again it works but it's tricky to mix error code, with boolean flag, with string returned value.
Would probably be wiser and easier to maintain to just have a "CrrCascadeOutcome" = 'dataAlreadyExists' | 'loop' | 'stale' or whatever we need, and just have backbeat switch on all cases.
Because here in backbeat it gets a bit dirty 🤔
There was a problem hiding this comment.
Forget about the 2 other messages,
I did some rework to properly integrate the smithy errors
Now backbeat will be able to check errors like this :
err instanceof StaleMicroVersionIdException
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
The following reviewers are expecting changes from the author, or must review again: |
a072957 to
ec98192
Compare
| ReplicationLoop: Boolean | ||
| } | ||
|
|
||
| @error("client") |
There was a problem hiding this comment.
can we add a test for this changes the generated client contract, but nothing checks that MicroVersionId / versionId are serialized as headers, nor that the new 409 errors are deserialized with their headers
ISSUE : CLDSRVCLT-14
Crr cascaded design : https://github.com/scality/citadel/pull/349
Related PRs :
Arsenal : scality/Arsenal#2628
Cloudserver : scality/cloudserver#6179
Backbeat : scality/backbeat#2747
S3utils : scality/s3utils#395