Hello Dan Burkert, Jean-Daniel Cryans, Todd Lipcon,
I'd like you to do a code review. Please visit
http://gerrit.cloudera.org:8080/8026
to review the following change.
Change subject: KUDU-1807 (part 1): ban GetTableSchema for table createdness in
clients
......................................................................
KUDU-1807 (part 1): ban GetTableSchema for table createdness in clients
Improving IsCreateInProgress performance in the master is very challenging
due to the myriad of locks in play. A simpler alternative would be to get it
off any critical paths. It's currently called by the IsCreateTableDone and
GetTableSchema RPCs. The former makes sense but the latter does not: if we
need to know whether a table has been created, well, that's what the
IsCreateTableDone RPC is for.
So, does anyone use the "is table done creating" aspect of GetTableSchema?
The C++ client doesn't, but the Java client does. As luck would have it, the
Java client is already written to fall back to IsCreateTableDone if
GetTableSchema says the table is still being created, which means we can
safely modify the master to always return false in this field without
breaking old Java clients.
Meanwhile, this patch modifies new Java clients to no longer use that field.
After the CreateTable RPC returns, the client will enter an IsCreateTableDone
loop, and when that's done, it'll issue a GetTableSchema to fetch the schema
and build a KuduTable.
There are a couple other changes worth noting:
- openTable no longer waits for table creation before returning. Doing that
now would require at least one IsCreateTableDone RPC, which unnecessarily
slows down table opening in the common case. The C++ client doesn't do
this, so I don't see why the Java client should.
- I removed the 'tablesNotServed' logic which, AFAICT, had no useful effect
since clients are supposed to wait for tables to be fully created before
writing/scanning anyway.
- I removed the master permit acquisition from the "is create table done"
loop, since these loops should no longer produce a thundering herds (as I
suppose they could have due to 'tablesNotServed').
- Even though createTable waits for table creation to finish, I added an
isCreateTableDone method to help synchronized the use case where multiple
clients or threads all create and open a table concurrently (e.g. YCSB).
Change-Id: I54fa07dc34a97f1c9da06ec9129d6d4590b7aac6
---
M java/kudu-client/src/main/java/org/apache/kudu/client/AsyncKuduClient.java
M java/kudu-client/src/main/java/org/apache/kudu/client/CreateTableRequest.java
M java/kudu-client/src/main/java/org/apache/kudu/client/CreateTableResponse.java
M java/kudu-client/src/main/java/org/apache/kudu/client/DeadlineTracker.java
M
java/kudu-client/src/main/java/org/apache/kudu/client/GetTableSchemaRequest.java
M
java/kudu-client/src/main/java/org/apache/kudu/client/GetTableSchemaResponse.java
M
java/kudu-client/src/main/java/org/apache/kudu/client/IsCreateTableDoneRequest.java
A
java/kudu-client/src/main/java/org/apache/kudu/client/IsCreateTableDoneResponse.java
M java/kudu-client/src/main/java/org/apache/kudu/client/KuduClient.java
M java/kudu-client/src/test/java/org/apache/kudu/client/TestDeadlineTracker.java
M
java/kudu-client/src/test/java/org/apache/kudu/client/TestFlexiblePartitioning.java
M java/kudu-client/src/test/java/org/apache/kudu/client/TestKuduClient.java
12 files changed, 340 insertions(+), 241 deletions(-)
git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/26/8026/1
--
To view, visit http://gerrit.cloudera.org:8080/8026
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I54fa07dc34a97f1c9da06ec9129d6d4590b7aac6
Gerrit-PatchSet: 1
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Adar Dembo <[email protected]>
Gerrit-Reviewer: Dan Burkert <[email protected]>
Gerrit-Reviewer: Jean-Daniel Cryans <[email protected]>
Gerrit-Reviewer: Todd Lipcon <[email protected]>