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

remove wild keeper #928

Merged
merged 1 commit into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,11 @@ public void addKeeper(KeeperTransMeta keeperTransMeta) {
@Override
public void removeKeeper(KeeperTransMeta keeperTransMeta) {
try {
long clusterDbId = null == keeperTransMeta.getClusterDbId() ? 1:keeperTransMeta.getClusterDbId();
long shardDbId = null == keeperTransMeta.getShardDbId() ? 1:keeperTransMeta.getShardDbId();
restTemplate.exchange("http://{ip}:{port}/keepers/clusters/{clusterId}/shards/{shardId}",
HttpMethod.DELETE, new HttpEntity<Object>(keeperTransMeta), Void.class,
keeperContainerMeta.getIp(), keeperContainerMeta.getPort(), keeperTransMeta.getClusterDbId(),
keeperTransMeta.getShardDbId());
keeperContainerMeta.getIp(), keeperContainerMeta.getPort(), clusterDbId, shardDbId);
} catch (HttpStatusCodeException ex) {
throw KeeperContainerErrorParser.parseErrorFromHttpException(ex);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public class DefaultKeeperStateController extends AbstractLifecycle implements K

private Logger logger = LoggerFactory.getLogger(getClass());

private int addKeeperSuccessTimeoutMilli = 180000;
private int removeKeeperSuccessTimeoutMilli = 60000;
private int addKeeperSuccessTimeoutMilli = 10000;
private int removeKeeperSuccessTimeoutMilli = 10000;

@Autowired
private KeeperContainerServiceFactory keeperContainerServiceFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,17 @@ public void testRemoveKeeper() throws Exception {
Assert.assertEquals(meta, Codec.DEFAULT.decode(request.getBody().readByteArray(), KeeperTransMeta.class));
}

@Test
public void testRemoveWithReplId() throws Exception {
this.webServer.enqueue(new MockResponse());
KeeperTransMeta meta = new KeeperTransMeta(1L, new KeeperMeta());
this.service.removeKeeper(meta);
RecordedRequest request = this.webServer.takeRequest();
Assert.assertEquals(HttpMethod.DELETE.toString(), request.getMethod());
Assert.assertEquals("/keepers/clusters/1/shards/1", request.getPath());
Assert.assertEquals(meta, Codec.DEFAULT.decode(request.getBody().readByteArray(), KeeperTransMeta.class));
}

private KeeperTransMeta mockKeeperMeta() {
return new KeeperTransMeta(1L, 1L, new KeeperMeta());
}
Expand Down
Loading