mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-08-21 06:36:54 +00:00
TopicExists can return a transient false-negative for a topic that is in fact present (a broker/filer blip under load, or a just-created topic whose existence cache is still stale). The metadata and produce handlers then tried to auto-create, hit "topic already exists", treated that as a failure, and dropped the topic from the Metadata response - so the client saw a spurious UNKNOWN_TOPIC_OR_PARTITION right after the topic was created. Return a sentinel ErrTopicAlreadyExists from the create paths and add ensureTopicExists, which treats it as confirmation the topic exists. It also folds in the repeated TopicExists -> invalidate -> recheck -> create logic shared by every metadata handler (v0-v8) and both produce paths. v2+ produce now auto-creates too, matching the auto.create.topics.enable=true behavior the rest of the gateway already simulates.