-
Notifications
You must be signed in to change notification settings - Fork 138
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
Refactor document code, and avoid [un]marshaling doc bodies #6108
base: main
Are you sure you want to change the base?
Conversation
5df9a94
to
f811b49
Compare
f811b49
to
d07305f
Compare
- JSONExtract now uses a callback to delegate the logic about which keys are special/reserved. - implemented JSONExtract for CE - DocumentRevision calls JSONExtract, handles special properties.
# Conflicts: # rest/replicatortest/replicator_test.go
Body changed to UnmarshalBody. Removed some usages of both methods, working with JSON data instead.
- RevisionCache.GetRevision no longer returns a Body - Removed body field from revCacheValue struct
…replication protocol (#6242)
@snej You indicate that there are no functional changes in this PR - how does that apply to the changes around unmarshalling document bodies? Can you summarize the changes being made to that functionality? |
@adamcfraser In this PR the document bodies are still unmarshaled when passed to JS (Otto). That will change with the V8 PR, at least when V8 is enabled; there we pass the JSON as a string and unmarshal it in JavaScript which is more efficient. Otherwise, incoming doc bodies are still validated to make sure they don't contain illegal/reserved properties, but that's done without unmarshaling. The JSON does get parsed, but without converting it to Go objects which is the expensive part. |
* remove cached buckets * Add refcounting for parallel calls to get buckets
* Update waiting error message from generic message Co-authored-by: Ben Brooks <[email protected]>
* Tweak TestIncrCounter to cover non-equal `def` and `amt` values * Allow zero value in `amt` for Collection.Incr - will write `def` to bucket if counter does not exist
* CBG-2983 Close cbgt agents on database close Manager.Stop() doesn’t close cbgt’s gocb agents - partly because the fts use case is to have one manager that exists for the lifetime of the process. For SG’s usage, where manager lifecycle is bound to a database, we need to shut down these agents when we close the database/importListener. * Improve inline documentation for CloseStatsClients call
* CBG-3001 Avoid bucket retrieval error during OnFeedClose OnFeedError was checking for bucket existence to determine whether to call NotifyMgrOnClose(). This handling isn't necessary for SG, as we want database close to handle shutdown of the import feed (via importListener.Stop()) in the case of a deleted bucket.
# Conflicts: # documents/revision_cache_interface.go
…6258) * CBG-2793: attachment compaction code erroneously sets failOnRollback * spelling errors and test logging removal + lint error * updates for comments and try fix race condition * linter error fix * changes for jenkins * updates to add handling for cleanup phase * remove logging line * fix race in Jenkins * updates to fix collections issue * updates based off comment * updates * updates to address complexity comments
Created a perf testing task CBPS-1176 for this. |
# Conflicts: # go.mod # go.sum
Perf results show a decent ~5% improvement in throughput (and accompanying reduction in CPU) - we should go ahead and review/merge based on this. |
CBG-2951
Moved most of the Document, Revision and RevTree code, and a lot of Attachment stuff, out of the db package into a new
document
package. (I'm not wild about that name, butdoc
would conflict with the very common parameter namedoc
, anddocs
is already taken as a directory.) Two reasons for this:Document
, protect their private fields from being groped by other code in the db package. There's a fair bit of this going on with the_body
and_rawBody
fields.)db
package is really big and it would be nice to have smaller packages, IMHO, just for readability and code navigation.To reduce the number of diffs, I created a file
db/doc_model.go
that creates aliases for many of the types and constants that were moved. I also added an alias for the functionParseRevID
because there are so damn many calls to it.To cope with the code in db that touched Document's
_body
and_rawBody
fields, I added methodsPeekBody
,PokeBody
,PeekRawBody
,PokeRawBody
. These can be removed after the code that calls them is fixed.There are no functional changes in this PR; everything should behave exactly as before.
Pre-review checklist
fmt.Print
,log.Print
, ...)base.UD(docID)
,base.MD(dbName)
)docs/api
Dependencies (if applicable)
Integration Tests
GSI=true,xattrs=true
https://jenkins.sgwdev.com/job/SyncGateway-Integration/000/