Will Berkeley has posted comments on this change. Change subject: KUDU-1755 Part 2: Improve tablet on-disk size metric ......................................................................
Patch Set 10: (11 comments) http://gerrit.cloudera.org:8080/#/c/6968/10/src/kudu/consensus/consensus_meta.h File src/kudu/consensus/consensus_meta.h: Line 153: return on_disk_size_; > Can we say this is thread-safe and use an atomic? Done PS10, Line 241: uint64_t > how about atomic and int64_t because there is just no way we are going to n Done http://gerrit.cloudera.org:8080/#/c/6968/10/src/kudu/consensus/log.cc File src/kudu/consensus/log.cc: PS10, Line 922: CHECK_OK > Do we need this CHECK? Also, can we make this safe to run even if log_ is s Done http://gerrit.cloudera.org:8080/#/c/6968/10/src/kudu/consensus/log.h File src/kudu/consensus/log.h: PS10, Line 201: TotalSize > maybe name this OnDiskSize() for consistency? Done http://gerrit.cloudera.org:8080/#/c/6968/10/src/kudu/consensus/raft_consensus.cc File src/kudu/consensus/raft_consensus.cc: Line 2645: UniqueLock lock(lock_); > If we make cmeta_->on_disk_size() thread-safe, then we can avoid taking the Done http://gerrit.cloudera.org:8080/#/c/6968/10/src/kudu/tablet/diskrowset.cc File src/kudu/tablet/diskrowset.cc: Line 690: shared_lock<rw_spinlock> l(component_lock_); > 1. Can we just take a ref to base_data_ instead of holding the component_lo 1. I think you are right, but the pattern in the class is to use component_lock_ whenever doing anything with base_data_. Is there a reason to prefer taking a ref over acquiring the lock briefly? 2. Done. http://gerrit.cloudera.org:8080/#/c/6968/10/src/kudu/tablet/rowset.h File src/kudu/tablet/rowset.h: Line 115: virtual Status DebugDump(std::vector<std::string> *lines = NULL) = 0; > warning: default arguments on virtual or override methods are prohibited [g Pre-existing; ignored. http://gerrit.cloudera.org:8080/#/c/6968/10/src/kudu/tablet/tablet_replica.cc File src/kudu/tablet/tablet_replica.cc: PS10, Line 377: OnDiskSizeNoCMetaUnlocked > why the "no cmeta" version? could use a comment I think that was a mistake, a leftover from a previous version. There's no need for that method at all now. PS10, Line 645: auto consensus = consensus_; : if (consensus) { > because consensus_ is set-once, this can be written as: Adar had misgivings about this form. The comment was in PS10 but I'll reproduce it here for convenience: "This isn't safe; you need to take a local ref of consensus_ and then test it for nullitude. Or you need to make the call with lock_ held, which guarantees that consensus_ isn't modified. Okay, I went and read the comments in TabletReplica which talk about how consensus_ is a "set-once" object. That seems bogus to me, though admittedly I'm not an expert on this code. TabletReplica::Shutdown() resets consensus_ with lock_ held. Can we guarantee that when Shutdown() is called, no other thread (besides the one calling Shutdown()) will invoke a TabletReplica function? I don't see how we can (hence the fragility). And if we can't, then consensus_ access needs to be atomic, either by taking a local ref then operating on it, or by acquiring lock_ first." PS10, Line 656: size_t > Can we use int64_t instead of size_t? We are never going to have 64-bit len Done PS10, Line 660: if (tablet_) { : ret += tablet_->OnDiskSize(); : } : // WAL segments. : if (state_ == RUNNING) { : ret += log_->TotalSize(); : } > Instead of doing this work while holding TabletReplica::lock_, can this be Done -- To view, visit http://gerrit.cloudera.org:8080/6968 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ia83f8aae0a544abbd19f5a34520b4828b89b6315 Gerrit-PatchSet: 10 Gerrit-Project: kudu Gerrit-Branch: master Gerrit-Owner: Will Berkeley <wdberke...@gmail.com> Gerrit-Reviewer: Adar Dembo <a...@cloudera.com> Gerrit-Reviewer: Kudu Jenkins Gerrit-Reviewer: Mike Percy <mpe...@apache.org> Gerrit-Reviewer: Tidy Bot Gerrit-Reviewer: Todd Lipcon <t...@apache.org> Gerrit-Reviewer: Will Berkeley <wdberke...@gmail.com> Gerrit-HasComments: Yes