Mike Percy has posted comments on this change.

Change subject: Create ConsensusMetadataService
......................................................................


Patch Set 2:

(19 comments)

http://gerrit.cloudera.org:8080/#/c/7191/2/src/kudu/consensus/consensus_meta_service-test.cc
File src/kudu/consensus/consensus_meta_service-test.cc:

PS2, Line 31: ConsensusMetadataServiceTest
> how does overwrite behave? is it allowed? likely should have a test.
Done


PS2, Line 38: OVERRIDE
> use c++11 style overrides
Done


PS2, Line 68: ASSERT_OK(cmeta_service_->Load(kTabletId, &cmeta));
> no testing that it matches what you expect?
Done


http://gerrit.cloudera.org:8080/#/c/7191/2/src/kudu/consensus/consensus_meta_service.cc
File src/kudu/consensus/consensus_meta_service.cc:

PS2, Line 42:   RETURN_NOT_OK(ConsensusMetadata::Create(fs_manager_, tablet_id, 
fs_manager_->uuid(),
            :                                           config, current_term, 
cmeta_out));
> is it strictly necessary to do the create under the lock?
I was thinking it would be a rare enough operation but I suppose it was a bit 
too simplistic. I've updated this with a scheme that involves a map and a 
condition variable to get callers to block on outstanding operations on the 
cmeta instance they are accessing instead of holding the lock across the whole 
set while performing I/O.


http://gerrit.cloudera.org:8080/#/c/7191/2/src/kudu/consensus/consensus_meta_service.h
File src/kudu/consensus/consensus_meta_service.h:

PS2, Line 33: ConsensusMetadataService
> class header doc
Done


PS2, Line 39:   // On success, returns OK.
> nit: we generally omit this (otherwise all the methods would have to have i
Done


PS2, Line 51: // Delete the ConsensusMetadata instance keyed by 'tablet_id'.
> is the delete permanent, or do we leave something lying around? can you tal
Permanent. Done


PS2, Line 53: // Returns an error if the cmeta instance exists but cannot be 
deleted.
> why wouldn't we be able to delete it?
Could be a FS permissions issue or something like that.


http://gerrit.cloudera.org:8080/#/c/7191/2/src/kudu/consensus/raft_consensus_quorum-test.cc
File src/kudu/consensus/raft_consensus_quorum-test.cc:

PS2, Line 575:  
> nit no longer need to leave this space
Done


http://gerrit.cloudera.org:8080/#/c/7191/2/src/kudu/integration-tests/tablet_copy-itest.cc
File src/kudu/integration-tests/tablet_copy-itest.cc:

PS2, Line 56: using kudu::consensus::ConsensusMetadataService;
> nit: "consensus" goes after "client" :)
ah, right :)


http://gerrit.cloudera.org:8080/#/c/7191/2/src/kudu/integration-tests/ts_recovery-itest.cc
File src/kudu/integration-tests/ts_recovery-itest.cc:

Line 25: #include "kudu/consensus/log-test-base.h"
> warning: #includes are not sorted properly [llvm-include-order]
Done


http://gerrit.cloudera.org:8080/#/c/7191/2/src/kudu/tablet/tablet_bootstrap.cc
File src/kudu/tablet/tablet_bootstrap.cc:

Line 78: 
> spurious change
Done


PS2, Line 169: meta
> consider renaming this param to "tablet_meta"
I did consider it but I think if we want to do that it should be a separate 
patch. It's literally everywhere.


http://gerrit.cloudera.org:8080/#/c/7191/2/src/kudu/tablet/tablet_replica-test.cc
File src/kudu/tablet/tablet_replica-test.cc:

PS2, Line 24: #include "kudu/common/wire_protocol.h"
> interesting, I'd think this one came before the one above, but apparently n
Yeah... llvm-tidy's lexicographic include sort order is mostly fine but I don't 
like this quirk either (- before . before _ in ASCII)


Line 62: using consensus::OpIdEquals;
> warning: using decl 'OpIdEquals' is unused [misc-unused-using-decls]
Done


http://gerrit.cloudera.org:8080/#/c/7191/2/src/kudu/tserver/tablet_copy_client.cc
File src/kudu/tserver/tablet_copy_client.cc:

PS2, Line 104:  cmeta_service_(std::move(cmeta_service)),
> I see you're using move there but const refs elsewhere? any particular reas
In this case we are holding a ref to the cmeta service so as long as that's the 
case this makes sense.

As of C++11 this approach is easier for the compiler to optimize from what I 
understand. There are a bunch of articles on this around, e.g. 
http://www.codesynthesis.com/~boris/blog/2012/06/19/efficient-argument-passing-cxx11-part1/

In general we are trying to prefer pass-by-value + move over pass-by-constref + 
copy. Of course, in cases where you don't plan to copy, pass-by-constref 
probably still makes more sense.


http://gerrit.cloudera.org:8080/#/c/7191/2/src/kudu/tserver/tablet_copy_client.h
File src/kudu/tserver/tablet_copy_client.h:

PS2, Line 74: scoped_refptr
> use const ref
this is legit because TabletCopyClient keeps a ref to ConsensusMetadataService


http://gerrit.cloudera.org:8080/#/c/7191/2/src/kudu/tserver/ts_tablet_manager.cc
File src/kudu/tserver/ts_tablet_manager.cc:

PS2, Line 1067: const scoped_refptr<consensus::ConsensusMetadataService>&
> if you don't need to increase the refcount consider passing a raw pointer
Why? Passing it this way provides useful information, i.e. that this is 
refcounted, and passing a const ref doesn't increment the refcount so there is 
no perf hit.


http://gerrit.cloudera.org:8080/#/c/7191/2/src/kudu/tserver/ts_tablet_manager.h
File src/kudu/tserver/ts_tablet_manager.h:

PS2, Line 289: const
> does the const server a purpose here?
It simply enforces the invariant that it's set (actually, it's created) in the 
constructor and that the instance is never replaced, so we get a 
per-TSTabletManager "singleton".


-- 
To view, visit http://gerrit.cloudera.org:8080/7191
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ia30c05dd0feec2b7530205f4d17dfc079a1c3451
Gerrit-PatchSet: 2
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Mike Percy <mpe...@apache.org>
Gerrit-Reviewer: Alexey Serbin <aser...@cloudera.com>
Gerrit-Reviewer: David Ribeiro Alves <davidral...@gmail.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Mike Percy <mpe...@apache.org>
Gerrit-Reviewer: Tidy Bot
Gerrit-HasComments: Yes

Reply via email to