Repository navigation
Conversation
CheckPartitions warned and continued when minPartitions > 1 and the broker returned ErrTopicNotFound. Auto-created topics then inherited the broker default, which can be narrower than the pod count. Missing topics are now a hard error in that case, matching CheckMinPartitions. minPartitions <= 1 still returns immediately, so standalone and single-replica setups are unchanged. Arcade does not create topics itself. Fixes #71 Co-authored-by: deggen <d.kellenschwiler@bsvassociation.org>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Changed
kafka.CheckPartitionsnow returns an error whenminPartitions > 1and the broker reportsErrTopicNotFound, instead of logging a warning and continuing.minPartitions <= 1early return is unchanged, so standalone and single-replica setups (including the in-memory broker, which creates topics on subscribe and never returnsErrTopicNotFound) are not affected.app.Bootstrapstill passes an empty topic list. Propagation continues to use the existing fail-closedCheckMinPartitions. Wiring real fan-out topics into this check remains a separate change, as noted inBootstrap.Kafka.MinPartitionsfield comment, anddocs/production-kafka.mdnow describe the hard-fail contract.minPartitions > 1and withminPartitions <= 1, plus the in-memory broker at a floor of 0 or 1.Why It Was Necessary
Finding F-013 (issue #71) from the 2026-05 review: when the partition floor is greater than 1, a missing hot-path topic used to pass preflight. Kafka auto-creation then used the broker default partition count, which can be lower than the pod count, so a scaled deployment started cleanly and then ran with idle consumers.
CheckMinPartitionsalready treats a missing topic as a hard error.CheckPartitionsdescribed the warning as intentional. That split let the horizontal-scaling guard pass a topic that did not exist.Choice: fail, rather than create the topic. Arcade does not provision Kafka topics.
docs/production-kafka.mdandconfig.example.yamltell operators to pre-create them, because production clusters usually disable auto-creation and because partition count, replication, and retention are operator decisions. TheBrokerinterface has no create-topic method, and the in-memory backend has nothing to create. Failing closed matchesCheckMinPartitionsand leaves topic creation with the operator. Creating topics inside the preflight would also not help the current startup call, which deliberately passes an empty list so a leftoverkafka.min_partitionscannot crash-loop an upgrade.Fixes #71
Testing Performed
go test -count=1 ./kafka/ -run 'TestCheckPartitions_'TestCheckPartitions_TopicMissing_MinPartitionsGreaterThanOneFails— missing topic with floor 3 returns an error naming the topic and the required minimum; an earlier topic that already meets the floor does not hide it.TestCheckPartitions_TopicMissing_MinPartitionsAtMostOneNoop— floors 1, 0, and -1 return nil and do not query the broker.TestCheckPartitions_MemoryBrokerMinPartitionsAtMostOneUnchanged— in-memory broker with a not-yet-subscribed topic and floor 0 or 1 still returns nil.TestCheckPartitions_ExistingTopicStillEnforcesFloor— an existing topic that is too narrow still fails, and one that meets the floor still passes.go build ./...— passed.go vet ./...— passed.magex lint(golangci-lint 2.14.0, repo.golangci.json, 58 linters including gosec) — 0 issues.go vetinside that run also passed.go test -count=1 ./...— passed (default build tags; e2e/smoke/integration packages stay excluded, same as the unit-test CI path).Impact / Risk
minPartitions > 1and relied on the warning will now get an error. The only production call site passes a nil topic list and only runs whenkafka.min_partitions > 1, so current startups do not change.minPartitions <= 1returns before any broker call, which is the documented standalone setting. The in-memory broker never returnsErrTopicNotFound.min_partitions0 or 1).CheckPartitions. When that happens, those topics must already exist with at leastkafka.min_partitionspartitions.Notifications