You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kudu.apache.org by "Adar Dembo (Code Review)" <ge...@cloudera.org> on 2016/03/18 02:36:14 UTC

[kudu-CR] master: don't expose intermediate CreateTable() state to consumers

Hello David Ribeiro Alves, Todd Lipcon,

I'd like you to do a code review.  Please visit

    http://gerrit.cloudera.org:8080/2577

to review the following change.

Change subject: master: don't expose intermediate CreateTable() state to consumers
......................................................................

master: don't expose intermediate CreateTable() state to consumers

CreateTable() publishes new tables to the catalog manager maps before
committing the in-memory mutations that populate table metadata. This order
makes sense; if it were inverted, there'd be no safe way for CreateTable()
to atomically check for a table by name and claim that name for itself. As
such, consumers of the maps must ensure that the tables they're retrieving
are fully formed before using them.

Read-write consumers (who lock tables with TableMetadataLock::WRITE) are
already protected by the semantics of the table's underlying
CowLock. Read-only consumers, however, must explicitly check the state of
the table before using it. I audited the various read-only consumers and
added checks where needed.

Not every client call yields enough information to detect this intermediate
state. As far as I can tell, the only testable call is GetTableSchema(), so
that's what I used in the new test. Before the fix, the test failed every
time. Afterwards, it doesn't fail in 1000 repetitions.

Change-Id: I05ab48d5a9dd328b4a74f5dc35c710cd1c01f3cd
---
M src/kudu/master/catalog_manager.cc
M src/kudu/master/master-test.cc
2 files changed, 79 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/77/2577/1
-- 
To view, visit http://gerrit.cloudera.org:8080/2577
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I05ab48d5a9dd328b4a74f5dc35c710cd1c01f3cd
Gerrit-PatchSet: 1
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: David Ribeiro Alves <da...@cloudera.com>
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>