-
Notifications
You must be signed in to change notification settings - Fork 19
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
Improvement/arsn 420 introduce put object hack #2249
Improvement/arsn 420 introduce put object hack #2249
Conversation
Hello benzekrimaha,My role is to assist you with the merge of this Available options
Available commands
Status report is not available. |
5af79f8
to
151bab4
Compare
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
|
const key = formatMasterKey(objName, params.vFormat); | ||
const putFilter = { _id: key }; | ||
return collection.updateOne(putFilter, { | ||
$set: { | ||
_id: masterKey, | ||
value: objVal, | ||
_id: key, | ||
value, | ||
}, | ||
}, { | ||
upsert: true, | ||
}).then(() => cb()).catch((err) => { | ||
log.error('putObjectNoVer: error putting obect with no versioning', { error: err.message }); | ||
}).then(() => cb()).catch(err => { | ||
log.error('internalPutObject: error putting object', | ||
{ bucket: bucketName, object: key, error: err.message }); | ||
return cb(errors.InternalError); |
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.
probably no point changing this, old code works just as well ?
(and putObjectNoVer: error putting obect with no versioning
error message was more appropriate, giving details about which part of the code fails...)
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.
code was kept as is, the error message is fixed here : 043b64c#diff-9c207befbd8f4d79a3b6e3d7d143444e804ca1684236b8fd9fa0f9e03c53477aR935
const putFilter = { _id: key }; | ||
// filter used when finding and updating object | ||
const findFilter = Object.assign({ | ||
_id: key, |
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.
redundant with , putFilter
a few lines below...
also, whenever possible, prefer to use ...
to "unpack" object instead of Object.assign, as it will be easier to migrate to typescript
_id: key, | |
const findFilter = { | |
...putFilter, | |
$or: [ | |
{ 'value.deleted': { $exists: false } }, | |
{ 'value.deleted': { $eq: false } }, | |
], | |
}; |
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.
}, { | ||
upsert: false, | ||
}).then(doc => { | ||
log.info('doc value', { doc: doc.value }); |
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.
Is this a leftover from debugging ?
const findFilter = Object.assign({ | ||
_id: key, | ||
$or: [ | ||
{ 'value.deleted': { $exists: false } }, | ||
{ 'value.deleted': { $eq: false } }, | ||
], | ||
}, putFilter); | ||
const updateDeleteFilter = Object.assign({ | ||
'_id': key, | ||
'value.deleted': true, | ||
}, putFilter); |
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.
Not sure what's the point of Object.assign
since we already set the _id
key in the filters ?
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.
indeed , fixed here : 043b64c#diff-9c207befbd8f4d79a3b6e3d7d143444e804ca1684236b8fd9fa0f9e03c53477aR961-R971
100e4b9
to
36b7bd2
Compare
We agreed on Introducing the same “hack” as in internalDelete function, so write the MD twice in the oplog: one "deleted: true" copy of the previous MD, followed by the expected update with the new metadata
36b7bd2
to
e3e4b2a
Compare
/approve |
I have successfully merged the changeset of this pull request
The following branches have NOT changed:
Please check the status of the associated issue ARSN-420. Goodbye benzekrimaha. The following options are set: approve |
Details on the implementation are within the commit description
Issue : ARSN-420