• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

babelfish-for-postgresql / babelfish_extensions / 7899993656
74%
BABEL_5_X_DEV: 77%

Build:
Build:
LAST BUILD BRANCH: fix_script_injection
DEFAULT BRANCH: BABEL_5_X_DEV
Ran 14 Feb 2024 11:30AM UTC
Jobs 1
Files 114
Run time 11s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

14 Feb 2024 10:43AM UTC coverage: 72.882% (+0.004%) from 72.878%
7899993656

push

github

web-flow
first commit rebased and forced push (#2352) (#2367)

In babelfish there could be cases where a procedure rollbacks/deletes it self during execution.
For example

BEGIN TRAN
CREATE PROCEDURE poc1 AS ROLLBACK;
EXEC p;

Procedure 'proc1' does not exists after its execution since the transaction in which it was created
was rolled back by the procedure itself.
Now while executing rollback inside such procedures, the pg_stat entry for this proc is also deleted.
When we return to fmgr to end the proc invocation, we will overwrite on this freed block of memory.
In future, when alloc tries to allocate this freed block if memory to some other process,
it may hit an assert since this block was corrupted.

To avoid this, we add an additional check before writing on the pg_stat entry post invocation.
Check involves simply looking for a local cache pg_stat entry for given key.

Note* PG does not need this check since such a case is not possible there.
Performance Effect

Use the simplest of procedures to avoid diluting the performance changes and get the worst case scenario.
Before & after numbers are taken as average of 4 runs.

CREATE PROCEDURE proc1 AS SELECT 1;
CREATE PROCEDURE proc2 @in INT AS SELECT @in + 1;

CASE 1

DECLARE @i INT = 0;
DECLARE @dt DATETIME = getdate();
WHILE (@i < 1000000)
BEGIN
    EXEC proc1;
    SET @i = @i + 1;
END;
DECLARE @duration_ms int;
SET @duration_ms = DATEDIFF(ms, @dt, getdate());
SELECT @duration_ms
GO

Before Fix:
track_functions --> disabled: 29189 ms enabled: 29367.75 Change: +0.62%
After Fix:
track_functions --> disabled: 28261 ms enabled: 28266 Change: ~0%

CASE 2

DECLARE @i INT = 0;
DECLARE @dt DATETIME = getdate();
WHILE (@in < 1000000)
BEGIN
    EXEC proc2 1;
    SET @i = @i + 1;
END;
DECLARE @duration_ms int;
SET @duration_ms = DATEDIFF(ms, @dt, getdate());
SELECT @duration_ms
GO

Before Fix:
track_functions --> disabled: 34730.25 ms enabled: 34732.25 Change... (continued)

41093 of 56383 relevant lines covered (72.88%)

57129.14 hits per line

Jobs
ID Job ID Ran Files Coverage
1 7899993656.1 14 Feb 2024 11:30AM UTC 114
72.88
GitHub Action Run
Source Files on build 7899993656
  • Tree
  • List 114
  • Changed 67
  • Source Changed 1
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #7899993656
  • 81cbb71e on github
  • Prev Build on BABEL_3_X_DEV (#7897006764)
  • Next Build on BABEL_3_X_DEV (#7906412592)
  • Delete
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc