janl commented on PR #5507:
URL: https://github.com/apache/couchdb/pull/5507#issuecomment-2815450804

   Next, Mango:
   
   The [PCRE2 upgrade 
notes](https://www.erlang.org/docs/28/apps/stdlib/re_incompat) state:
   
   > Compiled Patterns Should Not be Shared: Sharing the result of re:compile/2 
across node boundaries or persisting it has never been officially supported, 
although it might have accidentally worked between certain previous versions. 
The internal format produced by re:compile/2 has changed, and will not work on 
older OTP versions or across nodes. Relying on this undocumented behavior must 
be changed to compile the regular expression on the node instance where it is 
intended to be used.
   
   This seems to include `mochiglobal:put()`:
   
   ```
     mango_idx_text: indexable_fields_test...*failed*
   in function erl_syntax:abstract/1 (erl_syntax.erl, line 7294)
   in call from erl_syntax:abstract_list/1 (erl_syntax.erl, line 7297)
   in call from erl_syntax:abstract_list/1 (erl_syntax.erl, line 7297)
   in call from erl_syntax:abstract/1 (erl_syntax.erl, line 7280)
   in call from mochiglobal:term_to_abstract/3 (src/mochiglobal.erl, line 95)
   in call from mochiglobal:forms/2 (src/mochiglobal.erl, line 77)
   in call from mochiglobal:compile/2 (src/mochiglobal.erl, line 71)
   in call from mochiglobal:put/3 (src/mochiglobal.erl, line 51)
   **error:{badarg,#Ref<0.2315338412.3477471233.154666>}
     output:<<"">>
   ```
   
   This change to mango_util fixes the issues, but now we are not caching the 
compiled re:
   
   ```diff
    cached_re(Name, RE) ->
   -    case mochiglobal:get(Name) of
   -        undefined ->
   -            {ok, MP} = re:compile(RE),
   -            ok = mochiglobal:put(Name, MP),
   -            MP;
   -        MP ->
   -            MP
   -    end.
   +    {ok, MP} = re:compile(RE),
   +    MP. 
   ```
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to