[BanyanDB] Store trace binary tags only in core storage, not in secondary index (sidx)
Maintainers usually reply within 1 day
Assessment
This issue has not been assessed yet.
Description
Search before asking
- I had searched in the issues and found no similar feature requirement.
Description
Trace binary tags (TAG_TYPE_DATA_BINARY) are currently written into every secondary index (sidx) of a trace, in addition to the trace core storage. This copy is useless and expensive:
- Not filterable:
parseExpr(pkg/query/logical/tag_filter.go) has no binary literal, so any condition on a binary tag fails at planning time. - Never read back from sidx:
sidxResponseToVectorizedBatchonly consumesKeys/Data/SIDs/PartIDs; projected tag values are always materialized from core blocks (findBlockTag). - Costly: binary tags are typically the largest values. They are duplicated once per index rule, rewritten on every sidx merge, and — because the full tag projection is forwarded to sidx (
prepareSIDXStreaming) — even re-read from sidx at query time when projected.
Proposal
Keep binary tags only in the trace core storage.
- Write path —
buildSidxTags(banyand/trace/write_standalone.go) skips tags whosevalueType == pbv1.ValueTypeBinaryData. Single call site; covers standalone and liaison. - Query path — in
prepareSIDXStreaming(banyand/trace/query.go), strip binary-typed tags from the sidxTagProjection(or narrow it to tags referenced by theTagFilter), so sidx never loads binary columns, including from legacy parts. - Planner — reject conditions on
TAG_TYPE_DATA_BINARYtags with an explicit "binary tags cannot be filtered" error. This also coversbinTag = null, which would otherwise change semantics once the column is gone from sidx.
Compatibility
- Existing sidx parts that contain binary columns stay readable; sidx already tolerates tags absent from some blocks. Old columns disappear naturally as merges rewrite parts — no migration.
- Mixed-version clusters are safe: the sidx mem part is built where the write is handled; no wire format change.
- Query results are unchanged, since binary values are already served from core storage.
Tests
- Unit:
buildSidxTagsdrops binary tags. - Write + query: binary tag absent from sidx mem parts, still returned via projection from core.
- sidx
TagProjectioncontains no binary tags. - Planner rejects conditions (including
= null) on binary tags. - Merge of an old-format sidx part (with binary column) and a new one.
Use case
Reduce disk usage, write/merge amplification, and query I/O for traces that carry large binary tags.
Related issues
No response
Are you willing to submit a pull request to implement this on your own?
- Yes I am willing to submit a pull request on my own!
Code of Conduct
- I agree to follow this project's Code of Conduct
- Dominant language
- Java
- Stars
- 25k
- Forks
- 6.6k
- Avg merge
- 10h 45m
- Merged PRs (30d)
- 49
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apache/skywalking
-
[Bug] [BanyanDB] timestamp.ParseDuration silently drops everything after "d"Possibly taken @soujasK claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
apache/skywalking#14287 ·
Maintainers usually reply within 1 day
-
[BanyanDB] Let trace queries exclude the raw span from resultsPossibly taken @hanahmily claimed this today. Openenhancement
apache/skywalking#14288 · 1 assignee ·
Maintainers usually reply within 1 day
-
[BanyanDB] Data race and nil-pointer panic: measure write during standalone shutdown after segment closePossibly taken @hanahmily claimed this today. Openbug
apache/skywalking#14285 · 1 assignee ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
apache/skywalking#14283 · 1 comment ·
Maintainers usually reply within 1 day
-
[Bug] BanyanDB stream query on a hot entity scans all its rows despite a small limitPossibly taken @hanahmily claimed this 8 days ago. Openbug
apache/skywalking#14261 · 1 assignee ·
Maintainers usually reply within 1 day
All issues in apache/skywalking
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
testng-team/testng#3672 ·
Maintainers usually reply within 1 day
-
triage
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
eclipse-edc/IdentityHub#1296 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
cloudfoundry/uaa#4194 ·
Maintainers usually reply within 1 day
-
area: ui priority: medium
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
tetsuji16/microProject#1721 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 2 days