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

[Bug] Insert into a ao relation with 32 concurrent transactions failled #216

Closed
1 of 2 tasks
shmiwy opened this issue Sep 21, 2023 · 4 comments
Closed
1 of 2 tasks
Labels
type: Bug Something isn't working

Comments

@shmiwy
Copy link

shmiwy commented Sep 21, 2023

Cloudberry Database version

No response

What happened

setup

SET gp_create_table_random_default_distribution=off;
DROP TABLE IF EXISTS ao;
CREATE TABLE ao (a INT, b INT) WITH (appendonly=true);

For each concurrency, just use the following query.

SET optimizer=off;
begin;
INSERT INTO AO VALUES (1, 1);
COMMIT;

The system will report an error

INSERT INTO AO VALUES (1, 1); 
ERROR:  could not find segment file to use for inserting into relation "ao"  (seg1 127.0.1.1:7003 pid=6821)

What you think should happen instead

The system must not report errors

How to reproduce

rerun the query with 32 concurrent transactions

Operating System

centos7

Anything else

No response

Are you willing to submit PR?

  • Yes, I am willing to submit a PR!

Code of Conduct

@shmiwy shmiwy added the type: Bug Something isn't working label Sep 21, 2023
@avamingli
Copy link
Collaborator

avamingli commented Sep 21, 2023

This is not a bug, it's designed by GPDB, there are 128 ao segfiles at most while 0 segfile is used for utility mode.
limit 128 files because TupleID for ao table is composed by [segfileno, rowno, flags] and the size is same with a TupleID for heap tables. It's a tradeoff of concurrent write process and rowno for ao tables.

@shmiwy
Copy link
Author

shmiwy commented Sep 21, 2023

But for now, the above problem occurs when the concurrency reaches 32. @avamingli

@shmiwy shmiwy changed the title [Bug] Insert into a ao relation with 127 concurrent transactions failled [Bug] Insert into a ao relation with 32 concurrent transactions failled Sep 21, 2023
@avamingli
Copy link
Collaborator

avamingli commented Sep 21, 2023

bug for now, the above problem occurs when the concurrency reaches 33. @avamingli

I guess the reason is GUC gp_appendonly_insert_files is changed to 4 by default, it's designed for parallel. Also a tradeoff between concurrent processes and segfiles for parallel.
Show that GUC and set it to 1, have a check.

@shmiwy
Copy link
Author

shmiwy commented Sep 21, 2023

In my env

gpadmin=# show gp_appendonly_insert_files;
 gp_appendonly_insert_files
----------------------------
 4

I try to change the GUC and try again.

@shmiwy shmiwy closed this as completed Sep 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants