Skip to content

topic partition not found #1361

Open
Open
@zty-f

Description

@zty-f

The kafka configuration has only 60 shards, but the partition that is pushed is not within this access。

Kafka Version
v0.4.47

My kafka cluster creation code

func (c cluster) NewSyncWriterWithAckNoBatch(ctx context.Context, topic string, ackConfig int) queue.Writer {
	ack := kafka.RequireNone
	if ackConfig == int(kafka.RequireNone) || ackConfig == int(kafka.RequireOne) || ackConfig == int(kafka.RequireAll) {
		ack = kafka.RequiredAcks(ackConfig)
	}

	client := &kafka.Writer{
		Addr:                   kafka.TCP(c.Brokers...),
		Balancer:               &kafka.LeastBytes{},
		BatchSize:              1,
		AllowAutoTopicCreation: false, // 不允许自动创建topic, 应该从后台创建,方便统一管理
		Topic:                  topic, // 如果创建生产者的时候,topic为空,那么每个消息体里就必须指定topic
		Async:                  false,
		RequiredAcks:           ack,
	}

	if c.Sasl.Username != "" {
		client.Transport = &kafka.Transport{
			TLS:  c.tls,
			SASL: c.Sasl,
		}
	}
	if ctx == nil {
		ctx = context.Background()
	}
	return writer{ctx, client}
}

topic info
image

write message error
Kafka write errors (1/1), errors: [kafka.(*Client).Produce: fetch request error: topic partition not found (topic="mall_growth_center_7001000" partition=3191777)]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions