Uh oh!
There was an error while loading. Please reload this page.
Bigtable 9b. Implement ReadRows row merging logic. - #2914
Conversation
This PR sets the stage for ReadRows by implementing the row merging in a RowMergingCallable. In a future commit, this callable will be part of a chain that will implement the ReadRowsCallable chain. For now its disconnected. The implementation relies on ReframingResponseObserver to handle flow control and integrates with it by implementing the Reframer interface in RowMerger. The RowMerger, simply glues the Reframer api to the StateMachine. The StateMachine contains all of the logic of merging rows.
| if (byteA == byteB) { | ||
| continue; | ||
| } | ||
| return byteA < byteB ? -1 : 1; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| if (sizeA == sizeB) { | ||
| return 0; | ||
| } | ||
| return sizeA < sizeB ? -1 : 1; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| buffer = response; | ||
| nextChunk = 0; | ||
| // If the server sends a scan heartbeat, wrap it in a synthetic row that will be be filtered out |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| nextChunk = 0; | ||
| // If the server sends a scan heartbeat, wrap it in a synthetic row that will be be filtered out | ||
| // after the resume logic. |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| @Override | ||
| public boolean hasFullFrame() { | ||
| return nextRow != null || readNextRow(); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| * <p>Package-private for internal use. | ||
| */ | ||
| @InternalApi | ||
| class RowMerger<RowT> implements Reframer<RowT, ReadRowsResponse> { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| @Override | ||
| public boolean hasPartialFrame() { | ||
| return hasFullFrame() || stateMachine.isRowInProgress(); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| @Override | ||
| public RowT pop() { | ||
| RowT row = nextRow; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
igorbernstein2
commented
Feb 20, 2018
Ok, I think I addressed all of Kevin's feedback. @pongad@garrettjonesgoogle, this should be ready for you |
kevinsi4508
commented
Feb 21, 2018
LGTM, please ask Gary to take a look as well. |
igorbernstein2
commented
Feb 21, 2018
@garye can you take a look as well? |
| * | ||
| * <ul> | ||
| * <li>Logical rows that were constructed using the {@link RowBuilder} | ||
| * <li>Special marker rows that represent resumption points that were sent by Last scanned row |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| /** | ||
| * Feeds the last scanned serverside key into the state machine. The adapter will wrap this key in | ||
| * a special marker row that can be used downstream for efficient resume. It is the callers | ||
| * responsibility to eventually filter out this row. |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| /** | ||
| * Feeds the last scanned serverside key into the state machine. The adapter will wrap this key in | ||
| * a special marker row that can be used downstream for efficient resume. It is the callers |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| * <dt>Valid states: | ||
| * <dd>{@link StateMachine#AWAITING_NEW_ROW} | ||
| * <dt>Resulting states: | ||
| * <dd>{@link StateMachine#AWAITING_ROW_CONSUME} |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| /** | ||
| * Returns the last completed row and transitions to awaiting a new row. | ||
| * |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| @Override | ||
| State handleChunk(CellChunk chunk) { | ||
| validate(!chunk.getResetRow(), "AWAITING_NEW_ROW: can't reset"); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| rowKey = chunk.getRowKey(); | ||
| adapter.startRow(rowKey); | ||
| // auto transition |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| } | ||
| adapter.finishCell(); | ||
| if (!chunk.getCommitRow()) { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| } | ||
| }; | ||
| private static final State AWAITING_ROW_CONSUME = |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
igorbernstein2
commented
Feb 21, 2018
@garye Thanks for reviewing, I think addressed all feedback. PTAL |
pongad
left a comment
There was a problem hiding this comment.
A few nits but looks good as far as I can tell otherwise. I'm not qualified to fully review the state machine though :(
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package com.google.cloud.bigtable.data.v2.stub.read_rows; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| /** | ||
| * Feeds a new chunk into the sate machine. If the chunk is invalid, the state machine will throw | ||
| * an exception and should be used for further input. |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
igorbernstein2
commented
Feb 21, 2018
Please merge when ready. |
#2914) * chore: Update generation configuration at Tue Mar 18 16:57:20 UTC 2025 * chore: Update generation configuration at Tue Mar 18 17:05:10 UTC 2025 * chore: Update generation configuration at Tue Mar 18 18:42:23 UTC 2025
… to v2.27.3 (#2914) * chore(deps): update dependency com.google.cloud:google-cloud-bigtable to v2.27.3 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
#2914) * chore: Update generation configuration at Tue Mar 18 16:57:20 UTC 2025 * chore: Update generation configuration at Tue Mar 18 17:05:10 UTC 2025 * chore: Update generation configuration at Tue Mar 18 18:42:23 UTC 2025
🤖 I have created a release *beep* *boop* --- ### Updating meta-information for bleeding-edge SNAPSHOT release. --- This PR was generated with [Release Please](https://togithub.com/googleapis/release-please). See [documentation](https://togithub.com/googleapis/release-please#release-please).
This PR sets the stage for ReadRows by implementing the row merging in a RowMergingCallable. In a future commit, this callable will be part of a chain that will implement the ReadRowsCallable chain. For now its disconnected.
The implementation relies on ReframingResponseObserver to handle flow control and integrates with it by implementing the Reframer interface in RowMerger.
The RowMerger, simply glues the Reframer api to the StateMachine.
The StateMachine contains all of the logic of merging rows.
This has not been reviewed yet by anyone on the Bigtable team.
@kevinsi4508 can you take a look at this when you have a (very long) moment?
For reference the reframing logic was merged in this PR:
#2907