-
Notifications
You must be signed in to change notification settings - Fork 141
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
Avoid cascading updates for milestones server-side and move logic to client #3709
Comments
@vikasrohit in this task we would get rid of cascading milestone updates while keeping milestones as "spans". Our plan is to create a Bluk Update endpoint which would basically update all milestones of a timeline at once and the client would control everything by itself. So we would remove the logic to make cascading updates from CREATE and UPDATE endpoint. I just would like to note, that after we remove this cascading update logic, we would be able to create "inconsistent data" (as per our current requirements) using these endpoints as sever would not enforce consistency anymore. For example:
There are two ways to go:
|
Milestones Bulk Update Endpoint SpecificationWe can add endpoint Imagine we have a timeline with 3 milestones: milestones: [
{
"id": 1,
"name": "Milestone 1",
"startDate": "15 Dec 2020",
},
{
"id": 2,
"name": "Milestone 2",
"startDate": "20 Dec 2020",
},
{
"id": 3,
"name": "Milestone 3",
"startDate": "25 Dec 2020",
}
] If we send a bulk request with the next payload: [
{
"id": 2,
"name": "Milestone 2 Updated",
"startDate": "21 Dec 2020",
},
{
"id": 3,
"name": "Milestone 3",
"startDate": "25 Dec 2020",
},
{
"name": "Milestone 4",
"startDate": "30 Dec 2020",
}
] Then timeline would look like this: milestones: [
{
"id": 2,
"name": "Milestone 2 Updated", // update name
"startDate": "21 Dec 2020", // update date
},
{ // stays as it is
"id": 3,
"name": "Milestone 3",
"startDate": "25 Dec 2020",
},
{ // new milestone
"id": 4,
"name": "Milestone 4",
"startDate": "30 Dec 2020",
}
]
ErrorsThis endpoint should work as a single transaction, so if at least on operation during this endpoint fails, then:
@vikasrohit what do you think about such logic? |
Agreed. We can live with the missing server enforcement because as you said we ultimately want to go towards the milestones as points implementation which would delegate all validations to the caller. I am good with the bulk endpoint specs as well, go ahead. |
Thanks for confirmation @vikasrohit. One more thing. The bulk endpoint should send Kafka events after individual milestones create/updated/delete opearations so the
This is quite a nasty issue. As all of the approaches have strong disadvantages. |
@maxceem I agreed. The only viable approach is 1. For avoiding |
@vikasrohit the test has been implemented in branch https://github.com/topcoder-platform/project-processor-es/tree/feature/stress-test. And the results are quite interesting:
So it looks like using |
Good findings @maxceem |
I don't remember the reason why those unit tests are disabled, can we get them enabled and fixed now? |
We don't call them directly in real life, only in unit tests.
I guess they were disabled due to |
Go ahead. |
Follow-up from #3299 (comment)
As a part of V5 Standards, we have to avoid making cascading updates server-side, implement endpoints for bulk operations and move cascading logic to the client-side.
This task would be done both server-side and client-side.
The text was updated successfully, but these errors were encountered: