Details
-
Improvement
-
Resolution: Unresolved
-
Minor
-
None
-
Security Level: Public
-
None
Description
couchstore_save_document updates the db_seq field of the input DocInfo to reflect the assigned sequence number. But it doesn't update other fields that are affected by the save: bp, size and deleted. This means that after the call the DocInfo isn't an accurate reflection of the document state. In particular, you can't later use the same DocInfo with couchstore_open_doc_with_docinfo to efficiently retrieve the data — you'll just get an error, because the 'bp' field isn't set.
Internally, CouchStore does update all the fields of the DocInfo, but it does it to a copy of the struct, not the original (see the function add_doc_to_update_list). I think we just need to propagate the changed struct into the original the caller passes in.