Todd Lipcon has submitted this change and it was merged.

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
Reviewed-on: http://gerrit.cloudera.org:8080/2577
Tested-by: Kudu Jenkins
Reviewed-by: Todd Lipcon <[email protected]>
---
M src/kudu/master/catalog_manager.cc
M src/kudu/master/master-test.cc
2 files changed, 83 insertions(+), 29 deletions(-)

Approvals:
  Todd Lipcon: Looks good to me, approved
  Kudu Jenkins: Verified



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

Gerrit-MessageType: merged
Gerrit-Change-Id: I05ab48d5a9dd328b4a74f5dc35c710cd1c01f3cd
Gerrit-PatchSet: 3
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Adar Dembo <[email protected]>
Gerrit-Reviewer: Adar Dembo <[email protected]>
Gerrit-Reviewer: David Ribeiro Alves <[email protected]>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Todd Lipcon <[email protected]>

Reply via email to