blob: d7e14a217441abb44517fdd5572e7cacca44be44 [file] [log] [blame]
--start_ignore
CREATE LANGUAGE plpython3u;
--end_ignore
DROP FUNCTION IF EXISTS public.test_bigint_python();
NOTICE: function public.test_bigint_python() does not exist, skipping
DROP TABLE IF EXISTS public.spi64bittestpython;
NOTICE: table "spi64bittestpython" does not exist, skipping
CREATE TABLE public.spi64bittestpython (id BIGSERIAL PRIMARY KEY, data BIGINT);
-- Insert 1 ~ 40000 here can guarantee each segment's processing more than 10000 rows
-- and less then 1000000(under jump hash or old module hash). This is the condition
-- that will trigger the faultinjection.
CREATE FUNCTION public.test_bigint_python()
RETURNS BIGINT
AS $$
res = plpy.execute("INSERT INTO public.spi64bittestpython (data) SELECT g FROM generate_series(1, 40000) g")
return res.nrows()
$$ LANGUAGE plpython3u;
-- insert 30k rows without fault injection framework
SELECT public.test_bigint_python();
test_bigint_python
--------------------
40000
(1 row)
SELECT COUNT(*) AS count
FROM public.spi64bittestpython;
count
-------
40000
(1 row)
-- activate fault injection framework
SELECT gp_inject_fault('executor_run_high_processed', 'skip', dbid)
FROM pg_catalog.gp_segment_configuration
WHERE role = 'p';
gp_inject_fault
-----------------
Success:
Success:
Success:
Success:
(4 rows)
-- and insert another 30k rows, this time overflowing the 2^32 counter
SELECT public.test_bigint_python();
test_bigint_python
--------------------
12884901855
(1 row)
-- reset fault injection framework
SELECT gp_inject_fault('executor_run_high_processed', 'reset', dbid)
FROM pg_catalog.gp_segment_configuration
WHERE role = 'p';
gp_inject_fault
-----------------
Success:
Success:
Success:
Success:
(4 rows)
SELECT COUNT(*) AS count
FROM public.spi64bittestpython;
count
-------
80000
(1 row)
-- drop test table
DROP TABLE public.spi64bittestpython;