Hello David Ribeiro Alves, Todd Lipcon, Alexey Serbin,
I'd like you to do a code review. Please visit
http://gerrit.cloudera.org:8080/7717
to review the following change.
Change subject: consensus: Improve contract for API to fetch last-logged op id
......................................................................
consensus: Improve contract for API to fetch last-logged op id
It's important that we differentiate between when we have a known
last-logged op and when we don't actually know what it is or whether we
have ever appended something to the local WAL. This applies both to the
TABLET_DATA_READY case, where this information is stored in the WAL, and
the TABLET_DATA_TOMBSTONED case, where this information is stored in the
superblock.
Cases where we are unable to determine the last-logged OpId from the WAL
when a replica is in TABLET_DATA_READY state:
* Early in the tablet replica lifecycle (before Raft is started).
* When a replica encounters an error during initialization.
Cases where we are unable to determine the last-logged OpId from the
TabletMetadata when a replica is in TABLET_DATA_TOMBSTONED state:
* If the replica was tombstoned while in a failed state.
Included in this patch are the following API improvements:
1. Delete Log::GetLatestEntryOpId(). Previously, this method would only
return something other than MinimumOpId() if a log entry had been
appended during the object's lifetime. It is abandoned in favor of
RaftConsensus::GetLastOpId(RECEIVED_OPID) which delegates to
PeerMessageQueue::GetLastOpIdInLog().
2. Merge PeerMessageQueue::Init() into the PeerMessageQueue constructor.
This allows us to remove one lifecycle state and allows us to
guarantee that, once the queue is constructed, we can always get a
valid last-logged opid from it (see #1).
3. Make TabletMetadata::tombstone_last_logged_opid() return a
boost::optional<OpId>. We need to clearly differentiate between when
we know the last-logged opid and when we don't. We also consider
MinimumOpId() to be equal to boost::none at superblock load time,
since previous versions of Kudu may have written (0,0) into the
TabletMetadata 'tombstone_last_logged_opid' field.
Change-Id: Ia4e4501a61cd40fdee0dc918b77675a0bc2515e7
---
M src/kudu/consensus/consensus_peers-test.cc
M src/kudu/consensus/consensus_queue-test.cc
M src/kudu/consensus/consensus_queue.cc
M src/kudu/consensus/consensus_queue.h
M src/kudu/consensus/log.cc
M src/kudu/consensus/log.h
M src/kudu/consensus/mt-log-test.cc
M src/kudu/consensus/raft_consensus.cc
M src/kudu/consensus/raft_consensus.h
M src/kudu/consensus/raft_consensus_quorum-test.cc
M src/kudu/tablet/tablet_metadata.cc
M src/kudu/tablet/tablet_metadata.h
M src/kudu/tablet/tablet_replica-test.cc
M src/kudu/tools/kudu-tool-test.cc
M src/kudu/tserver/tablet_copy_client.cc
M src/kudu/tserver/tablet_copy_source_session.cc
M src/kudu/tserver/tablet_service.cc
M src/kudu/tserver/ts_tablet_manager.cc
18 files changed, 200 insertions(+), 224 deletions(-)
git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/17/7717/1
--
To view, visit http://gerrit.cloudera.org:8080/7717
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia4e4501a61cd40fdee0dc918b77675a0bc2515e7
Gerrit-PatchSet: 1
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Mike Percy <[email protected]>
Gerrit-Reviewer: Alexey Serbin <[email protected]>
Gerrit-Reviewer: David Ribeiro Alves <[email protected]>
Gerrit-Reviewer: Todd Lipcon <[email protected]>