-
-
Notifications
You must be signed in to change notification settings - Fork 677
fix(collection): avoid double update of some record by using the hash column as index #3304
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
Conversation
β¦ column as index
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.
Thanks, @elevatebart, for the PR; it's a nice fix.
Added two change requests before
if (opts.hashColumn !== false) { | ||
values.push(`'${valuesHash}'`) | ||
} |
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.
We need to add back this
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.
A system with no hashColumn would not benefit from this improvement.
I will set it up.
src/utils/collection.ts
Outdated
values.push(`'${valuesHash}'`) | ||
} | ||
|
||
const valuesWithHash = opts.hashColumn !== false ? [...values, `'${valuesHash}'`] : values |
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.
I'm thinking of removing hashColumn
option and add it to all, it will simplify the logic here.
I added this option to avoid adding __hash__
to the development cache table, which causes SQL to fail. But forcing cache cleanup in the new version would be a better solution.
commit: |
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.
Thanks β€οΈ
π Linked issue
β Type of change
π Description
When two users on diferent parts of the world open the same un-deployed nuxt content powered website, they both trigger the deployment at the same time. Since it can take a moment for data to be synchronized, both can still be running the data at the same time, including the concatenation updates.
To avoid duplicating and therefore corrupting the data, I had the idea to use a temporary hash when inserting incomplete data:
example with the hash of the record being
123456798
and the column namecontent
With this we prevent most corruption of data through multiple updates.
We still need a way to "repair" a system that has stopped deploying mid deployment.
But this should improve deployment stability slightly.
π Checklist