|
Ran
|
Files
127
|
Run time
14s
|
Badge
README BADGES
|
push
github
[OSS-ONLY] Add persistent ANTLR parse tree cache for routines (#4547) Cache serialized parse trees in sys.babelfish_function_ext to eliminate redundant ANTLR parsing on first execution in new sessions. The PLtsql function hash table is session-scoped, so without caching every new session re-parses large routines from scratch. This reduces first- execution time from ~2s to ~15ms for routines with ~1300 lines. Serialized trees use a nodeToString/stringToNode framework modeled after PostgreSQL's node serialization, with a Perl code generator producing outfuncs/readfuncs/equalfuncs from annotated PLtsql headers. Extension- owned NodeTags are offset from 10000 to avoid collision with PG's enum. Cache is written at CREATE/ALTER time, restored on first EXEC in a new session, and validated against BABELFISH_VERSION_STR to reject stale entries after upgrades. Cache writes are skipped on read-only instances. Caching behavior is controlled at three levels: a session-level GUC (babelfishpg_tsql.enable_antlr_parse_cache, default true) provides the global toggle, a per-function setting toggled via sys.enable_antlr_parse_cache(routine_oid, true/false/NULL) allows function owners to force-enable, force-disable, or follow the session GUC, and a superuser-only debug GUC (validate_antlr_parse_cache) enables roundtrip verification by comparing cached trees against fresh ANTLR output. Limitations: trigger functions and event triggers are not cached in this initial implementation due to differences in datum array layout between CREATE and EXEC time. These will be addressed in a follow-up. Task: BABEL-6037 Author: Manisha Deshpande mmdeshp@amazon.com (cherry picked from commit 56b641e7c)
53876 of 69915 relevant lines covered (77.06%)
643498.94 hits per line
| Coverage | ∆ | File | Lines | Relevant | Covered | Missed | Hits/Line |
|---|