Skip to content

2.25.1.0-b68

@pao214 pao214 tagged this 20 Dec 18:28
Summary:
### Issue first observed in

```
./bin/pgbench  -i -s 10  -U yugabyte -h 127.0.0.1 -p 5433 yugabyte
dropping old tables...
NOTICE:  table "pgbench_accounts" does not exist, skipping
NOTICE:  table "pgbench_branches" does not exist, skipping
NOTICE:  table "pgbench_history" does not exist, skipping
NOTICE:  table "pgbench_tellers" does not exist, skipping
creating tables...
WARNING:  storage parameter fillfactor is unsupported, ignoring
WARNING:  storage parameter fillfactor is unsupported, ignoring
WARNING:  storage parameter fillfactor is unsupported, ignoring
generating data (client-side)...
1000000 of 1000000 tuples (100%) done (elapsed 0.45 s, remaining 0.00 s)
ERROR:  cannot perform COPY FREEZE because the table was not created or truncated in the current subtransaction
pgbench: error: PQendcopy failed
```

with read committed isolation level.

### Root Cause

pgbench fetches server version and uses COPY with FREEZE option if available

```name=pgbench.c
	/*
	 * accounts is big enough to be worth using COPY and tracking runtime
	 */
	/* use COPY with FREEZE on v14 and later without partitioning */
	if (partitions == 0 && PQserverVersion(con) >= 140000)
		copy_statement = "copy pgbench_accounts from stdin with (freeze on)";
	else
		copy_statement = "copy pgbench_accounts from stdin";
```

this triggers an assert condition because of our savepoint logic in read committed.

### Objective

DocDB does not support FREEZE. So, we introduce the following semantics with FREEZE on COPY FROM command

1. When yb_ignore_freeze_with_copy = true, display a NOTICE saying that FREEZE is unsupported.
2. When  yb_ignore_freeze_with_copy = false, raise an error.

```
dropping old tables...
NOTICE:  table "pgbench_accounts" does not exist, skipping
NOTICE:  table "pgbench_branches" does not exist, skipping
NOTICE:  table "pgbench_history" does not exist, skipping
NOTICE:  table "pgbench_tellers" does not exist, skipping
creating tables...
WARNING:  storage parameter fillfactor is unsupported, ignoring
WARNING:  storage parameter fillfactor is unsupported, ignoring
WARNING:  storage parameter fillfactor is unsupported, ignoring
generating data (client-side)...
1000000 of 1000000 tuples (100%) done (elapsed 0.52 s, remaining 0.00 s)
ERROR:  cannot perform COPY FREEZE on a YugaByte table
```

Ignore FREEZE with COPY FROM by default for pg compatibility.

Fixes #25044.
Jira: DB-14178

Test Plan:
Jenkins

Added a simple test to yb_feature_copy.sql.
```
./yb_build.sh --java-test TestPgRegressFeature
```

Reviewers: pjain, smishra

Reviewed By: pjain

Subscribers: yql

Differential Revision: https://phorge.dev.yugabyte.com/D40477
Assets 2
Loading