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

bttest: CheckAndMutateRow unable to handle BlockAllFilter #1435

Closed
uschen opened this issue May 24, 2019 · 4 comments
Closed

bttest: CheckAndMutateRow unable to handle BlockAllFilter #1435

uschen opened this issue May 24, 2019 · 4 comments
Assignees
Labels
api: bigtable Issues related to the Bigtable API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@uschen
Copy link

uschen commented May 24, 2019

due to:

	// Figure out which mutation to apply.
	whichMut := false
	if req.PredicateFilter == nil {
		// Use true_mutations iff row contains any cells.
		whichMut = !r.isEmpty()
	} else {
		// Use true_mutations iff any cells in the row match the filter.
		// TODO(dsymonds): This could be cheaper.
		nr := r.copy()
		filterRow(req.PredicateFilter, nr)
		whichMut = !nr.isEmpty()
	}
// filterRow modifies a row with the given filter. Returns true if at least one cell from the row matches,
// false otherwise. If a filter is invalid, filterRow returns false and an error.
func filterRow(f *btpb.RowFilter, r *row) (bool, error) {
	if f == nil {
		return true, nil
	}
	// Handle filters that apply beyond just including/excluding cells.
	switch f := f.Filter.(type) {
	case *btpb.RowFilter_BlockAllFilter:
		return !f.BlockAllFilter, nil
	case *btpb.RowFilter_PassAllFilter:
		return f.PassAllFilter, nil

return !f.BlockAllFilter, nil will not make row empty

and filterRow(req.PredicateFilter, nr) doesn't check bool nor error..............

PS: is it true other lang's client tests against bttest? if that's the case, why this is not discovered?

@uschen
Copy link
Author

uschen commented May 24, 2019

fix:

		ok, err := filterRow(req.PredicateFilter, nr)
		if err != nil {
			return nil, err
		}
		whichMut = ok && !nr.isEmpty()

@uschen
Copy link
Author

uschen commented May 24, 2019

and this needs to check bool and error too 😪

		for _, sub := range f.Interleave.Filters {
			sr := r.copy()
			filterRow(sub, sr)
			srs = append(srs, sr)
		}

@jeanbza jeanbza added api: bigtable Issues related to the Bigtable API. status: investigating The issue is under investigation, which is determined to be non-trivial. labels May 30, 2019
@odeke-em
Copy link
Contributor

Hello @uschen, thank you for reporting this issue! Apologies for the late reply!

So, that looks plausible that that missing check from filterRow could be a problem and I too found that a missing check was a cause of a bug in be4b3b2 and left a TODO. Let me examine how to firstly reproduce the problem. If you have a sample in your target language please let me know, otherwise I'll still work out one in proto structs.

PS: is it true other lang's client tests against bttest? if that's the case, why this is not discovered?

I believe so, yes, the Bigtable emulator is used by folks with other language/implementation clients, instead of hitting up the production servers.

@odeke-em odeke-em removed the status: investigating The issue is under investigation, which is determined to be non-trivial. label Jun 24, 2019
@odeke-em
Copy link
Contributor

I mailed out CL https://code-review.googlesource.com/c/gocloud/+/42170 which when it gets approved and merged, it will resolve this issue.

@yoshi-automation yoshi-automation added triage me I really want to be triaged. 🚨 This issue needs some love. labels Jun 24, 2019
@odeke-em odeke-em added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. and removed triage me I really want to be triaged. labels Jun 25, 2019
@yoshi-automation yoshi-automation added the triage me I really want to be triaged. label Jun 25, 2019
@jeanbza jeanbza added priority: p2 Moderately-important priority. Fix may not be included in next release. and removed 🚨 This issue needs some love. triage me I really want to be triaged. labels Jun 25, 2019
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. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

4 participants