Skip to content

fix: update conformance test to determine if request is full table scan#211

Merged
mutianf merged 3 commits intogoogleapis:mainfrom
kevkim-codes:main
Dec 3, 2024
Merged

fix: update conformance test to determine if request is full table scan#211
mutianf merged 3 commits intogoogleapis:mainfrom
kevkim-codes:main

Conversation

@kevkim-codes
Copy link
Contributor

The NodeJS CBT client fails the TestReadRows_Retry_PausedScan test with the following error message:

(*bigtablepb.ReadRowsRequest)(Inverse(protocmp.Transform, protocmp.Message{
  	"@type":      s"google.bigtable.v2.ReadRowsRequest",
+ 	"rows":       s"{row_ranges:[{}]}",
  	"table_name": string("projects/project/instances/instance/tables/table"),
}))

This is due to the fact that if the original request is a full table scan, the client request will look different on a retry (the rows might not exist or if it does the rows will be an object with an empty array because there are no row_keys). This was causing a false diff failure in the conformance test so we're updating this conformance test to handle this edge case.

More info at: b/380268261

@conventional-commit-lint-gcf
Copy link

🤖 I detect that the PR title and the commit message differ and there's only one commit. To use the PR title for the commit history, you can use Github's automerge feature with squashing, or use automerge label. Good luck human!

-- conventional-commit-lint bot
https://conventionalcommits.org/

t.Errorf("diff found (-want +got):\n%s", diff)
origRows := origReq.req.GetRows()
// Check if rows or row ranges are present in requests
if origRows == nil || origRows.GetRowRanges() == nil || len(origRows.GetRowRanges()) == 1 {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we should verify that getRowRanges is an empty range

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can you clarify what you mean by that with an example?

Copy link
Collaborator

Choose a reason for hiding this comment

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

if we're checking len(originRows.GetRowRanges) = 1, does that mean [{keyA, keyB}] will also be valid? But we want to verify it's [{}].

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added extra check.

if diff := cmp.Diff(clientReq, origReq.req, protocmp.Transform(), protocmp.IgnoreEmptyMessages()); diff != "" {
t.Errorf("diff found (-want +got):\n%s", diff)
origRows := origReq.req.GetRows()
// Check if rows or row ranges are present in requests
Copy link
Collaborator

@mutianf mutianf Dec 3, 2024

Choose a reason for hiding this comment

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

Also can we update the comment to something like: "This check is a workaround for nodejs client. In nodejs, we add an empty row range to a full table scan request to simplify the resumption logic."

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.

if origRows == nil || origRows.GetRowRanges() == nil || len(origRows.GetRowRanges()) == 1 {
// Check if rows or row ranges are present in requests. This is a workaround for the NodeJS client.
// In Node we add an empty row range to a full table scan request to simplify the resumption logic.
if origRows == nil || origRows.GetRowRanges() == nil || (len(origRows.GetRowRanges()) == 1 && len(origRows.GetRowKeys()) == 0){
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's split this up:

if origRows == nil || origRows.GetRowRanges() == nil {
// skip
} else if len(origRows.getRowRanges()) == 1 && origRows.getRowRanges().getStartKey() == nil && origRows.getRowRanges().getEndKey() == nil {
// skip
} else {
t.Errorf("diff found... ")
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants