Skip to content

Persist and sweep topk expire tracker rows - #416

Draft
zipdoki wants to merge 3 commits into
feature/per-entity-top-k-aggfrom
feature/per-entity-top-k-expire
Draft

Persist and sweep topk expire tracker rows#416
zipdoki wants to merge 3 commits into
feature/per-entity-top-k-aggfrom
feature/per-entity-top-k-expire

Conversation

@zipdoki

@zipdoki zipdoki commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Summary

Turn topk aggregation into a two-part flow: write an expire tracker row after each score row (when Topk.expireAfterMillis > 0), and sweep expired rows in bulk via a new endpoint. Together these let downstream jobs re-aggregate stale topk entries without walking the score table itself.

Changes

  • Emit an expire row into topk.expire after every successful score write in AggregationService.aggregateTopk, keyed by AggregationConstants.expireSource / expireTarget.
  • Add AggregationService.expires + POST /graph/v3/aggregations/expire. Items are deduped by (database, table, source) and swept with expiresAt:lte:max(expiresAt) on the expires_at_asc index.
  • Store the original source / target on each expire row so the touch-line CDC can rebuild the topk event via EdgeAggregationEvent.of(expire).
  • Switch expireSource to XXHash32Wrapper + mod 2310 so writes land on the intended 2310 partitions.

How to Test

  • ./gradlew :engine:test --tests "com.kakao.actionbase.engine.service.AggregationServiceSpec"
  • ./gradlew :server:test --tests "com.kakao.actionbase.server.api.graph.v3.metadata.MetadataAggControllerE2ETest"

AI Assistance

  • This PR was written largely with AI assistance.
    • Tool / model: Claude Code (Opus 4.7)

@zipdoki zipdoki self-assigned this Jul 14, 2026
@zipdoki
zipdoki requested review from em3s and removed request for em3s July 14, 2026 11:36
Base automatically changed from feature/per-entity-top-k-agg to feature/per-entity-top-k-meta July 22, 2026 09:44
@zipdoki
zipdoki force-pushed the feature/per-entity-top-k-meta branch from bcdb6f6 to bd16d71 Compare July 22, 2026 09:46
@zipdoki
zipdoki force-pushed the feature/per-entity-top-k-expire branch from 4301f7f to 501c31f Compare July 23, 2026 01:25
@zipdoki
zipdoki changed the base branch from feature/per-entity-top-k-meta to feature/per-entity-top-k-agg July 23, 2026 01:25
zipdoki added 2 commits July 23, 2026 19:31
…op-k-expire

# Conflicts:
#	core/src/main/kotlin/com/kakao/actionbase/core/metadata/common/AggregationConstants.kt
#	engine/src/main/kotlin/com/kakao/actionbase/engine/service/AggregationService.kt
#	engine/src/test/kotlin/com/kakao/actionbase/engine/service/AggregationServiceSpec.kt
#	server/src/main/kotlin/com/kakao/actionbase/server/configuration/GraphConfiguration.kt
#	server/src/test/kotlin/com/kakao/actionbase/server/api/graph/v3/metadata/MetadataAggControllerE2ETest.kt
…op-k-expire

# Conflicts:
#	engine/src/main/kotlin/com/kakao/actionbase/engine/service/AggregationService.kt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant