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

babelfish-for-postgresql / babelfish_extensions / 7898172184
76%
BABEL_5_X_DEV: 77%

Build:
Build:
LAST BUILD BRANCH: BABEL-5844-4x
DEFAULT BRANCH: BABEL_5_X_DEV
Ran 14 Feb 2024 08:46AM UTC
Jobs 1
Files 114
Run time 10s
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 08:05AM UTC coverage: 72.625% (+0.004%) from 72.621%
7898172184

push

github

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

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: ~0%
A... (continued)

41097 of 56588 relevant lines covered (72.62%)

60528.66 hits per line

Jobs
ID Job ID Ran Files Coverage
1 7898172184.1 14 Feb 2024 08:46AM UTC 114
72.62
GitHub Action Run
Source Files on build 7898172184
  • Tree
  • List 114
  • Changed 66
  • Source Changed 1
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #7898172184
  • 5f7acfcf on github
  • Prev Build on BABEL_4_X_DEV (#7897491417)
  • Next Build on BABEL_4_X_DEV (#7906500880)
  • 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