提交 2221aee4 编写于 作者: S sschepens 提交者: Matteo Merli

allow reset of global topic subscription (#79)

上级 eb619f3e
......@@ -847,9 +847,6 @@ public class PersistentTopics extends AdminResource {
try {
PersistentSubscription sub = topic.getPersistentSubscription(subName);
checkNotNull(sub);
if (dn.isGlobal()) {
throw new NotAllowedException("reset cursor not supported for global topic");
}
sub.resetCursor(timestamp).get();
log.info("[{}][{}] reset cursor on subscription {} to time {}", clientAppId(), dn, subName, timestamp);
} catch (Exception e) {
......
......@@ -446,9 +446,9 @@ public class ReplicatorTest extends ReplicatorTestBase {
}
@Test(enabled = true)
public void testResetCursorFails() throws Exception {
public void testResetCursorNotFail() throws Exception {
log.info("--- Starting ReplicatorTest::testResetCursorFails ---");
log.info("--- Starting ReplicatorTest::testResetCursorNotFail ---");
// This test is to verify that reset cursor fails on global topic
SortedSet<String> testDests = new TreeSet<String>();
......@@ -488,12 +488,7 @@ public class ReplicatorTest extends ReplicatorTestBase {
fail(String.format("replication test failed with %s exception", e.getMessage()));
}
}
try {
admin1.persistentTopics().resetCursor(testDests.first(), "sub-id", System.currentTimeMillis());
fail("should have gotten not allowed exception");
} catch (Exception e) {
Assert.assertTrue(e instanceof PulsarAdminException.NotAllowedException, e.getMessage());
}
admin1.persistentTopics().resetCursor(testDests.first(), "sub-id", System.currentTimeMillis());
}
@Test(enabled = true)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册