hydradatabase / hydradatabase/columnar

[Bug]: parallel operation error during CREATE TABLE statements

Open
#267 3 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
C
Stars
3k
Forks
106
PR merge metrics
No merged PRs in 30d

Description

### What's wrong?

This was first reported in #50, and PR #138 (pushed to main Nov 2, 2023) claimed to have fixed the problem. However, the repro case provided there still applies as recently as 11.1-12, dated May 21, 2024.

As a refresh. The repro case:

```sql
CREATE TABLE sampletable (x numeric);
INSERT INTO sampletable SELECT i FROM generate_series(1,10000000) i;
```

Make sure that there are sufficient background workers to cause the race condition. The settings I used:

```ini
max_worker_processes = 16
max_parallel_workers_per_gather = 8
```

Note that I increased the size of the sample data to 10,000,000 rows rather than 1,000,000, as the previous amount was not enough to trigger the error reliably. This is because it's far more likely to occur when there are sufficient extra parallel workers.

Then repeatedly run the following SQL in a new session:

```sql
CREATE TABLE sampletable_columnar USING columnar AS SELECT * FROM sampletable ORDER BY 1 ASC;
```

I did this with a simple `for` loop:

```bash
for x in {1..20}; do
psql -c "CREATE TABLE sampletable_columnar USING columnar AS SELECT * FROM sampletable ORDER BY 1 ASC;"
done
```

It may run successfully, but should eventually fail as before:

```bash
ERROR: cannot start commands during a parallel operation
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.