Skip to content

Commit 2b9b91d

Browse files
committed
Add fixes
Signed-off-by: AkramBitar <akram@il.ibm.com>
1 parent e361c80 commit 2b9b91d

3 files changed

Lines changed: 27 additions & 83 deletions

File tree

docs/configuration.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -615,8 +615,8 @@ token:
615615
maxPageSize: 1000
616616
```
617617

618-
See [Transaction Store API Bounds](services/storage/api-bounds.md) for details,
619-
including why movement/balance queries are intentionally not row-capped.
618+
See [Transaction Store API Limits](services/storage.md#transaction-store-api-limits)
619+
for details, including why movement/balance queries are intentionally not row-capped.
620620

621621
---
622622

docs/services/storage.md

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -315,9 +315,28 @@ Cleanup behavior is controlled by the configuration section. See the [Configurat
315315

316316
See the [Configuration Guide](../configuration.md), Section `Optional: token.tms.<name>.services.network.fabric.recovery`, for detailed parameter descriptions and tuning recommendations.
317317

318-
## Transaction Store API Bounds
319-
320-
The transaction store enforces upper bounds on its write and read paths (maximum
321-
serialised write payload, mandatory bounded pagination on transaction queries,
322-
and a hard cap on token-request queries) so a single oversized write or unbounded
323-
scan cannot monopolise database resources. See [**Transaction Store API Bounds**](storage/api-bounds.md).
318+
## Transaction Store API Limits
319+
320+
The transaction store (used by both **TTXDB** and **AuditDB**) limits its writes and
321+
reads so one huge write or one runaway query can't eat up the database. The checks
322+
live in the single SQL implementation
323+
(`token/services/storage/db/sql/common/transactions.go`), so the owner and auditor
324+
stores are both covered.
325+
326+
**Write size limit.** `AddTokenRequest`, `AddTransaction`, and `AddMovement` reject a
327+
call whose payload is larger than `maxPayloadSize` (default 4 MiB; `0` turns the check
328+
off). `AddTokenRequest` measures the raw token request plus its metadata;
329+
transaction and movement records add up their field lengths instead, to keep the
330+
write path fast.
331+
332+
**Read size limits.** `QueryTransactions` needs a bounded page argument (`nil` and
333+
`pagination.None()` are rejected; callers page through the full result set).
334+
`QueryTokenRequests` adds a hard `LIMIT` equal to `maxPageSize` (default 1000).
335+
`QueryMovements` is left uncapped on purpose: it feeds balance totals, and dropping
336+
rows there would quietly return wrong balances. It is already narrowed by its required
337+
filters.
338+
339+
Both limits have built-in defaults. You can override them in configuration
340+
(`token.storage.maxPayloadSize` / `maxPageSize`) or in code with the
341+
`WithMaxPayloadSize` / `WithMaxPageSize` store options. See the
342+
[Configuration Guide](../configuration.md) for the config keys.

docs/services/storage/api-bounds.md

Lines changed: 0 additions & 75 deletions
This file was deleted.

0 commit comments

Comments
 (0)