Files
greptimedb/src/servers/AGENTS.md
T
shuiyisongandLei, HUANG 66d38e8e1c feat: add database ingestion admission through metering (#9239)
* feat: add `ingest_rows_rate_limit` database option

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* feat: add `InsertLimitInterceptor` hook to `Inserter`

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* fix: attribute insert limit checks to the target table's database

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* refactor: unify write admission through metering

Signed-off-by: shuiyisong <xixing.sys@gmail.com>

* fix: enforce write admission for pending row batches

Signed-off-by: shuiyisong <xixing.sys@gmail.com>

* feat: distinguish internal requests for ingestion metering

Signed-off-by: shuiyisong <xixing.sys@gmail.com>

* fix: admit split ingestion requests once per database

Signed-off-by: shuiyisong <xixing.sys@gmail.com>

* fix: OpenTSDB throws error reason

Signed-off-by: shuiyisong <xixing.sys@gmail.com>

* chore: use meter crate main rev

Signed-off-by: shuiyisong <xixing.sys@gmail.com>

* fix: exclude database ingest rate limit from table options

Signed-off-by: shuiyisong <xixing.sys@gmail.com>

* refactor: reserve channel 255 for internal requests

Signed-off-by: shuiyisong <xixing.sys@gmail.com>

---------

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>
Signed-off-by: shuiyisong <xixing.sys@gmail.com>
Co-authored-by: Lei, HUANG <ratuthomm@gmail.com>
2026-09-21 07:27:22 +00:00

2.3 KiB

servers — Agent & Contributor Guide

Navigation map for src/servers. Repo-wide invariants: .agents/architecture-invariants.md.

servers owns network listeners and protocol translation. Database behavior is provided through handler traits, mostly implemented by frontend.

Module map

Area Path Entry point
Lifecycle src/servers/src/server.rs Shared Server trait
Handler boundary src/servers/src/query_handler.rs, src/servers/src/query_handler/ Protocol-independent handler traits
gRPC / Flight src/servers/src/grpc.rs, src/servers/src/grpc/ gRPC services, auth, cancellation, builders
HTTP src/servers/src/http.rs, src/servers/src/http/ Routes, middleware, protocol endpoints, output formats
SQL protocols src/servers/src/mysql.rs, src/servers/src/mysql/, src/servers/src/postgres.rs, src/servers/src/postgres/ MySQL/PostgreSQL servers and type conversion
Observability protocols src/servers/src/prom_remote_write/, src/servers/src/prometheus.rs, src/servers/src/otlp/, src/servers/src/otel_arrow.rs Prometheus and OpenTelemetry conversion
Resources / TLS src/servers/src/request_memory_limiter.rs, src/servers/src/tls.rs, src/servers/src/addrs.rs Memory admission, TLS, listener addresses

Change coupling

  • Handler trait changes require matching frontend and mock implementations.
  • gRPC wire changes start in greptime-proto; update builders and handlers here after bumping it.
  • Auth or QueryContext changes must cover HTTP, gRPC, MySQL, and PostgreSQL entry points.
  • Internal frontend gRPC listeners set Channel::Internal in server-owned request extensions. Handlers preserve it through query execution and metering; client flow metadata does not grant an internal channel.
  • Finite requests split by wire handlers (Prometheus batching and OpenTSDB summary/details) admit all rows before dispatch. Admission is process-local QueryContext state; never accept it from headers or serialized contexts.
  • New protocols or externally visible routes also require frontend service and configuration wiring.

Testing

cargo nextest run -p servers

Keep protocol translation here and permissions/database behavior in frontend.