The query log stores block, source, upstream, timing, opcode and answer-summary columns and can be searched by them #102

Open
opened 2026-10-31 12:42:06 -04:00 by claude · 0 comments
Owner
  • Draft: PQ-4
  • Priority: high
  • Agent: storage-coder
  • Depends on: #101
  • Decisions: Q-PQ-4

Why

DnsQueryLogEntryEntity has no columns for the new event fields (DnsQueryLogEntryEntity.cs:23-76), and its indexes cover only time, client, response code and client id (src/dotnet/src/Ninlil.Dns.Data.EntityFrameworkCore/Configuration/DnsQueryLogEntryConfiguration.cs:38-62).

What changes

  • Entity: add Opcode, AnswerSource, Upstream (max 255), ElapsedMicroseconds (long), IsAuthenticData, BlockKind?, BlockListId?, BlockListName (max 255), BlockRule (max 512) and AnswerSummary (max 512). All columns are nullable or defaulted, so existing rows stay valid (an existing row reads as opcode Query).
  • DnsQueryLogEntryConfiguration: add indexes (AnswerSource, OccurredAtUtc) and (BlockListId, OccurredAtUtc).
  • DnsQueryLogSearchCriteria: add AnswerSource?, BlockedOnly?, BlockListId?, Upstream and Opcode? (absorbs BUG-36's search part).
  • EF repository plus Mongo repository and indexes (Ninlil.Dns.Data.MongoDb/Maintenance/MongoIndexCatalog.cs).
  • If an older build would fail on the new fields, add a MongoSchemaSteps.Known entry (Ninlil.Dns.Data.MongoDb/Maintenance/MongoSchemaSteps.cs).
  • One migration per provider (AddQueryLogOutcome), converted with file-scoped-namespaces.sh.
  • Benchmarks: bump Seeding/BenchmarkDataSet.cs Version and seed the new fields, with a realistic answer summary on most rows.
  • README query-log section: UPDATEs are now logged as UPDATE, not as an SOA query.

Acceptance

  • A search test with BlockedOnly = true returns only blocked rows. It fails first in src/dotnet/tests/Ninlil.Dns.Data.Integration.Tests: SQLite without Docker, the other engines under RequiresDocker.
  • A search test with Opcode = Update returns only the UPDATE row, on every engine.
  • QueryLogWriteBenchmarks and QueryLogSearchBenchmarks at --scale Large on Sqlite and PostgreSql, before and after, numbers in the PR, with the row-size growth from the answer summary stated.
  • Schema change: 4 migrations plus Mongo. No API or option change.

Source

  • audit-feature-parity.md §2A #2; bughunt-plan.md:539 (B20-3).
  • Owner decision 2026-10-31 (Q-PQ-4): "yes, capped 512 chars".
  • DEDUPE.md A1 (opcode filter carried over from BUG-36).
- **Draft:** PQ-4 - **Priority:** high - **Agent:** storage-coder - **Depends on:** #101 - **Decisions:** Q-PQ-4 ### Why `DnsQueryLogEntryEntity` has no columns for the new event fields (`DnsQueryLogEntryEntity.cs:23-76`), and its indexes cover only time, client, response code and client id (`src/dotnet/src/Ninlil.Dns.Data.EntityFrameworkCore/Configuration/DnsQueryLogEntryConfiguration.cs:38-62`). ### What changes - Entity: add `Opcode`, `AnswerSource`, `Upstream` (max 255), `ElapsedMicroseconds` (long), `IsAuthenticData`, `BlockKind?`, `BlockListId?`, `BlockListName` (max 255), `BlockRule` (max 512) and `AnswerSummary` (max 512). All columns are nullable or defaulted, so existing rows stay valid (an existing row reads as opcode `Query`). - `DnsQueryLogEntryConfiguration`: add indexes `(AnswerSource, OccurredAtUtc)` and `(BlockListId, OccurredAtUtc)`. - `DnsQueryLogSearchCriteria`: add `AnswerSource?`, `BlockedOnly?`, `BlockListId?`, `Upstream` and `Opcode?` (absorbs BUG-36's search part). - EF repository plus Mongo repository and indexes (`Ninlil.Dns.Data.MongoDb/Maintenance/MongoIndexCatalog.cs`). - If an older build would fail on the new fields, add a `MongoSchemaSteps.Known` entry (`Ninlil.Dns.Data.MongoDb/Maintenance/MongoSchemaSteps.cs`). - One migration per provider (`AddQueryLogOutcome`), converted with `file-scoped-namespaces.sh`. - Benchmarks: bump `Seeding/BenchmarkDataSet.cs` `Version` and seed the new fields, with a realistic answer summary on most rows. - README query-log section: UPDATEs are now logged as UPDATE, not as an SOA query. ### Acceptance - [ ] A search test with `BlockedOnly = true` returns only blocked rows. It fails first in `src/dotnet/tests/Ninlil.Dns.Data.Integration.Tests`: SQLite without Docker, the other engines under `RequiresDocker`. - [ ] A search test with `Opcode = Update` returns only the UPDATE row, on every engine. - [ ] `QueryLogWriteBenchmarks` and `QueryLogSearchBenchmarks` at `--scale Large` on Sqlite and PostgreSql, before and after, numbers in the PR, with the row-size growth from the answer summary stated. - [ ] Schema change: 4 migrations plus Mongo. No API or option change. ### Source - `audit-feature-parity.md` §2A #2; bughunt-plan.md:539 (B20-3). - Owner decision 2026-10-31 (Q-PQ-4): "yes, capped 512 chars". - DEDUPE.md A1 (opcode filter carried over from BUG-36).
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
lantea-one/ninlil#102
No description provided.