Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[YSQL] Read time errors when running postgresql anonymizer functions outside transaction blocks #25665

Open
1 task done
abhinab-yb opened this issue Jan 17, 2025 · 0 comments
Assignees
Labels
area/ysql Yugabyte SQL (YSQL) kind/bug This issue is a bug priority/medium Medium priority issue status/awaiting-triage Issue awaiting triage

Comments

@abhinab-yb
Copy link
Contributor

abhinab-yb commented Jan 17, 2025

Jira Link: DB-14924

Description

Start the cluster with

bin/yb-ctl start --tserver_flags ysql_pg_conf_csv="shared_preload_libraries='anon'"

yugabyte=# create extension anon;
CREATE EXTENSION

yugabyte=# SET yb_non_ddl_txn_for_sys_tables_allowed = true;
SET

yugabyte=# SELECT anon.init();
server closed the connection unexpectedly
	This probably means the server terminated abnormally
	before or while processing the request.
The connection to the server was lost. Attempting reset: Succeeded.

In the logs

F0117 14:14:59.014832 3980468352 pg_txn_manager.cc:189] Check failed: read_time_serial_no <= max_read_time_ && read_time_serial_no >= min_read_time_ Bad read time serial no 19 while [23, 23] is expected
Fatal failure details written to /Users/asaha/yugabyte-data/node-1/disk-1/yb-data/tserver/logs/yb-tserver.FATAL.details.2025-01-17T14_14_59.pid51234.txt
F20250117 14:14:59 ../../src/yb/yql/pggate/pg_txn_manager.cc:189] Check failed: read_time_serial_no <= max_read_time_ && read_time_serial_no >= min_read_time_ Bad read time serial no 19 while [23, 23] is expected
    @        0x1042f2510  google::LogDestination::LogToSinks()
    @        0x1042f1654  google::LogMessage::SendToLog()
    @        0x1042f2034  google::LogMessage::Flush()
    @        0x1042f5f3c  google::LogMessageFatal::~LogMessageFatal()
    @        0x1042f2ee0  google::LogMessageFatal::~LogMessageFatal()
    @        0x1033171d0  yb::pggate::PgTxnManager::SerialNo::RestoreReadTime()
    @        0x10331dfd0  yb::pggate::PgTxnManager::RestoreReadTimePoint()
    @        0x10327020c  yb::pggate::PgApiImpl::RestoreReadTimePoint()
    @        0x1033384f0  YBCRestoreReadTimePoint
    @        0x100ea4fb0  YBCOnActiveSnapshotChange
    @        0x100e9eff4  PopActiveSnapshot
    @        0x10087889c  _SPI_execute_plan
    @        0x100878abc  SPI_execute_extended
    @        0x10a66b94c  exec_stmt_dynexecute
    @        0x10a6629a0  exec_stmts
    @        0x10a661200  exec_stmt_block
    @        0x10a65ee14  exec_toplevel_block
    @        0x10a65cfc4  plpgsql_exec_function
    @        0x10a683930  plpgsql_call_handler
    @        0x100dfdc7c  fmgr_security_definer
    @        0x1007ddfac  ExecInterpExpr
    @        0x1007dd058  ExecInterpExprStillValid
    @        0x10080758c  ExecEvalExpr
    @        0x1008074d8  ExecEvalFuncArgs
    @        0x100806a98  ExecMakeTableFunctionResult
    @        0x10082c44c  FunctionNext
    @        0x100808d3c  ExecScanFetch
    @        0x1008088ac  ExecScan
    @        0x10082be9c  ExecFunctionScan
    @        0x100802568  ExecProcNodeFirst
    @        0x10081fd98  ExecProcNode
    @        0x10081f9c0  fetch_input_tuple

*** Check failure stack trace: ***
    @        0x1042f1814  google::LogMessage::SendToLog()
    @        0x1042f2034  google::LogMessage::Flush()
    @        0x1042f5f3c  google::LogMessageFatal::~LogMessageFatal()
    @        0x1042f2ee0  google::LogMessageFatal::~LogMessageFatal()
    @        0x1033171d0  yb::pggate::PgTxnManager::SerialNo::RestoreReadTime()
    @        0x10331dfd0  yb::pggate::PgTxnManager::RestoreReadTimePoint()
    @        0x10327020c  yb::pggate::PgApiImpl::RestoreReadTimePoint()
    @        0x1033384f0  YBCRestoreReadTimePoint
    @        0x100ea4fb0  YBCOnActiveSnapshotChange
    @        0x100e9eff4  PopActiveSnapshot
    @        0x10087889c  _SPI_execute_plan
    @        0x100878abc  SPI_execute_extended
    @        0x10a66b94c  exec_stmt_dynexecute
    @        0x10a6629a0  exec_stmts
    @        0x10a661200  exec_stmt_block
    @        0x10a65ee14  exec_toplevel_block
    @        0x10a65cfc4  plpgsql_exec_function
    @        0x10a683930  plpgsql_call_handler
    @        0x100dfdc7c  fmgr_security_definer
    @        0x1007ddfac  ExecInterpExpr
    @        0x1007dd058  ExecInterpExprStillValid
    @        0x10080758c  ExecEvalExpr
    @        0x1008074d8  ExecEvalFuncArgs
    @        0x100806a98  ExecMakeTableFunctionResult
    @        0x10082c44c  FunctionNext
    @        0x100808d3c  ExecScanFetch
    @        0x1008088ac  ExecScan
    @        0x10082be9c  ExecFunctionScan
    @        0x100802568  ExecProcNodeFirst
    @        0x10081fd98  ExecProcNode
    @        0x10081f9c0  fetch_input_tuple
    @        0x10081f4a0  agg_retrieve_direct

2025-01-17 14:14:59.026 IST [51192] WARNING:  server process (PID 51234) was terminated by signal 6: Abort trap: 6
2025-01-17 14:14:59.026 IST [51192] DETAIL:  Failed process was running: SELECT anon.init();

The same issue with anon.start_dynamic_masking() as well. The current workaround for this is to surround the anon.init() inside a transaction block.

Issue Type

kind/bug

Warning: Please confirm that this issue does not contain any sensitive information

  • I confirm this issue does not contain any sensitive information.
@abhinab-yb abhinab-yb added area/ysql Yugabyte SQL (YSQL) status/awaiting-triage Issue awaiting triage labels Jan 17, 2025
@yugabyte-ci yugabyte-ci added kind/bug This issue is a bug priority/medium Medium priority issue labels Jan 17, 2025
@abhinab-yb abhinab-yb changed the title [YSQL] Read time errors when running postgresql anonymizer functions [YSQL] Read time errors when running postgresql anonymizer functions outside transaction blocks Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ysql Yugabyte SQL (YSQL) kind/bug This issue is a bug priority/medium Medium priority issue status/awaiting-triage Issue awaiting triage
Projects
None yet
Development

No branches or pull requests

3 participants