Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When the Replicator is enabled, no managedLedger is created when updating the number of partitions #10910

Merged
merged 2 commits into from
Jun 17, 2021

Conversation

315157973
Copy link
Contributor

Fixes #10673

Motivation

When updating the number of partitions, we need to update the data in two places in zk:

/admin/partitioned-topics
/managed-ledgers/

Now we only update the number of partitions in /admin/partitioned-topics, so if we do not create a Producer or Consumer, the data obtained in another cluster will be incorrect

Modifications

1)Try to create managedLedger when updating the number of partitions
2)Ensure that the number of partitions in /admin/partitioned-topics is updated every time

Awaitility.await().untilAsserted(() -> assertNotNull(admin2.topics().getPartitionedTopicList(namespace)));
Awaitility.await().untilAsserted(() -> assertEquals(
admin2.topics().getPartitionedTopicList(namespace).get(0), persistentTopicName));
assertEquals(admin1.topics().getList(namespace).size(), 3);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@315157973 Could you please also add a check for checking we have 3 partitions in the cluster-2(using admin-1)

assertEquals(admin2.topics().getList(namespace).size(), 3);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok i will add this test

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @codelipenghui
admin.topics().getList reads the data under the /managed-ledgers node, which belongs to localZK, so the remote cluster cannot perceive it. This PR mainly fixes the remote replication problem of updatePartitions in issue#10673.

Now the CreatePartitionTopic interface does not have geo-related logic. If we want to add it, we need to add parameters to avoid circular replication. I will open another PR to support replication in CreatePartitionTopic.

Copy link
Contributor

@eolivelli eolivelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM after addressing @codelipenghui 's comments

Copy link
Contributor

@gaoran10 gaoran10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@codelipenghui codelipenghui merged commit 202da11 into apache:master Jun 17, 2021
codelipenghui pushed a commit that referenced this pull request Jun 17, 2021
…ting the number of partitions (#10910)

Fixes #10673

When updating the number of partitions, we need to update the data in two places in zk:
```
/admin/partitioned-topics
/managed-ledgers/
```

Now we only update the number of partitions in `/admin/partitioned-topics`, so if we do not create a Producer or Consumer, the data obtained in another cluster will be incorrect

1)Try to create managedLedger when updating the number of partitions
2)Ensure that the number of partitions in `/admin/partitioned-topics` is updated every time

(cherry picked from commit 202da11)
@codelipenghui codelipenghui added the cherry-picked/branch-2.7 Archived: 2.7 is end of life label Jun 17, 2021
yangl pushed a commit to yangl/pulsar that referenced this pull request Jun 23, 2021
…ting the number of partitions (apache#10910)

Fixes apache#10673

### Motivation
When updating the number of partitions, we need to update the data in two places in zk:
```
/admin/partitioned-topics
/managed-ledgers/
```

Now we only update the number of partitions in `/admin/partitioned-topics`, so if we do not create a Producer or Consumer, the data obtained in another cluster will be incorrect

### Modifications
1)Try to create managedLedger when updating the number of partitions
2)Ensure that the number of partitions in `/admin/partitioned-topics` is updated every time
@codelipenghui codelipenghui added the cherry-picked/branch-2.8 Archived: 2.8 is end of life label Jun 25, 2021
codelipenghui pushed a commit that referenced this pull request Jun 25, 2021
…ting the number of partitions (#10910)

Fixes #10673

### Motivation
When updating the number of partitions, we need to update the data in two places in zk:
```
/admin/partitioned-topics
/managed-ledgers/
```

Now we only update the number of partitions in `/admin/partitioned-topics`, so if we do not create a Producer or Consumer, the data obtained in another cluster will be incorrect

### Modifications
1)Try to create managedLedger when updating the number of partitions
2)Ensure that the number of partitions in `/admin/partitioned-topics` is updated every time

(cherry picked from commit 202da11)
@315157973 315157973 deleted the Replicator branch July 19, 2021 11:11
bharanic-dev pushed a commit to bharanic-dev/pulsar that referenced this pull request Mar 18, 2022
…ting the number of partitions (apache#10910)

Fixes apache#10673

### Motivation
When updating the number of partitions, we need to update the data in two places in zk:
```
/admin/partitioned-topics
/managed-ledgers/
```

Now we only update the number of partitions in `/admin/partitioned-topics`, so if we do not create a Producer or Consumer, the data obtained in another cluster will be incorrect

### Modifications
1)Try to create managedLedger when updating the number of partitions
2)Ensure that the number of partitions in `/admin/partitioned-topics` is updated every time
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-picked/branch-2.7 Archived: 2.7 is end of life cherry-picked/branch-2.8 Archived: 2.8 is end of life release/2.7.3 release/2.8.1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

update-partitioned-topic fails for newly created geo-replicated topic
4 participants