Query gateway¶
The query gateway answers queries on the Iceberg tables. It authenticates each request, removes the files that cannot contain a match, scans the files that remain, and streams the rows to the client. It holds no data of its own. Its caches make queries faster, and a new pod fills them from your catalog and your storage.
Open the interactive diagram for pan and zoom, search, and export to PNG or SVG.
Ways in¶
| Interface | Port | For |
|---|---|---|
| HTTP | queryGateway.serverPort (default 8080) |
GET with a filter in the query string, or POST with a JSON document. The HTTP QUERY method is the same as POST. |
| PostgreSQL wire protocol | queryGateway.postgres.port |
psql, JDBC and ODBC drivers, BI tools. Read-only. Off unless you configure it. |
| MCP | queryGateway.serverPort, path /mcp |
AI agents, over the Model Context Protocol. Read-only tools that take the HTTP POST document. Off unless you configure it. |
The MCP interface uses the HTTP interface's engine and limits; its own page gives its tools, its authorization and its errors. The other two interfaces use the same engine, the same caches, the same authentication, and the same time-range, time and metadata limits. The steps below apply to both, but step 3 is different for each interface. This page gives HTTP status codes. On the PostgreSQL interface a refusal is an SQLSTATE error, not an HTTP status.
The HTTP interface is also an OpenAPI 3.2 document. Use it to generate a client or
to validate requests. It gives each parameter, the request document, the response with its error
and hotTier members, and each error code with its HTTP status. QUERY is its own operation in the
document, with the same request and responses as POST.
The request path¶
- Authenticate. Each request must carry an OIDC bearer token. The gateway checks the signature, the expiry time, the issuer, the audience (if you configure one) and the claims that you require. There is no anonymous mode and no switch that disables authentication.
- Authorize. If you configure
queryGateway.auth.datasetRoles, the caller's role must be in the list for the dataset. A dataset that is not in the map, or that has an empty list, is denied to all callers.datasetRolesalso needsqueryGateway.auth.roleClaimPath, which gives the location of the roles in the token. If you do not configuredatasetRoles, each authenticated caller can read each dataset. - Validate. On the HTTP interface, the gateway refuses a column name that contains a
character outside
a-z A-Z 0-9 _ .before it parses the filter. It refuses a filter operator that is not in its list. Filter values are typed against the table schema and passed to the engine as values. They are never put into query text. On the PostgreSQL interface, the client sends SQL, and the gateway examines the plan of each statement. See PostgreSQL interface. - Apply the limits. See Limits.
- Prune. Three passes remove files, and row groups in files, that cannot match the filter. See Pruning.
- Scan and stream. The engine reads only the byte ranges that it needs from the files that
remain. Rows go to the client as the scan produces them, so the memory that a query uses does
not grow with the size of its result. If the request has an
Accept-Encodingheader, the gateway compresses the response withzstd,brorgzip. The compressor sends its output each time that the scan waits for more rows, so the rows still stream.
Authentication runs before the gateway examines the dataset name or the query. A caller with no valid token cannot find out which datasets exist.
HTTP query sequence¶
This is the order of the calls for one HTTP query. The gateway does the dashed calls only when the data is not in its caches.
The gateway sends the status 200 when the plan is ready, before it reads the first row. A failure
after that point cannot change the status, also when it occurs on the first data file. See
When a dependency is unavailable.
Pruning¶
| Pass | Uses | Removes |
|---|---|---|
| 1 | The column statistics (minimum, maximum, null count) in the Iceberg manifests | Whole files. It opens no data file and no sidecar. |
| 2 | The bloom-filter sidecar, for an equality filter on a column in bloomFilterColumns |
Row groups, and files that have none left |
| 3 | The full-text sidecar, for an equality, LIKE or regular-expression filter on a column in tantivy.indexingColumns |
Row groups, and files that have none left |
A pass removes only what it has proved cannot match. If a file has no sidecar, if the sidecar cannot be read, or if the filter has a form that a pass cannot answer, the gateway scans the file. The result is always correct; a missing sidecar only makes the query slower. Files that the compactor has not merged yet have no full-text sidecar, and files that another engine wrote have no sidecars at all. Where the files are shows which process writes each sidecar.
Caches¶
| Cache | Holds | Limit | Notes |
|---|---|---|---|
| Snapshot cache | The file lists of each table's current snapshot | queryGateway.manifestCache.maxBytes (default 512 MiB) |
The gateway polls the catalog every queryGateway.snapshotPollIntervalSeconds (default 8); each pod changes the interval by a small amount of its own. It loads only the parts of the file list that a query needs. |
| Sidecar cache | Bloom-filter sidecars and the footers (metadata) of data files, in memory | queryGateway.indexCache.maxBytes (default 512 MiB) |
At start, the gateway loads the sidecars of the files added in the last queryGateway.warmup.windowHours (default 24). This does not delay the start. The gateway keeps the footer of a data file after the first query that reads it, so a later query does not read it from storage. It does not load footers at start. It keeps a file's page index only when the full-text index narrowed that file to rows. |
| Full-text sidecar cache | Full-text sidecars, on local disk in queryGateway.indexCache.diskDir |
queryGateway.indexCache.diskMaxBytes |
The gateway does not download a full-text sidecar whole. It reads the term dictionaries and the other small parts one time (about 1.5 % of a large sidecar) and keeps them on disk. For a query, it reads from storage only the lists of entries for the query's terms, all at the same time, and keeps them on disk for the next query. If the small parts of a sidecar are larger than diskMaxBytes, the sidecar is not used, and its data file is scanned. The start loads these sidecars too, until the cache is full. |
| Signing keys | The OIDC provider's keys | The gateway fetches a key that it does not know before it refuses a token. |
A sidecar can be written again under the same name, for example when two compactions merge the same files. Both versions are correct for the data file. The gateway reads a bloom-filter sidecar whole, so it always has one complete version. It reads a full-text sidecar in parts, and only from the version that it opened. If that version is replaced, the query scans the data file, and the next query opens the new version.
When a dependency is unavailable¶
| Dependency | The gateway |
|---|---|
| Catalog | Continues to answer from the file lists that it has loaded. A query that needs a file list that it has not loaded gets 503. It never returns a partial result as if it were complete. |
| Dataset table | If the catalog has no table for a configured dataset, the query gets 503 TABLE_NOT_CREATED, not CATALOG_UNAVAILABLE. This is usual before the first ingestor of a new dataset creates the table, and it stops when the table exists. If it continues, the ingestor did not start, or the gateway and the ingestor do not use the same ingestion.namespace. |
| OIDC provider | Continues to use the keys that it has, for queryGateway.auth.maxJwksStalenessSeconds (default 3600). After that, requests get 503, not 401. A pod that starts while the provider is unavailable has no keys, and returns 503 immediately. |
| Storage, while the gateway plans the query | A file list that cannot be read gets 503. A sidecar that cannot be read is not an error: the gateway scans the file. |
| Hot source | The gateway answers from Iceberg only and marks the answer. See Hot source. A query on the hot source only gets 503. |
| Storage, during the scan (HTTP) | The status 200 is already sent, also when no row was sent. The response ends with an error member. A client must examine each response for error. |
Limits¶
| Limit | Configuration key | Default | Past the limit |
|---|---|---|---|
| Time range of a query that returns raw rows | maxRawWindowDays on the dataset |
7 days | 422 |
| Age of the rows that a query sees | retentionDays on the dataset |
0: all rows | The older rows are not in the result. |
| Time to plan and prune a query | queryGateway.queryTimeoutSeconds |
30 seconds | 504 |
| Time of one call to the catalog or the object store | queryGateway.upstreamRequestTimeoutSeconds |
10 seconds; one more try on the object store | 503 while the gateway plans the query. During the scan, the response ends with an error member. A sidecar that cannot be read is not an error: the gateway scans the file. |
| HTTP queries in progress on one pod | queryGateway.maxInFlightHttpQueries |
16 | 503. The gateway refuses the query; it does not queue it. |
| PostgreSQL connections on one pod | queryGateway.postgres.maxConnections |
none; you must set it | The connection is refused. |
| Table metadata that one query holds | queryGateway.manifestCache.maxBytes |
512 MiB | 422 |
| Rows in one HTTP page | 500; maximum 10 000 | A larger value is reduced to the maximum. | |
| Rows from one PostgreSQL statement | none | The gateway sends all rows. | |
| Length of one PostgreSQL statement | 32 KiB | 42601. A span_id IN (…) with more than approximately 900 32-character values is too long. Divide the list into more statements. |
|
Recursive query (WITH RECURSIVE) in a PostgreSQL statement |
not accepted | 42601. This also applies when no part of the query refers to itself. Remove the word RECURSIVE. |
|
Expression depth of one PostgreSQL statement or HTTP filter |
256 levels | 42601 on PostgreSQL, 400 on HTTP. Each operator in a chain such as a = 1 OR a = 2 OR … or a==1,a==2,… adds 1 level. An IN (…) or =in=(…) list is 1 level, whatever its length. Thus, use IN or =in= for a long list of equalities. |
|
| Joins in one PostgreSQL statement | 200 | 42601. Each JOIN, each comma in FROM a, b, …, and each INTERSECT or EXCEPT is 1 join. Joins in subqueries also count. |
|
UNION or WITH chain in one PostgreSQL statement |
no separate limit | The statement length limit applies: 42601. 32 KiB holds approximately 1 700 branches of UNION ALL SELECT 1, or approximately 1 000 CTEs. These chains do not add expression depth or joins. |
|
| Time to read all rows from a hot source | hotSource.readTimeoutMs on the dataset |
60 seconds | The answer is not complete. See Hot source. |
The time-range limit applies to a query that has no aggregate and no grouping. It does not apply to
an aggregate query, to a query with grouping or SELECT DISTINCT (but not DISTINCT ON), or to
an equality lookup on a column in bloomFilterColumns. Set maxRawWindowDays: 0 on a dataset to
remove the limit.
Grouping removes the limit, also when the grouping column is almost unique. For example,
SELECT span_id, max(ts) FROM spans GROUP BY span_id has no time limit, but it sends
approximately 1 row for each span. The limit prevents an accidental read of raw rows. It does not
control access to data: dataset access control does that.
retentionDays applies to all queries on the dataset, on HTTP and on PostgreSQL. A row is not in
the result, and not in a count or other aggregate, if its timeColumn value is more than
retentionDays days before the start of the query. This also applies to the older rows of a file
that has older and newer rows. A row with no timeColumn value is in the result. The gateway does
not read the files that contain only older rows. The time-range limit measures the time range that
the query asks for, not the part of it that retentionDays leaves. A query on one tier only sees
all rows (see One tier only). The rows stay in storage, unless the
retention delete is on.
If a dataset has maxRawWindowDays: 0, a query on the PostgreSQL interface has no limit on the
rows that it reads from Iceberg. The time limit stops before the gateway reads the first data
file, and there is no row limit. Thus SELECT * FROM <dataset> sends all rows of the table. Only
the client can stop it: it closes the connection. On the HTTP interface, the page size is the only
limit that remains. Remove the time-range limit only if you trust the clients to put a limit on
their queries.
The gateway measures the time range on the dataset's timeColumn. The gateway does not start if a
dataset with a limit has no timeColumn, or if that column is not a timestamp column.
The gateway refuses a query if it cannot show that the time range is in the limit. Thus it refuses a query with no filter, a query with a filter only on other columns, and a query that has an upper time bound but no lower one. A lower bound with no upper bound is measured to the current time.
queryGateway.manifestCache.maxBytes is the limit of the snapshot cache, and it is also the limit
of what each query in progress can hold. Thus the largest use of memory for table metadata on one
pod is maxBytes × (1 + maxInFlightHttpQueries + postgres.maxConnections). With the defaults and
no PostgreSQL interface, that is 8.5 GiB.
On the PostgreSQL interface, the time-range limit and the metadata limit give SQLSTATE 54000, the
time limit gives 57014, a catalog or OIDC provider that is unavailable gives 57P03, a dataset
whose table is not created yet also gives 57P03, and a table with delete files gives 55000. A
hot source that is unavailable gives 57P03 on a _hot table (see One tier only);
on other tables, see Hot source not available. A statement that
cannot be parsed or planned, or that is too long or too deep, gives 42601. The message is
"the statement could not be parsed or planned". A failure in the query engine or in storage gives
XX000. The message of an XX000 error comes from the query engine and can change between
versions. A rare fault inside the gateway during the scan, for example cached file metadata that
does not decode, gives 58030.
Retry once, and report it if it repeats. The page size and maxInFlightHttpQueries do not apply
there.
PostgreSQL interface¶
- TLS is mandatory. The gateway refuses a connection without TLS before it asks for a password.
- The password is the OIDC access token. The user name and the database name are ignored.
- The gateway validates the token again for each statement. The connection ends at the first
statement after the token expires. A connection that does nothing keeps its place in
maxConnections. - The Iceberg namespace is a schema, and each dataset is a table in it. If a dataset has a hot source, two more schemas read one tier only. See One tier only.
- A table name without a schema is a dataset in the namespace:
FROM spansis the same asFROM tracelake.spans.search_pathdoes not change this. Apg_catalogtable name without a schema, for examplepg_class, is thepg_catalogtable. A name that is not a dataset gives42P01. The name of a table function without its call, for exampleFROM generate_series, gives42601. - Only queries are accepted.
BEGIN,COMMITandROLLBACKare accepted and do nothing.SHOWreads session settings.SETis accepted only forDateStyle,bytea_output,IntervalStyle,application_name,extra_float_digits,search_path,TIME ZONEanddatafusion.explain.show_statistics.SET client_encodingandSET … TRANSACTION …(sent by JDBCsetTransactionIsolation()andsetReadOnly()) are accepted and do nothing. Results are always UTF-8. All otherSETstatements,SET statement_timeoutincluded, are refused with42501. All statements that write, including those that create temporary tables, fail. - The rules for column names, filter operators and page sizes on the HTTP interface do not apply.
A
SELECTwith noLIMITreturns all the rows that match. FETCH FIRST n ROWS ONLYandOFFSET m ROWS FETCH FIRST n ROWS ONLYgive the same rows asLIMIT nandLIMIT n OFFSET m.FETCH … PERCENT,FETCH … WITH TIES, andFETCHtogether withLIMITgive42601. A bound value inLIMIT,OFFSETorFETCH FIRST($1) must have a type that the driver sends. pgjdbc sends one.- The table functions
generate_series,rangeandpg_get_keywords()are available. If a dataset has the name of a table function,FROM rangereads the dataset andFROM range(1, 3)calls the function. - Spring Data JPA and Hibernate 6 operate with their default settings. You do not set a dialect, and
you do not turn off the JDBC metadata access. Keep
spring.jpa.hibernate.ddl-autoatnone. The time-range limit applies to the page query. On a dataset with the limit, theWHEREof afindBy…(Pageable)must have a time range or a column with a bloom filter, or the page gives54000. Itscount(*)is an aggregate and gives no error. - A
UUIDcolumn has the typetexton this interface, notuuid. Its values are lowercase, with hyphens. A filter value can have any usual UUID form, for example upper case or no hyphens. A filter value that is not a UUID gives an error.CAST(… AS uuid)is not supported. - Dataset authorization applies to each table that a statement reads, which includes each side of a join.
- The catalog tables (
pg_catalog,information_schema) are open to each authenticated caller. They show the names and the columns of all datasets, but no rows.
Hot source¶
The keys are in Hot source on the configuration page.
A hot source holds the newest events of a dataset before they are in Iceberg. It is one of two
types: a PostgreSQL table that you own, on PostgreSQL 12 or later (POSTGRES), or the TraceLake
tail service (TAIL). The tail service reads the dataset's Kafka topic and keeps the newest rows
in memory. It writes nothing to storage, and Iceberg stays the only copy of the data. Where this
section says "your database", read "the tail service" for TAIL. An operator sets it on a dataset with the hotSource key. The gateway then divides each
query at one time, T. T is the current time minus hotSource.boundarySeconds. Iceberg supplies
the rows at or before T. The hot source supplies the rows after T. Each row comes from one of
the two only.
A row in Iceberg with no value in the time column also comes from Iceberg. Thus a hot source does not hide a row that the dataset showed before, except to a filter on a column that the hot source does not have (see below). The gateway does not read a row in the hot source that has no time value.
The hot source supplies only the columns in parquetSchema. Each other column of the Iceberg table
is empty (NULL) in each row after T, and in each row of a query on the hot source only. This
includes _unmapped (when the dataset has it), and a column that another engine added to the
table. The value is empty also when Iceberg already has the row with a value. Thus a filter on such
a column, for example _unmapped IS NOT NULL, does not find the newest rows. A filter such as
_unmapped IS NULL finds all the newest rows, also a row that Iceberg has with a value. Nothing
marks the answer. A count or a grouping on such a column counts these rows as empty. To get the
values, query Iceberg only (see One tier only). The tail service supplies
_unmapped. Thus with TAIL, only a column that is not in parquetSchema and is not _unmapped
is empty after T.
Hot source not available¶
The gateway can fail to read the hot source before it starts the answer. With TAIL, the gateway
also does not use the tail service when the tail service does not have all the rows after T, or
when it is more than hotSource.maxLagSeconds behind its Kafka topic. Then the gateway answers
from Iceberg only. The answer has no rows after T. The rows at or before T are complete.
- On HTTP, the response has a
hotTiermember beforerows:{"hotTier": {"outcome": "degraded", "boundary": "<T>"}, "rows": [...]}. The member is present only on this type of answer. - On PostgreSQL, the gateway sends a
NOTICEwith SQLSTATE01T00before the first row. TheDETAILfield of the notice givesT. Many drivers show a notice only after the statement completes. If one query string has more than one statement, theNOTICEcomes before the rows of the first statement, and it does not tell which statement is incomplete. If a statement or a query string reads more than one dataset with a hot source, there is also only oneNOTICE, and it does not tell which dataset is incomplete. ItsTis then the earliestTof the incomplete reads. Rows after thisTcan be missing from one or more of the datasets.
A client must examine each response for hotTier or the NOTICE, as it examines each response for
error. Without this check, the answer looks complete but does not have the newest data.
If the hot source fails after the gateway starts the answer, the answer is not complete. On HTTP, the
response ends with an error member. On PostgreSQL, the statement ends with an error.
Pages across T¶
Each request calculates T again. A row near T can thus come from the hot source on one page
and from Iceberg on the next page. The row then shows on 2 pages, or on no page. To get stable
pages, put an upper time bound in the filter. If this bound is at or before T, the gateway does
not read the hot source.
Filters that the hot source gets¶
Each query to the hot source has the condition timeColumn > T, except a query on the hot source
only (see One tier only). The gateway also sends a filter to
your database when the filter is one of these, on one column, with a value:
=,<>,<,<=,>,>=INandNOT INLIKE
The gateway also sends AND and OR combinations of these filters. The same rule applies to GET,
POST and PostgreSQL queries. Values go to your database as parameters, not as text in the
statement.
The gateway itself applies all other filters to the rows that the hot source returns. For such a filter, your database sends more rows, and the gateway removes the rows that do not match. The gateway also applies these filters itself:
- A filter on a
double precisioncolumn. PostgreSQL and the gateway compare-0.0andNaNdifferently. - A
LIKEfilter on auuidcolumn. PostgreSQL has noLIKEforuuid. - A filter with more than 1000 values, for example a long
INlist. - A filter with a value that PostgreSQL cannot keep: text with the character
0x00, or a time before 24 November 4714 BC. NOT LIKE,ILIKE,LIKEwith anESCAPEcharacter other than\, and aLIKEpattern that ends in an odd number of\characters.- A comparison with
NULL. - A value that does not convert exactly to the type of the column, for example
3000000000on anintegercolumn, or a time with digits smaller than one microsecond. - A filter that does not fit in the statement to your database. The statement holds at most 65 534 filter values. The gateway takes the filters in order, and applies each filter that does not fit itself.
To make these filters fast, index the filter columns in your table. A comparison with <, <=,
> or >= on a text column uses COLLATE "C". An index serves it only if the index also uses
COLLATE "C". = and IN use the collation of the column, so a usual index serves them. A
B-tree index serves LIKE only if it uses text_pattern_ops or COLLATE "C", and only for a
pattern with a fixed start, for example 'abc%'.
Time limits of the hot source¶
The gateway does not limit the number of rows from the hot source. Each query gets all the rows that match. The rows from the hot source and from Iceberg are in the same result.
The gateway sends some aggregates to your PostgreSQL database: count, sum, min, max and
avg, and grouping on columns or on date_trunc of the time column. Then it adds the result from
Iceberg. The answer is the same as the answer from 1 table. For other aggregates, the gateway reads
all the rows from the hot source. The answer is the same, but the read takes more time. Examples
of other aggregates:
- An aggregate over a join, or a window function.
- An aggregate with a filter that the database cannot do completely. For example, a filter on a
DOUBLEcolumn. minormaxof aDOUBLE,BOOLEANorUUIDcolumn, and grouping on aDOUBLEcolumn.- An aggregate or grouping on a column that is not in the hot source.
date_truncwith a unit that is notsecond,minute,hour,day,week,month,quarteroryear.
For a query with an order and a limit, the gateway asks your database for only the rows that the
page can use, in the same order. The filter must be one that your database can do completely,
and no sort column can be a DOUBLE column. Otherwise the gateway reads all the matching rows
from the hot source and sorts them.
For a query with a limit and no order, the gateway asks your database for only the rows that the page can use, in no order. The same filter rule applies. Your database selects the rows, so two runs of the same query can return different rows.
The operator sets 2 time limits on the hot source:
hotSource.statementTimeoutMsis the time to connect and to start the read. It includes the wait for a free connection. If this time is exceeded, the answer is from Iceberg only. It has thehotTiermember or theNOTICE.hotSource.readTimeoutMs(default 60 seconds) is the time to read all the rows from the hot source. This time includes the time that your client uses to read these rows. If this time is exceeded, the answer is not complete. On HTTP, the response ends with anerrormember. On PostgreSQL, the statement ends with an error. The answer can have no rows.
The order in the query sets the position of the hot rows:
- With no order, the hot rows come first. If they fill the page, the gateway does not read Iceberg.
- With a descending order on the time column, the rows with no time value come first, then the hot rows. If these rows fill the page, the gateway reads only the rows with no time value from Iceberg.
- On PostgreSQL,
NULLS FIRSTandNULLS LASTchange the position of the rows with no time value. - With an ascending order on the time column, the hot rows come after the other rows from Iceberg, and the rows with no time value come last. The gateway queries the hot source only if the rows from Iceberg do not fill the page. Before it sends the first row, the gateway makes sure that it can connect to the hot source. If the hot source fails later, the answer is not complete.
The time that your client uses to read the rows from Iceberg is not included in
hotSource.readTimeoutMs.
Read large responses quickly. Or put an upper time bound at or before T in the filter. Then the
gateway does not read the hot source.
One tier only¶
A query can read the hot source only, or Iceberg only:
| HTTP | PostgreSQL | Reads |
|---|---|---|
no tier |
<namespace>.<dataset> |
Both, divided at T |
tier=hot |
<namespace>_hot.<dataset> |
All the rows in the hot source |
tier=cold |
<namespace>_cold.<dataset> |
All the rows in Iceberg |
On HTTP, tier is a GET parameter or a POST body field. On PostgreSQL, the _hot schema has the
datasets that have a hot source, and the _cold schema has all datasets. These schemas are present
only when a dataset has a hot source.
There is no T in these queries. A row that is in Iceberg already is also in the hot source until
your database deletes it. Thus the two tiers together can have a row two times. Use this to find
the rows that are not in Iceberg yet. A row in the hot source with no time value is only in a
query on the hot source only. It is never in a query on both tiers, which reads the hot source only after T.
- A query on Iceberg only does not use the hot source, and never has the
hotTiermember or theNOTICE. - A query on the hot source only cannot use Iceberg in place of the hot source. If the gateway
cannot read the hot source before it starts the answer, or with
TAILthe tail service does not have all its rows or is too far behind, the query gets503HOT_SOURCE_UNAVAILABLEon HTTP and SQLSTATE57P03on PostgreSQL. It never gets an empty result. The time limits, the aggregates and the order and limit rules above apply. The gateway reads no data file from Iceberg, but it gets the columns from the Iceberg table. Thus a catalog that is not available, or delete files, can also stop this query.
retentionDays does not apply to a query on one tier only. Thus tier=cold and the
<namespace>_cold schema show the rows that Iceberg still has.
Dataset authorization and the time-range limit apply to the dataset, on all three forms. On HTTP,
tier=hot on a dataset with no hot source gets 400. tier=cold gets 400 if no dataset has a
hot source.
Exposing the gateway from the Helm chart¶
The chart's gateway Service is ClusterIP. Two optional objects put the gateway in front of
clients. Both are off by default, so a default install exposes nothing outside the cluster.
- HTTP:
gateway.ingress. A KubernetesIngressthat sends the path/of each host inhoststo the gateway. AnIngresscannot change the path, so one host serves one deployment. TheIngressdoes not match on the method, so aQUERYrequest arrives at the gateway asQUERY, with its body. The rule about;in the query string (in the next section) applies to this proxy too. - PostgreSQL:
gateway.pgLoadBalancer. A Service oftype: LoadBalancerwith only the PostgreSQL port. It needsqueryGateway.postgres. The load balancer passes the TCP connection through, and TLS ends at the gateway. The client thus sees the gateway's certificate. Do not put a proxy that ends TLS in front of this port. UseloadBalancerSourceRangesto limit the client addresses.
Several namespaces¶
One deployment serves one Iceberg namespace (ingestion.namespace). To keep the datasets of two
applications apart, install one deployment for each namespace. Each deployment has its own pods,
its own configuration and its own dataset authorization.
One HTTP host can be in front of all the deployments. The Helm chart has a Gateway API
HTTPRoute for this (gateway.httpRoute, off by default). Each deployment attaches its route to
the same Gateway, at the path prefix /ns/<namespace>. The route removes the prefix before it
sends the request to the gateway:
| The client sends | The gateway gets |
|---|---|
/ns/app1/query/v1/dataset/spans |
/query/v1/dataset/spans of the app1 deployment |
/ns/app2/query/v1/dataset/spans |
/query/v1/dataset/spans of the app2 deployment |
- A
404body and the auditpathshow the path without the prefix. - The proxy must not change
;in the query string.;is the AND of the filter. By default, Traefik changes a;to&. The second term of the filter then arrives as an unknown query key, and the gateway answers400to a correct filter. A different proxy can remove all of thefilterparameter, and then a request with an aggregate can return rows that are not filtered. In the client, write;as%3B. This works behind all proxies. On Traefik, you can also set--entryPoints.<name>.http.encodeQuerySemicolons=true. APOSTbody does not have this problem. - The PostgreSQL interface is not in the route. Each deployment has its own PostgreSQL port.
- A query reads the datasets of one namespace only.
- The deployments can use the same
storage.destinationUri. The object keys start with the namespace, so deployments on different namespaces do not see the files of the other, also when they use the same dataset name. Two deployments on the same namespace and the samedestinationUriwrite the same table. The ingestor and the compactor of the second deployment do not start, and the error gives thecluster.idof the first deployment. - The deployments can use the same catalog.
What the gateway does not do¶
It does not apply Iceberg delete files. If another engine deletes rows with a delete file, the
gateway refuses all queries on that dataset with 501. It does not return rows that the table says
are deleted. Compact the delete files away with the other engine to restore service. Other engines
continue to read the table correctly.
It does not give results in seconds after ingest. New events become visible a few minutes after they reach Kafka. The target is 7 minutes or less for 95 % of events. A dataset with a hot source gets the newest events from your PostgreSQL table.