Skip to content
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

Ensure design docs are uploaded individually when replicating with bulk_get #4370

Merged
merged 1 commit into from
Jan 13, 2023

Conversation

nickva
Copy link
Contributor

@nickva nickva commented Jan 12, 2023

Previously, when replication jobs used _bulk_get they didn't upload design docs individually like they do when not using _bulk_get.

Here were are preserving an already existing behavior which we had in the replicator without _bulk_get usage for more than 2 years. It was introduced here in #2426. Related to these issues #2415 and #2413.

Add tests to cover both attachments and ddoc cases. meck:num_calls/3 is helpful as it allows to nicely assert which API function was called and how many times.

@nickva nickva requested a review from jaydoane January 12, 2023 04:59
@nickva nickva changed the title Ensure design docs are upload individually when replicating with bulk_get Ensure design docs are uploaded individually when replicating with bulk_get Jan 12, 2023
@rnewson rnewson self-requested a review January 12, 2023 08:50
Copy link
Member

@rnewson rnewson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why?

There's no reason I can see to artificially limiting how many design documents are posted in one _bulk_get. Other clients are under no obligation to do the same, so any assumption you might make elsewhere, that ddocs are updated individually is built on a shaky foundation.

Please explain why this is an improvement, or bug fix, for couchdb on its own terms.

Copy link
Contributor

@jaydoane jaydoane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like an elegant way to prevent using replication to exceed ddoc limits.

@nickva
Copy link
Contributor Author

nickva commented Jan 12, 2023

@rnewson good question, I should have explained that a bit better in the commit.

That is to preserve an already existing behavior which we had in the replicator without _bulk_get usage for more than 2 years. It was introduced here: #2426 related to these issues #2415 and #2413

EDIT: updated commit and PR comment with the references as well

@nickva nickva force-pushed the fix-invididual-design-docs-replication branch from b5b3ab9 to 4f27156 Compare January 12, 2023 18:45
…ulk_get

Previously, when replication jobs used _bulk_get they didn't upload design
docs individually like they do when not using _bulk_get.

Here were are preserving an already existing behavior which we had in the
replicator without _bulk_get usage for more than 2 years. It was introduced
here in #2426. Related to these issues #2415 and #2413.

Add tests to cover both attachments and ddoc cases. meck:num_calls/3 is helpful
as it allows to nicely assert which API function was called and how many times.
@nickva nickva force-pushed the fix-invididual-design-docs-replication branch from 4f27156 to 7292a50 Compare January 12, 2023 18:46
@nickva
Copy link
Contributor Author

nickva commented Jan 12, 2023

Updated with the minor optimization and added references in the commit message and PR comment to the previous PR which introduced this behavior and the related issue.

@rnewson
Copy link
Member

rnewson commented Jan 13, 2023

@nickva thanks for the links. It still seems to be a (perhaps necessary) hack around a problem elsewhere. We should do The Right Thing for any _bulk_doc write that writes multiple design documents. It is not right imo to just teach our replicator to avoid triggering those bugs, no other client will be similarly protected.

@nickva
Copy link
Contributor Author

nickva commented Jan 13, 2023

@rnewson with the replicator we are trying to be compatible even with old, or possibly broken clients. But most of all, in this PR, we are trying to bring back the previous behavior before the recent _bulk_get optimization. Currently, it's odd that the there is a difference based on whether [replicator] use_bulk_get is toggled or not.

So agree, we should do the right thing, but it should be in a separate PR. If we don't want this behavior we'd rip it out regardless of _bulk_get feature usage.

@nickva nickva merged commit a14922f into main Jan 13, 2023
@nickva nickva deleted the fix-invididual-design-docs-replication branch January 13, 2023 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants