[ 
https://issues.apache.org/jira/browse/COUCHDB-1391?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13194961#comment-13194961
 ] 

Paul Joseph Davis commented on COUCHDB-1391:
--------------------------------------------

> Can you explain couch_db.erl:705? Why did the list brackets appear around the 
> doc? I'm guessing that's the format new_revs wants. 

Lots of code I reused wants to have lists of docs with the same _id. Instead of 
rewriting everything else I just used the same structure.

> add a clause to get_doc_infos/2.

Do you mean get_full_doc_infos? If so, that seems like it should work quite 
nicely. I'll take a crack at that this afternoon.

> the line "Db1#db{security_ptr=local};" is redundant

Good catch. Will fix.

> Am I right that at these lines update a db as soon as it's opened?

Yep.

> I was wondering why I didn't see more backwards-compatibility code anywhere.

That's mostly all there is. I realized last night that I have to wrap the local 
docs btree split fun to upgrade docs on the fly, but that should be simple 
enough.

> couch_db_updater:init_security/2 needs to be fixed

Good catch. That should be passing Db0 to update_local_docs/2.

> Any reason why copy_docs can't be changed to take a btree argument?

Yes, copy_docs is working with the by_seq btree which doesn't work for local 
docs. I contemplated refactoring here, but for now I'd just erred on the side 
of caution. After having spelunked through this code I've decided that a real 
fix is going to require me groking couch_db.erl and couch_db_updater.erl and 
doing similar level refactor to what I did for the view engine.

> What's the change in couch_replicator?

This was me not understanding the replicator / thinking very hard. I'm going to 
rewrite the split fun for the local docs btree to automatically upgrade old 
_local docs records on the fly which should make this code unnecessary.

Thanks for the review. I'll get a revised version up tonight or tomorrow 
depending on time.

                
> Implement _security as _local doc with revision trees
> -----------------------------------------------------
>
>                 Key: COUCHDB-1391
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-1391
>             Project: CouchDB
>          Issue Type: Improvement
>          Components: Database Core
>            Reporter: Paul Joseph Davis
>         Attachments: 0001-Refactor-revision-merging.patch, 
> 0002-Replace-_local-doc-sequence-with-revision-trees.patch, 
> 0003-Prevent-multiple-updates-to-a-single-_local-doc.patch, 
> 0004-Implement-_security-as-a-_local-doc.patch
>
>
> We had a discussion [1] a while back about updating the _security object so 
> that it could be replicated (internally) in a cluster or similar environment. 
> The basic gist was "update _local docs to have a revision tree, update 
> _security to be a _local doc with docid "_local/_security" and keep the 
> current _security API for a version or two for backwards compatibility (or 
> forever, what color is your bike shed?)"
> So I did that.
> Basic patch progression is:
> 1. Refactor revision merging logic so that we can split it out of 
> couch_db_updater's code path for updating normal docs.
> 2. Implement _local docs with #full_doc_info{} records (and thus revision 
> trees)
> 3. Implement _security as _local/_security
> These things are done. Tests should theoretically pass after each patch but I 
> haven't gone back and tried. They definitely pass (minus auth_cache which I 
> just submitted a fix for) now except for replication.js appears to fail for 
> random reasons. I can't quite decide if I've introduced this or if it just 
> fails randomly. Rather than run it a lot more times and continue to be 
> confused I'm starting this ticket so I can have other people test and tell me 
> their results.
> Also, the test suite is rather wonky on trunk with segfaults. We should 
> really look into that more.
> Patches forth coming. I've also pushed the branch to [2].
> [1] 
> http://grokbase.com/t/couchdb.apache.org/dev/2011/08/the-security-object-should-be-versioned/17rfmmtlu3lagqvgyq7cay26dqk4
> [2] 
> http://git-wip-us.apache.org/repos/asf?p=couchdb.git;a=log;h=refs/heads/new-security-object

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to