After the routing information about a topic is completely cleared, you can specify a new number of partitions for the topic.

Symptoms

If you delete a topic with n partitions and create this topic again by setting the partition count to a value smaller than n, the system displays a message. The message indicates that the topic is created but the partition count cannot be smaller than the previously configured number, so the partition count is reset to n.

Causes

When a topic is deleted from an instance of an earlier version, the routing information about the topic cannot be completely cleared. As a result, you cannot create a topic with fewer partitions than those of the deleted topic. After the instance is upgraded to the latest version, the routing information about the topic deleted from the instance before the upgrade is still retained. To completely clear the routing information about the topic, create a topic with the same configuration as the previously deleted topic, delete it, and then create it again. After the whole process is complete, you can specify the partition count for the topic.

Solutions

  1. Make sure that the minor version of the instance is the latest.
    In the Message Queue for Apache Kafka console, navigate to the Basic Information section of the Instance Details page and view the minor version of the instance on the right side of Minor Version.
    • If Latest Version appears, you do not need to upgrade the minor version of the instance.
    • If Upgrade Minor Version appears, click Upgrade Minor Version to upgrade the minor version of the instance.
  2. Create a topic with the same configuration as the previously deleted topic, delete it, and then create it again.
    Go to the Topics page, create a topic with the same configuration as the previously deleted topic, delete it, create it again, and then specify the partition count.