Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-48232

PCRE is not maintained anymore, upgrade to PCRE2

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major - P3
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Internal Code, Querying
    • Labels:
      None

      Description

      SERVER-48116 fixed a startup bug in the venerable C++ bindings for the PCRE library. We can keep going with a local patch, but that change cannot be upstreamed because the PCRE project is not even taking bug fixes anymore (see https://bugs.exim.org/show_bug.cgi?id=2575 ).

      The very strong recommendation from the PCRE author is to migrate to the successor, PCRE2, which is under active maintenance. It is compatible, but not bug-for-bug compatible. It provides a similar C API as PCRE, but does not ship with a C++ wrapper. C++ wrappers for PCRE2 are available from third parties, reflecting some diversity of style. Some are quite featureful, e.g., https://github.com/jpcre2/jpcre2 .

      The PHP project made this transition in 2018, and generated some compatibility notes. The main difference is that invalid regexes are more zealously rejected:

      We would have to consider what in the server could change in such an upgrade.
      The pcrecpp.h header is included in only a few files. Of those, we can eliminate places that are internal, testing, or hardcoded regexes. Or places that only need quoteMeta or other supporting functions. Those can all be adjusted if necessary. All that's left is two sites:

      src/mongo/db/matcher/expression_leaf.cpp:
      class LeafMatchExpression

      src/mongo/db/matcher/schema/expression_internal_schema_allowed_properties.h
      struct Pattern

      So query team would be best able to evaluate the impact of the upgrade.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              backlog-query-execution Backlog - Query Execution
              Reporter:
              billy.donahue Billy Donahue
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              12 Start watching this issue

                Dates

                Created:
                Updated: