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

test: add big schema openapi test #2256

Merged
merged 1 commit into from
Apr 21, 2022

Conversation

steve-chavez
Copy link
Member

@steve-chavez steve-chavez commented Apr 20, 2022

The big_schema(apflora) we use internally for perf tests is OSS https://github.com/barbalex/apf2/tree/master/sql/apflora so we can include it in our CI tests.

I've also asked barbalex to be sure - alles gut.


apflora stats:

select count(*)  from information_schema.routines where specific_schema = 'apflora';
 count
-------
    12

select count(*)  from information_schema.tables where table_schema = 'apflora' and table_type = 'BASE TABLE';
 count
-------
    45
(1 row)

select count(*)  from information_schema.views where table_schema = 'apflora';
 count
-------
   281

It doesn't have that many tables, the views are likely what makes our internal cache so big; probably the relationships generated between them(strict m2m junctions should help a bit here).

@steve-chavez
Copy link
Member Author

steve-chavez commented Apr 20, 2022

So this now reveals something I've discovered locally, doing a curl localhost:3000(openapi) fails for apflora with:

[nix-shell:~/Projects/postgrest]$ PGRST_OPENAPI_MODE="ignore-privileges" PGRST_DB_ANON_ROLE="postgrest_test_authenticator" PGRST_DB_SCHEMAS='apflora' postgrest-with-postgresql-14 -f test/io/big_schema.sql  postgrest-run
20/Apr/2022:17:59:35 -0500: Attempting to connect to the database...
20/Apr/2022:17:59:35 -0500: Connection successful
20/Apr/2022:17:59:35 -0500: Listening on port 3000
20/Apr/2022:17:59:35 -0500: Listening for notifications on the pgrst channel
20/Apr/2022:17:59:35 -0500: Config reloaded
20/Apr/2022:17:59:35 -0500: Schema cache loaded
stack overflow

Just a stack overflow error.

I've managed to reproduce it with bc7d54c (before recent refactors) as well.


edit:

So on v9.0.0 I don't get the error and openapi manages to succeed(while my laptop sounds like an airplane ✈️)

$ time curl localhost:3000  > output.json

real    0m45.272s
user    0m0.007s
sys     0m0.009s

$ du -sh output.json
1.2M    output.json

@steve-chavez
Copy link
Member Author

Ah, this is because of #2122 - there's a stack limit(-with-rtsopts=-KxK) on postgrest-run(1K) and on the spec tests(33K).

The io test is marked as pending for now, because the stack size it
requires is too big.
@steve-chavez
Copy link
Member Author

So for now I'm skipping the io test, I've confirmed it passes with 200K stack size but it'd be sad to lose the 1K safeguard for the rest of the codebase. It's still nice to have apflora in the codebase for quick tests.

Once OpenAPI stops doing things like searching all table columns over a list for each table(having Column inside Table would prevent this) I'll reenable the test - hopefully it requires much less stack then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant