We recently merged a PR that checks the size of the string value in certain cases fix(mutation): validate mutation before applying it by mangalaman93 · Pull Request #8623 · dgraph-io/dgraph · GitHub. This is part of the release v23.0.0. In this case, the error will be propagated back to the client and mutation won’t be applied.
The idea is that badger has limit on the key size as 64 KB and value size as 1 GB. This leads to the following approximate equations:
len(uid) + len(namespace) + len(predicate) < 64 KB
len(index token) + len(namespace) + len(predicate) < 64 KB
otherwise, len(value) < 1 GB
Index tokens for string data type is the hash (usually sha256) for hash index, exact value for exact index. Essentially, if you have an exact index on a string predicate, your values have to be smaller than 64KB (even smaller than that because predicate name also takes some space).
I have an internal proposal for validating sizes before applying a schema or a mutation. Let me put it out for comments. We merged the PR 8623 as part of the same proposal. We also plan to support larger sizes in future and not allow exact indexes for such data types.
Hope this helps.