graphql-engine/rfcs
Robert fbd1262ea6 server: operation timeout with postgres cancelling
### Description

This PR implements operation timeouts, as specced in #1232.

RFC: [rfcs/operation-timeout-api-limits.md](c025a90fe9/rfcs/operation-timeout-api-limits.md)

There's still some things to be done (tests and docs most notably), but apart from that it can
be reviewed. I'd still appreciate feedback on the RFC!

TODO:
- [x] break out the `ApiLimits` refactoring into a separate PR: #2103
- [x] finish the `pg-client-hs` PR: https://github.com/hasura/pg-client-hs/pull/39
- [x] remove configurability, after testing, prior to merging
- [ ] tests: #2390 has some tests that I've run locally to confirm things work on a fundamental level
- [x] changelog
- [x] documentation
- [x] fill in the detailed PR checklist

### Changelog

- [x] `CHANGELOG.md` is updated with user-facing content relevant to this PR. If no changelog is required, then add the `no-changelog-required` label.

### Affected components

- [x] Server
- [ ] Console
- [ ] CLI
- [x] Docs
- [ ] Tests

### Related Issues

Product spec: #1232.

### Solution and Design

Compare `rfcs/operation-timeout-api-limits.md`.

### Steps to test and verify

Configure operation timeouts, e.g. by posting

```
{
  "type": "set_api_limits",
  "args": {
    "operation_timeout": {
      "global": 3
    }
  }
}
```

to `v1/metadata` to set an operation timeout of 3s. Then verify that
1. non-admin queries that take longer than 3s time out with a nice error message
2. that those queries return after ~3s (at least for postgres)
3. also that everything else still works as usual

### Limitations, known bugs & workarounds
- while this will cause slow queries against any backends to fail, it's only verified to actually interrupt queries against postgres
- this will only successfully short-cut (cancel) queries to postgres if the database server is responsive

#### Catalog upgrade
Does this PR change Hasura Catalog version?
- [x] No

#### Metadata

Does this PR add a new Metadata feature?
- [x] Yes
  - Does `run_sql` auto manages the new metadata through schema diffing?
    - [x] Not required
  - Does `run_sql` auto manages the definitions of metadata on renaming?
    - [x] Not required
  - Does `export_metadata`/`replace_metadata` supports the new metadata added?
    - [x] Yes

#### GraphQL
- [x] No new GraphQL schema is generated

#### Breaking changes

- [x] No Breaking changes

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/1593
GitOrigin-RevId: f0582d0be3ed9fadf89e0c4aaf96344d18331dc4
2021-09-29 16:21:05 +00:00
..
permissions-mysql RFC: (Table) Permissions in MySQL 2021-09-09 06:41:51 +00:00
function-permissions.md rfc: permissions layer on functions (#384) 2021-03-04 04:08:09 +00:00
inherited-roles-improvements.md server: inherited roles for mutations, remote schemas, actions and custom functions 2021-08-09 10:21:05 +00:00
mssql-event-triggers-research.md RFC: Event triggers in SQL Server research 2021-09-20 16:52:58 +00:00
multiple-admin-secrets.md spec for multiple admin secrets 2021-09-20 09:02:18 +00:00
mutations-mssql.md server/rfc: mutations on MSSQL backend 2021-08-18 10:57:54 +00:00
mysql-relationships.md [rfc] MySQL relationships 2021-08-27 08:44:50 +00:00
operation-timeout-api-limits-braindump.md server: operation timeout with postgres cancelling 2021-09-29 16:21:05 +00:00
operation-timeout-api-limits.md server: operation timeout with postgres cancelling 2021-09-29 16:21:05 +00:00
optimistic-concurrency-control.md rfc: optimistic concurrency control for metadata changes (#480) 2021-03-04 04:08:03 +00:00
permissions-mysql.md RFC: (Table) Permissions in MySQL 2021-09-09 06:41:51 +00:00
pg-client-certs.md Rewrites PG Client Cert RFC 2021-05-25 03:12:16 +00:00
query-tags.md server/query-tags: implement new metadata specification and API 2021-09-23 12:38:56 +00:00
remote-schema-customization.md Remote Schema Customization take 2 using parser tranformations 2021-07-30 11:33:59 +00:00
rest-endpoints.md server: support restified versions of graphql queries (#303) 2021-01-29 01:03:35 +00:00
reuse-insert-permission-in-action.md rfc: admin-only/backend-only insert permissions (#4120) 2020-05-21 09:38:49 -05:00
role-based-allow-list.md RFC: role-based allowlist spec 2021-09-08 11:04:36 +00:00
seed-data.md cli: manage seed migrations as sql files (close #2431) (#3763) 2020-06-16 17:45:04 +05:30
transforms.md Feature/request transform string interpolation 2021-09-29 08:14:29 +00:00
update-permission-check-condition.md rfc: check condition in update permissions (#3750) 2020-02-25 11:46:24 +05:30