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

ilike function may cause data race for non-constant pattern #49677

Closed
lcwangchao opened this issue Dec 21, 2023 · 0 comments · Fixed by #49678
Closed

ilike function may cause data race for non-constant pattern #49677

lcwangchao opened this issue Dec 21, 2023 · 0 comments · Fixed by #49678
Labels

Comments

@lcwangchao
Copy link
Collaborator

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

We can see that in line 201, the pattern is constructed and set builtinIlikeSig.pattern

if !b.isMemorizedPattern {
b.pattern = collate.ConvertAndGetBinCollation(b.collation).Pattern()
return b.ilikeWithoutMemorization(params, rowNum, escape, result)
}

contVec and vecVec uses builtinlikeSIg.pattern directly:

func (b *builtinIlikeSig) constVec(expr string, param *funcParam, rowNum int, escape int64, result *chunk.Column) error {
result.ResizeInt64(rowNum, false)
result.MergeNulls(param.getCol())
i64s := result.Int64s()
for i := 0; i < rowNum; i++ {
if result.IsNull(i) {
continue
}
b.pattern.Compile(param.getStringVal(i), byte(escape))
match := b.pattern.DoMatch(expr)
i64s[i] = boolToInt64(match)
}
return nil
}

If expression is evaluated in concurrency, it may cause data race

2. What did you expect to see? (Required)

3. What did you see instead (Required)

4. What is your TiDB version? (Required)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant