Skip to content

2024.2.1.0-b177

@timothy-e timothy-e tagged this 16 Jan 15:17
Summary:
Original commit: 2b4598f348d51b3220c34545d57042aac2f1066f / D41133

Backport changes: change Ybc to YBC

D36095 / d0500a02c911 addressed a correctness issue in regular expression pushdown: `regexp.c` was written for single-threaded Postgres, and so has static variables to maintain state. With expression pushdown enabled, the tserver will run `regexp.c` in multiple threads. To solve this, the static variables were changed to thread local variables.

There are 4 static variables in `regc_pg_locale.c`:
```
static PG_Locale_Strategy pg_regex_strategy;
static pg_locale_t pg_regex_locale;
static Oid	pg_regex_collation;
static pg_ctype_cache *pg_ctype_cache_list = NULL;
```

Because the final one has `malloc` allocations, moving it to a thread-local variable will cause memory leaks unless the deallocation is moved to the C++ lifecycle. That makes it a more complex change, so I'll address that as part of #25561.
Jira: DB-13132

Test Plan: ./yb_build.sh tsan --cxx-test pgwrapper_pg_mini-test --gtest_filter PgMiniTest.RegexPushdown

Reviewers: amartsinchyk, dmitry

Reviewed By: amartsinchyk

Subscribers: yql, jason

Differential Revision: https://phorge.dev.yugabyte.com/D41261
Assets 2
Loading