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 design doc/view creation when already present #3119

Closed
adamcfraser opened this Issue Dec 6, 2017 · 1 comment

Comments

Projects
None yet
2 participants
@adamcfraser
Copy link
Contributor

adamcfraser commented Dec 6, 2017

Currently Sync Gateway will attempt to create design docs/views on startup, and rely on the view engine on Couchbase Server to identify duplicates.

This creates unwanted work on Couchbase Server, and has the potential for more serious view engine issues in conjunction with issues like https://issues.couchbase.com/browse/MB-16737.

It should be possible for Sync Gateway to stamp design docs with a version number, and check for that version on existing design docs before attempting to recreate.
Details from the view engine team:

it is possible to set a filed in design doc, with a key like "sg_version" and value of the sg version. When you read the design document (using GET methond) this is returned to you. For example you can PUT a design document ddoc1 with view definition as

{
--
"views" : {
"view1": {
"map" : "function(doc, meta){emit(doc.id, meta);}"
}
},
"SG_Version" : "sg_15_xxx"
}

And you can get this by doing GET curl call


curl -X GET -H 'Content-Type: application/json' http://Administrator:asdasd@localhost:9500/default/_design/ddoc1
--
{"views":{"view1":{"map":"function(doc, meta){emit(doc.id, meta);}"}},"SG_Version":"sg_15_xxx"}

We should consider enhancing Sync Gateway to follow this approach on startup, until we move to GSI.

@adamcfraser adamcfraser added this to the 2.0.0 milestone Dec 6, 2017

@djpongh djpongh removed the P2: medium label Dec 19, 2017

@djpongh djpongh modified the milestones: 2.0.0, 2.1.0 Dec 19, 2017

@djpongh djpongh added the icebox label Dec 19, 2017

@djpongh djpongh added the P2: medium label Jan 31, 2018

@adamcfraser

This comment has been minimized.

Copy link
Contributor

adamcfraser commented Feb 2, 2018

Fixed in 2.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment