Skip to content

Conversation

@coryan
Copy link
Contributor

@coryan coryan commented Dec 23, 2017

This fixes #79. In this PR we introduced the remaining TableAdmin functions, and provide an integration test for the class. There are missing integration tests for DropRows*, because their implementation would be overly complicated until #32 is done. There is a separate issue (#141) to track this.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Dec 23, 2017
@coryan coryan requested review from carterpage and garye December 23, 2017 15:20
Copy link

@carterpage carterpage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work. A few nits here and there.


void TableAdmin::DeleteTable(std::string table_id) {
btproto::DeleteTableRequest request;
request.set_name(CreateTableName(table_id));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mentioned in the other review, but I find "CreateTableName" confusing vs "TableName". "Create" generally implies state changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.


private:
/// Compute the fully qualified instance name.
std::string CreateInstanceName() const;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change to InstanceName()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

std::string CreateInstanceName() const;

/// Return the fully qualified name of a table in this object's instance.
std::string CreateTableName(std::string const& table_id) const {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change to TableName()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

}
modifications {
id: 'bar'
update { gc_rule { max_age { seconds: 172800 }}}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe make this different (eg 24h) than the other rule, to make sure the values don't get mixed up.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

throw std::runtime_error(os.str());
}
std::cout << "GetTable(table1) successful" << std::endl;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do a paranoid check that ListTables now returns two tables, since you're about to check after delete that list returns 1 once again.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

}
std::cout << "ListTables() after DeleteTable() successful" << std::endl;

using GC = bigtable::GcRule;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After all the state changes above, it takes too much effort to reason about the current state and how the below modification should change it.

Create a new table right above the ModifyColumnFamilies call to make it easier to see the before/after side-by-side.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.
At least I tried to make it easier to read, let me know if it needs further work.

#include "bigtable/admin/admin_client.h"
#include "bigtable/admin/table_admin.h"

int main(int argc, char* argv[]) try {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't super extensible as a one-method test. I'd suggest breaking it into two methods you invoke from main, first one testing create+get+delete operations, and the second testing column family modification.

It would be nice if there were a comment with simple description of the test. Even "Integration test to create and delete some tables" is sufficient.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.


echo
echo "Running TableAdmin integration test."
./admin_test emulated admin-tests

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

File names are confusing. They are both integration tests. Can we change them to data_integration_test and admin_integration_test or at least something consistent?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@coryan
Copy link
Contributor Author

coryan commented Dec 24, 2017

PTAL.

@coryan coryan force-pushed the minimal-admin-client-t6 branch from 35f2c12 to 8ee2015 Compare December 28, 2017 03:06
@coryan coryan merged commit 38396fe into googleapis:master Dec 28, 2017
@coryan coryan deleted the minimal-admin-client-t6 branch December 28, 2017 03:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create a client library for the Admin API.

3 participants