Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement bigtable::Table::ReadModifyWriteRow #207

Closed
7 tasks done
coryan opened this issue Jan 31, 2018 · 6 comments
Closed
7 tasks done

Implement bigtable::Table::ReadModifyWriteRow #207

coryan opened this issue Jan 31, 2018 · 6 comments
Assignees
Labels
api: bigtable Issues related to the Bigtable API. 🚨 This issue needs some love. triage me I really want to be triaged.

Comments

@coryan
Copy link
Member

coryan commented Jan 31, 2018

This might require implementing wrappers for ReadModifyWriteRule in the same style as the bigtable::Filter::* wrappers.

This issue should only be closed once the unit and integration tests are written as well as the implementation itself. If it is easier, break down the work in smaller issues before starting.

@coryan coryan added this to the Cloud Bigtable C++ Client: 1.0 release milestone Jan 31, 2018
@coryan coryan added the api: bigtable Issues related to the Bigtable API. label Jan 31, 2018
@coryan coryan changed the title Implement bigtable::Table::CheckAndMutateRow Implement bigtable::Table::ReadModifyWriteRow Jan 31, 2018
@coryan coryan modified the milestones: Cloud Bigtable C++ Client: 1.0 release, Alpha Release Feb 21, 2018
@hemant-qlogic hemant-qlogic self-assigned this Feb 25, 2018
@coryan
Copy link
Member Author

coryan commented Feb 25, 2018

A few observations: we may want to create two separate member functions for this: IncrementValue() and AppendValue(). The API using separate functions is more natural:

class Table { public:
  Row IncrementValue(std::string row_key, std::string family_name, std::string column, std::int64_t value);
  Row AppendValue(std::string row_key, std::string family_name, std::string column, std::string value);

The disadvantage is, of course, that if we ever created a new branch in google.bigtable.v2.ReadModifyWriteRule then we would need to add a new interface.
I think this proposal is more idiomatic in C++, the alternative:

class Table { public:
  Row ReadModifyWrite(std::string row_key, ReadModifyWriteRule rule);
};

is workable, but a bit more awkward, contrast:

table->AppendValue("foo", "fam", "col", ";more-stuff-at-the-end");

vs.

table->ReadModifyWrite("foo", bigtable::AppendValue("fam", "col", ";more-stuff-at-the-end");

@coryan
Copy link
Member Author

coryan commented Mar 6, 2018

@hemant-qlogic Anything to report? Will you able to merge a PR before 2018-03-31? Remember to leave some days for review and fixes in your estimate.

@hemant-qlogic
Copy link
Contributor

Nothing till now, Will able to merge it till sunday

@hemant-qlogic
Copy link
Contributor

My Initial understanding about the point.

  1. table.h => Add method ReadModifyWrite. It has additional rules based on google::bigtable::v2::ReadModifyWriteRule(IncreamentValue, AppendValue).
  2. row_modifier.h ==> Add new class row_modifier (similar as row_reader), which will initiate request of form google::bigtable::v2::ReadModifyWriteRowRequest(bigtable.pb.h) along with the ReadWriteModifyRule
  3. Add test cases for row_modifier.h unit test cases.
  4. Integration Test cases in data_integration_test.cc for ReadModifyWrite function.
  5. ReadModifyWrite should run on a single row?
  6. Only one rule from ReadModifyWrite should apply for single request.
    Is it correct?

@coryan
Copy link
Member Author

coryan commented Mar 6, 2018

  1. table.h => Add method ReadModifyWrite. It has additional rules based on
    google::bigtable::v2::ReadModifyWriteRule(IncreamentValue, AppendValue).

That sounds reasonable, can you describe the prototype for this ReadModifyWrite member function?

  1. row_modifier.h ==> Add new class row_modifier (similar as row_reader), which will initiate request
    of form google::bigtable::v2::ReadModifyWriteRowRequest(bigtable.pb.h) along with the
    ReadWriteModifyRule

It is possible I am missing something here. To me, it looks like RowReader has a lot of functionality to parse the incoming stream, reconstruct the rows, and retry failed RPCs. I also looks to me that the member function you need here is more similar to TableAdmin::ModifyColumnFamilies(), it can be refactored to a call into RpcUtils::CallWithoutRetry. Maybe you can explain why they need the additional class in more detail?

  1. Add test cases for row_modifier.h unit test cases.

If we write the class then we certainly need unit tests for it.

Integration Test cases in data_integration_test.cc for ReadModifyWrite function.

Yes, we will need that.

  1. ReadModifyWrite should run on a single row?

That is correct, the gRPC API is defined here:

https://github.com/googleapis/googleapis/blob/92f10d7033c6fa36e1a5a369ab5aa8bafd564009/google/bigtable/v2/bigtable.proto#L304

and it takes a single row.

  1. Only one rule from ReadModifyWrite should apply for single request.
    Is it correct?

Unfortunately not, I had not noticed this, but multiple rules apply to each request:
https://github.com/googleapis/googleapis/blob/92f10d7033c6fa36e1a5a369ab5aa8bafd564009/google/bigtable/v2/bigtable.proto#L317

@coryan
Copy link
Member Author

coryan commented Mar 23, 2018

Done.

@coryan coryan closed this as completed Mar 23, 2018
@yoshi-automation yoshi-automation added 🚨 This issue needs some love. triage me I really want to be triaged. labels Apr 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigtable Issues related to the Bigtable API. 🚨 This issue needs some love. triage me I really want to be triaged.
Projects
None yet
Development

No branches or pull requests

3 participants