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
affects-7.1 This bug affects the 7.1.x(LTS) versions. affects-7.5 This bug affects the 7.5.x(LTS) versions. severity/major sig/execution SIG execution type/bug The issue is confirmed as a bug.

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)

@lcwangchao lcwangchao added type/bug The issue is confirmed as a bug. affects-7.1 This bug affects the 7.1.x(LTS) versions. affects-7.5 This bug affects the 7.5.x(LTS) versions. severity/major labels Dec 21, 2023
@ti-chi-bot ti-chi-bot bot added may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.1 may-affects-6.5 labels Dec 21, 2023
@lcwangchao lcwangchao added sig/execution SIG execution and removed may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.1 may-affects-6.5 labels Dec 21, 2023
ti-chi-bot bot pushed a commit that referenced this issue Dec 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-7.1 This bug affects the 7.1.x(LTS) versions. affects-7.5 This bug affects the 7.5.x(LTS) versions. severity/major sig/execution SIG execution type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant