You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@helix.apache.org by GitBox <gi...@apache.org> on 2020/02/12 05:35:21 UTC
[GitHub] [helix] pkuwm opened a new pull request #757: Add write REST
endpoints to helix rest for metadata store directory
pkuwm opened a new pull request #757: Add write REST endpoints to helix rest for metadata store directory
URL: https://github.com/apache/helix/pull/757
### Issues
- [ ] My PR addresses the following Helix issues and references them in the PR description:
Implements #756
### Description
- [ ] Here are some details about my PR, including screenshots of any UI changes:
We have metadata store directory service to help scale out zookeeper. Metadata store directory service provides REST APIs to access.
This PR the adds MSDS write endpoints to Helix REST.
### Tests
- [ ] The following tests are written for this issue:
- testAddMetadataStoreRealm
- testDeleteMetadataStoreRealm
- testAddShardingKey
- testDeleteShardingKey
- [ ] The following is the result of the "mvn test" command on the appropriate module:
Tests depend on the write operations in ZkMeatadataStoreDirectory. Needs to enable asserts before tests are really testing the operations successfully.
### Commits
- [ ] My commits all reference appropriate Apache Helix GitHub issues in their subject lines, and I have squashed multiple commits if they address the same issue. In addition, my commits follow the guidelines from "[How to write a good git commit message](http://chris.beams.io/posts/git-commit/)":
1. Subject is separated from body by a blank line
1. Subject is limited to 50 characters (not including Jira issue reference)
1. Subject does not end with a period
1. Subject uses the imperative mood ("add", not "adding")
1. Body wraps at 72 characters
1. Body explains "what" and "why", not "how"
### Documentation
- [ ] In case of new functionality, my PR adds documentation in the following wiki page:
(Link the GitHub wiki you added)
### Code Quality
- [ ] My diff has been formatted using helix-style.xml
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org
[GitHub] [helix] narendly commented on a change in pull request #757: Add
write REST endpoints to helix rest for metadata store directory
Posted by GitBox <gi...@apache.org>.
narendly commented on a change in pull request #757: Add write REST endpoints to helix rest for metadata store directory
URL: https://github.com/apache/helix/pull/757#discussion_r379121605
##########
File path: helix-rest/src/test/java/org/apache/helix/rest/server/resources/zookeeper/TestMetadataStoreDirectoryAccessor.java
##########
@@ -27,38 +27,60 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
+import javax.ws.rs.client.Entity;
+import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
+import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
-import org.apache.helix.ZNRecord;
-import org.apache.helix.manager.zk.ZNRecordSerializer;
+import org.apache.helix.rest.metadatastore.MetadataStoreDirectory;
+import org.apache.helix.rest.metadatastore.ZkMetadataStoreDirectory;
import org.apache.helix.rest.metadatastore.constant.MetadataStoreRoutingConstants;
+import org.apache.helix.rest.metadatastore.exceptions.InvalidRoutingDataException;
import org.apache.helix.rest.server.AbstractTestClass;
import org.apache.helix.rest.server.util.JerseyUriRequestBuilder;
+import org.apache.helix.zookeeper.datamodel.ZNRecord;
+import org.apache.helix.zookeeper.datamodel.serializer.ZNRecordSerializer;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
+import static org.apache.helix.rest.common.HelixRestNamespace.DEFAULT_NAMESPACE_NAME;
+
Review comment:
Nit: could we avoid static imports and use them inline?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org
[GitHub] [helix] narendly commented on a change in pull request #757: Add
write REST endpoints to helix rest for metadata store directory
Posted by GitBox <gi...@apache.org>.
narendly commented on a change in pull request #757: Add write REST endpoints to helix rest for metadata store directory
URL: https://github.com/apache/helix/pull/757#discussion_r379173108
##########
File path: helix-rest/src/test/java/org/apache/helix/rest/server/resources/zookeeper/TestMetadataStoreDirectoryAccessor.java
##########
@@ -167,9 +252,73 @@ public void testGetShardingKeysInRealm() throws IOException {
Assert.assertEquals(queriedShardingKeys, expectedShardingKeys);
}
+ @Test
+ public void testAddShardingKey() {
+ Set<String> expectedShardingKeysSet = new HashSet<>(
+ _metadataStoreDirectory.getAllShardingKeysInRealm(TEST_NAMESPACE, TEST_REALM_1));
+
+ Assert.assertFalse(expectedShardingKeysSet.contains(TEST_SHARDING_KEY),
+ "Realm does not have sharding key: " + TEST_SHARDING_KEY);
+
+ // Request that gets not found response.
+ put(NON_EXISTING_NAMESPACE_URI_PREFIX + TEST_REALM_1 + "/sharding-keys/" + TEST_SHARDING_KEY,
+ null, Entity.entity("", MediaType.APPLICATION_JSON_TYPE),
+ Response.Status.NOT_FOUND.getStatusCode());
+
+ // Successful request.
+ put(TEST_NAMESPACE_URI_PREFIX + "/metadata-store-realms/" + TEST_REALM_1 + "/sharding-keys/"
+ + TEST_SHARDING_KEY, null, Entity.entity("", MediaType.APPLICATION_JSON_TYPE),
+ Response.Status.CREATED.getStatusCode());
+
+ Set<String> updatedShardingKeysSet = new HashSet<>(
+ _metadataStoreDirectory.getAllShardingKeysInRealm(TEST_NAMESPACE, TEST_REALM_1));
+ expectedShardingKeysSet.add(TEST_SHARDING_KEY);
+
+// Assert.assertEquals(updatedShardingKeysSet, expectedShardingKeysSet);
+ }
+
+ @Test(dependsOnMethods = "testAddShardingKey")
+ public void testDeleteShardingKey() {
+ Set<String> expectedShardingKeysSet = new HashSet<>(
+ _metadataStoreDirectory.getAllShardingKeysInRealm(TEST_NAMESPACE, TEST_REALM_1));
+
+// Assert.assertTrue(expectedShardingKeysSet.contains(TEST_SHARDING_KEY),
+// "Realm should have sharding key: " + TEST_SHARDING_KEY);
+
+ // Request that gets not found response.
+ delete(NON_EXISTING_NAMESPACE_URI_PREFIX + TEST_REALM_1 + "/sharding-keys/" + TEST_SHARDING_KEY,
+ Response.Status.NOT_FOUND.getStatusCode());
+
+ // Successful request.
+ delete(TEST_NAMESPACE_URI_PREFIX + "/metadata-store-realms/" + TEST_REALM_1 + "/sharding-keys/"
+ + TEST_SHARDING_KEY, Response.Status.OK.getStatusCode());
+
+ Set<String> updatedShardingKeysSet = new HashSet<>(
+ _metadataStoreDirectory.getAllShardingKeysInRealm(TEST_NAMESPACE, TEST_REALM_1));
+ expectedShardingKeysSet.remove(TEST_SHARDING_KEY);
+
+// Assert.assertEquals(updatedShardingKeysSet, expectedShardingKeysSet);
+ }
+
@AfterClass
- public void afterClass() {
- _zkList.forEach(zk -> ZK_SERVER_MAP.get(zk).getZkClient()
- .deleteRecursive(MetadataStoreRoutingConstants.ROUTING_DATA_PATH));
+ public void afterClass() throws Exception {
+ _metadataStoreDirectory.close();
+ deleteRoutingDataPath();
+ }
+
+ private void deleteRoutingDataPath() throws Exception {
Review comment:
Should we do an Assert.assertTrue on the return value of verify()?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org
[GitHub] [helix] narendly commented on a change in pull request #757: Add
write REST endpoints to helix rest for metadata store directory
Posted by GitBox <gi...@apache.org>.
narendly commented on a change in pull request #757: Add write REST endpoints to helix rest for metadata store directory
URL: https://github.com/apache/helix/pull/757#discussion_r379123140
##########
File path: helix-rest/src/test/java/org/apache/helix/rest/server/resources/zookeeper/TestMetadataStoreDirectoryAccessor.java
##########
@@ -167,9 +254,58 @@ public void testGetShardingKeysInRealm() throws IOException {
Assert.assertEquals(queriedShardingKeys, expectedShardingKeys);
}
+ @Test
+ public void testAddShardingKey() {
+ Set<String> expectedShardingKeysSet = new HashSet<>(
+ _metadataStoreDirectory.getAllShardingKeysInRealm(TEST_NAMESPACE, TEST_REALM_1));
+
+ Assert.assertFalse(expectedShardingKeysSet.contains(TEST_SHARDING_KEY),
+ "Realm does not have sharding key: " + TEST_SHARDING_KEY);
+
+ // Request that gets not found response.
+ put(NON_EXISTING_NAMESPACE_URI_PREFIX + TEST_REALM_1 + "/sharding-keys/" + TEST_SHARDING_KEY,
+ null, Entity.entity("", MediaType.APPLICATION_JSON_TYPE),
+ Response.Status.NOT_FOUND.getStatusCode());
+
+ // Successful request.
+ put(TEST_NAMESPACE_URI_PREFIX + "/metadata-store-realms/" + TEST_REALM_1 + "/sharding-keys/"
+ + TEST_SHARDING_KEY, null, Entity.entity("", MediaType.APPLICATION_JSON_TYPE),
+ Response.Status.CREATED.getStatusCode());
+
+ Set<String> updatedShardingKeysSet = new HashSet<>(
+ _metadataStoreDirectory.getAllShardingKeysInRealm(TEST_NAMESPACE, TEST_REALM_1));
+ expectedShardingKeysSet.add(TEST_SHARDING_KEY);
+
+// Assert.assertEquals(updatedShardingKeysSet, expectedShardingKeysSet);
+ }
+
+ @Test(dependsOnMethods = "testAddShardingKey")
+ public void testDeleteShardingKey() {
+ Set<String> expectedShardingKeysSet = new HashSet<>(
+ _metadataStoreDirectory.getAllShardingKeysInRealm(TEST_NAMESPACE, TEST_REALM_1));
+
+// Assert.assertTrue(expectedShardingKeysSet.contains(TEST_SHARDING_KEY),
+// "Realm should have sharding key: " + TEST_SHARDING_KEY);
+
+ // Request that gets not found response.
+ delete(NON_EXISTING_NAMESPACE_URI_PREFIX + TEST_REALM_1 + "/sharding-keys/" + TEST_SHARDING_KEY,
+ Response.Status.NOT_FOUND.getStatusCode());
+
+ // Successful request.
+ delete(TEST_NAMESPACE_URI_PREFIX + "/metadata-store-realms/" + TEST_REALM_1 + "/sharding-keys/"
+ + TEST_SHARDING_KEY, Response.Status.OK.getStatusCode());
+
+ Set<String> updatedShardingKeysSet = new HashSet<>(
+ _metadataStoreDirectory.getAllShardingKeysInRealm(TEST_NAMESPACE, TEST_REALM_1));
+ expectedShardingKeysSet.remove(TEST_SHARDING_KEY);
+
+// Assert.assertEquals(updatedShardingKeysSet, expectedShardingKeysSet);
+ }
+
@AfterClass
public void afterClass() {
+ _metadataStoreDirectory.close();
_zkList.forEach(zk -> ZK_SERVER_MAP.get(zk).getZkClient()
- .deleteRecursive(MetadataStoreRoutingConstants.ROUTING_DATA_PATH));
+ .deleteRecursively(MetadataStoreRoutingConstants.ROUTING_DATA_PATH));
Review comment:
Probably a good idea to add a TestHelper.verify().
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org
[GitHub] [helix] narendly commented on a change in pull request #757: Add
write REST endpoints to helix rest for metadata store directory
Posted by GitBox <gi...@apache.org>.
narendly commented on a change in pull request #757: Add write REST endpoints to helix rest for metadata store directory
URL: https://github.com/apache/helix/pull/757#discussion_r378638794
##########
File path: helix-rest/src/main/java/org/apache/helix/rest/server/resources/metadatastore/MetadataStoreDirectoryAccessor.java
##########
@@ -124,7 +148,34 @@ public Response getShardingKeys(@QueryParam("realm") String realm) {
return JSONRepresentation(responseMap);
}
- private void getHelixNamespace() {
+ @PUT
+ @Path("/metadata-store-realms/{realm}/sharding-keys/{sharding-key: .+}")
Review comment:
I actually take this back. I think this approach makes sense - the fact that sharding key strings contain "/"s threw me off. Resolving.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org
[GitHub] [helix] pkuwm commented on a change in pull request #757: Add write
REST endpoints to helix rest for metadata store directory
Posted by GitBox <gi...@apache.org>.
pkuwm commented on a change in pull request #757: Add write REST endpoints to helix rest for metadata store directory
URL: https://github.com/apache/helix/pull/757#discussion_r379150234
##########
File path: helix-rest/src/test/java/org/apache/helix/rest/server/resources/zookeeper/TestMetadataStoreDirectoryAccessor.java
##########
@@ -27,38 +27,60 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
+import javax.ws.rs.client.Entity;
+import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
+import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
-import org.apache.helix.ZNRecord;
-import org.apache.helix.manager.zk.ZNRecordSerializer;
+import org.apache.helix.rest.metadatastore.MetadataStoreDirectory;
+import org.apache.helix.rest.metadatastore.ZkMetadataStoreDirectory;
import org.apache.helix.rest.metadatastore.constant.MetadataStoreRoutingConstants;
+import org.apache.helix.rest.metadatastore.exceptions.InvalidRoutingDataException;
import org.apache.helix.rest.server.AbstractTestClass;
import org.apache.helix.rest.server.util.JerseyUriRequestBuilder;
+import org.apache.helix.zookeeper.datamodel.ZNRecord;
+import org.apache.helix.zookeeper.datamodel.serializer.ZNRecordSerializer;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
+import static org.apache.helix.rest.common.HelixRestNamespace.DEFAULT_NAMESPACE_NAME;
+
Review comment:
I don't have strong preference. I will address this in next PR for read endpoints.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org
[GitHub] [helix] narendly commented on a change in pull request #757: Add
write REST endpoints to helix rest for metadata store directory
Posted by GitBox <gi...@apache.org>.
narendly commented on a change in pull request #757: Add write REST endpoints to helix rest for metadata store directory
URL: https://github.com/apache/helix/pull/757#discussion_r378420836
##########
File path: helix-rest/src/main/java/org/apache/helix/rest/server/resources/metadatastore/MetadataStoreDirectoryAccessor.java
##########
@@ -84,6 +86,31 @@ public Response getAllMetadataStoreRealms() {
return JSONRepresentation(responseMap);
}
+ @PUT
+ @Path("/metadata-store-realms/{realm}")
+ public Response addMetadataStoreRealm(@PathParam("realm") String realm) {
+ try {
+ LOG.error("updating {} {}", _namespace, realm);
Review comment:
Why is this `error`? Should we make this an info log? And "updating {} {}" is not detailed enough.
Say something like "Successfully added metadata store realm {} to namespace {}!"... and put it after the call so we know it succeeded.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org
[GitHub] [helix] narendly commented on a change in pull request #757: Add
write REST endpoints to helix rest for metadata store directory
Posted by GitBox <gi...@apache.org>.
narendly commented on a change in pull request #757: Add write REST endpoints to helix rest for metadata store directory
URL: https://github.com/apache/helix/pull/757#discussion_r378636891
##########
File path: helix-rest/src/main/java/org/apache/helix/rest/server/resources/metadatastore/MetadataStoreDirectoryAccessor.java
##########
@@ -124,7 +148,34 @@ public Response getShardingKeys(@QueryParam("realm") String realm) {
return JSONRepresentation(responseMap);
}
- private void getHelixNamespace() {
+ @PUT
+ @Path("/metadata-store-realms/{realm}/sharding-keys/{sharding-key: .+}")
Review comment:
Why did we decide to make this a PathParam instead of a QueryParam? I think QueryParam would be easier to use and would minimize unnecessary confusion.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org
[GitHub] [helix] narendly merged pull request #757: Add write REST endpoints
to helix rest for metadata store directory
Posted by GitBox <gi...@apache.org>.
narendly merged pull request #757: Add write REST endpoints to helix rest for metadata store directory
URL: https://github.com/apache/helix/pull/757
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org
[GitHub] [helix] pkuwm commented on a change in pull request #757: Add write
REST endpoints to helix rest for metadata store directory
Posted by GitBox <gi...@apache.org>.
pkuwm commented on a change in pull request #757: Add write REST endpoints to helix rest for metadata store directory
URL: https://github.com/apache/helix/pull/757#discussion_r378480908
##########
File path: helix-rest/src/main/java/org/apache/helix/rest/server/resources/metadatastore/MetadataStoreDirectoryAccessor.java
##########
@@ -84,6 +86,31 @@ public Response getAllMetadataStoreRealms() {
return JSONRepresentation(responseMap);
}
+ @PUT
+ @Path("/metadata-store-realms/{realm}")
+ public Response addMetadataStoreRealm(@PathParam("realm") String realm) {
+ try {
+ LOG.error("updating {} {}", _namespace, realm);
Review comment:
It was left for me to debug. I've removed it before you finished the review. But somehow you still saw it.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org
[GitHub] [helix] pkuwm commented on a change in pull request #757: Add write
REST endpoints to helix rest for metadata store directory
Posted by GitBox <gi...@apache.org>.
pkuwm commented on a change in pull request #757: Add write REST endpoints to helix rest for metadata store directory
URL: https://github.com/apache/helix/pull/757#discussion_r379149852
##########
File path: helix-rest/src/test/java/org/apache/helix/rest/server/resources/zookeeper/TestMetadataStoreDirectoryAccessor.java
##########
@@ -167,9 +254,58 @@ public void testGetShardingKeysInRealm() throws IOException {
Assert.assertEquals(queriedShardingKeys, expectedShardingKeys);
}
+ @Test
+ public void testAddShardingKey() {
+ Set<String> expectedShardingKeysSet = new HashSet<>(
+ _metadataStoreDirectory.getAllShardingKeysInRealm(TEST_NAMESPACE, TEST_REALM_1));
+
+ Assert.assertFalse(expectedShardingKeysSet.contains(TEST_SHARDING_KEY),
+ "Realm does not have sharding key: " + TEST_SHARDING_KEY);
+
+ // Request that gets not found response.
+ put(NON_EXISTING_NAMESPACE_URI_PREFIX + TEST_REALM_1 + "/sharding-keys/" + TEST_SHARDING_KEY,
+ null, Entity.entity("", MediaType.APPLICATION_JSON_TYPE),
+ Response.Status.NOT_FOUND.getStatusCode());
+
+ // Successful request.
+ put(TEST_NAMESPACE_URI_PREFIX + "/metadata-store-realms/" + TEST_REALM_1 + "/sharding-keys/"
+ + TEST_SHARDING_KEY, null, Entity.entity("", MediaType.APPLICATION_JSON_TYPE),
+ Response.Status.CREATED.getStatusCode());
+
+ Set<String> updatedShardingKeysSet = new HashSet<>(
+ _metadataStoreDirectory.getAllShardingKeysInRealm(TEST_NAMESPACE, TEST_REALM_1));
+ expectedShardingKeysSet.add(TEST_SHARDING_KEY);
+
+// Assert.assertEquals(updatedShardingKeysSet, expectedShardingKeysSet);
+ }
+
+ @Test(dependsOnMethods = "testAddShardingKey")
+ public void testDeleteShardingKey() {
+ Set<String> expectedShardingKeysSet = new HashSet<>(
+ _metadataStoreDirectory.getAllShardingKeysInRealm(TEST_NAMESPACE, TEST_REALM_1));
+
+// Assert.assertTrue(expectedShardingKeysSet.contains(TEST_SHARDING_KEY),
+// "Realm should have sharding key: " + TEST_SHARDING_KEY);
+
+ // Request that gets not found response.
+ delete(NON_EXISTING_NAMESPACE_URI_PREFIX + TEST_REALM_1 + "/sharding-keys/" + TEST_SHARDING_KEY,
+ Response.Status.NOT_FOUND.getStatusCode());
+
+ // Successful request.
+ delete(TEST_NAMESPACE_URI_PREFIX + "/metadata-store-realms/" + TEST_REALM_1 + "/sharding-keys/"
+ + TEST_SHARDING_KEY, Response.Status.OK.getStatusCode());
+
+ Set<String> updatedShardingKeysSet = new HashSet<>(
+ _metadataStoreDirectory.getAllShardingKeysInRealm(TEST_NAMESPACE, TEST_REALM_1));
+ expectedShardingKeysSet.remove(TEST_SHARDING_KEY);
+
+// Assert.assertEquals(updatedShardingKeysSet, expectedShardingKeysSet);
+ }
+
@AfterClass
public void afterClass() {
+ _metadataStoreDirectory.close();
_zkList.forEach(zk -> ZK_SERVER_MAP.get(zk).getZkClient()
- .deleteRecursive(MetadataStoreRoutingConstants.ROUTING_DATA_PATH));
+ .deleteRecursively(MetadataStoreRoutingConstants.ROUTING_DATA_PATH));
Review comment:
`deleteRecursively` is a sync blocking call. Once `deleteRecursively` completes, the path is deleted.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org
[GitHub] [helix] pkuwm commented on issue #757: Add write REST endpoints to
helix rest for metadata store directory
Posted by GitBox <gi...@apache.org>.
pkuwm commented on issue #757: Add write REST endpoints to helix rest for metadata store directory
URL: https://github.com/apache/helix/pull/757#issuecomment-585555358
@narendly I pushed a new commit to fix unit tests, update tests to use namespaced APIs and remove deprecated classes. Tests all pass. Can you take a look again? Thanks.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org
[GitHub] [helix] pkuwm commented on a change in pull request #757: Add write
REST endpoints to helix rest for metadata store directory
Posted by GitBox <gi...@apache.org>.
pkuwm commented on a change in pull request #757: Add write REST endpoints to helix rest for metadata store directory
URL: https://github.com/apache/helix/pull/757#discussion_r379125110
##########
File path: helix-rest/src/test/java/org/apache/helix/rest/metadatastore/accessor/TestZkRoutingDataReader.java
##########
@@ -42,12 +42,16 @@
@BeforeClass
public void beforeClass() {
+ ZK_SERVER_MAP.get(ZK_ADDR).getZkClient()
+ .deleteRecursively(MetadataStoreRoutingConstants.ROUTING_DATA_PATH);
Review comment:
This should be a must because I believe there would be a latency for write -> read. I will add them once we have write operations ready and enable the asserts
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org
[GitHub] [helix] narendly commented on a change in pull request #757: Add
write REST endpoints to helix rest for metadata store directory
Posted by GitBox <gi...@apache.org>.
narendly commented on a change in pull request #757: Add write REST endpoints to helix rest for metadata store directory
URL: https://github.com/apache/helix/pull/757#discussion_r379121334
##########
File path: helix-rest/src/test/java/org/apache/helix/rest/metadatastore/accessor/TestZkRoutingDataReader.java
##########
@@ -42,12 +42,16 @@
@BeforeClass
public void beforeClass() {
+ ZK_SERVER_MAP.get(ZK_ADDR).getZkClient()
+ .deleteRecursively(MetadataStoreRoutingConstants.ROUTING_DATA_PATH);
_zkRoutingDataReader = new ZkRoutingDataReader(DUMMY_NAMESPACE, ZK_ADDR, null);
}
@AfterClass
public void afterClass() {
_zkRoutingDataReader.close();
+ ZK_SERVER_MAP.get(ZK_ADDR).getZkClient()
+ .deleteRecursively(MetadataStoreRoutingConstants.ROUTING_DATA_PATH);
Review comment:
Nit: a good addition to this would be a TestHelper.verify() that checks that the deletion has completed.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org
[GitHub] [helix] narendly commented on a change in pull request #757: Add
write REST endpoints to helix rest for metadata store directory
Posted by GitBox <gi...@apache.org>.
narendly commented on a change in pull request #757: Add write REST endpoints to helix rest for metadata store directory
URL: https://github.com/apache/helix/pull/757#discussion_r379121949
##########
File path: helix-rest/src/test/java/org/apache/helix/rest/server/resources/zookeeper/TestMetadataStoreDirectoryAccessor.java
##########
@@ -27,38 +27,60 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
+import javax.ws.rs.client.Entity;
+import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
+import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
-import org.apache.helix.ZNRecord;
-import org.apache.helix.manager.zk.ZNRecordSerializer;
+import org.apache.helix.rest.metadatastore.MetadataStoreDirectory;
+import org.apache.helix.rest.metadatastore.ZkMetadataStoreDirectory;
import org.apache.helix.rest.metadatastore.constant.MetadataStoreRoutingConstants;
+import org.apache.helix.rest.metadatastore.exceptions.InvalidRoutingDataException;
import org.apache.helix.rest.server.AbstractTestClass;
import org.apache.helix.rest.server.util.JerseyUriRequestBuilder;
+import org.apache.helix.zookeeper.datamodel.ZNRecord;
+import org.apache.helix.zookeeper.datamodel.serializer.ZNRecordSerializer;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
+import static org.apache.helix.rest.common.HelixRestNamespace.DEFAULT_NAMESPACE_NAME;
+
public class TestMetadataStoreDirectoryAccessor extends AbstractTestClass {
/*
* The following are constants to be used for testing.
*/
+ private static final String TEST_NAMESPACE_URI_PREFIX = "/namespaces/" + TEST_NAMESPACE;
+ private static final String NON_EXISTING_NAMESPACE_URI_PREFIX =
+ "/namespaces/not-existed-namespace/metadata-store-realms/";
private static final String TEST_REALM_1 = "testRealm1";
private static final List<String> TEST_SHARDING_KEYS_1 =
Arrays.asList("/sharding/key/1/a", "/sharding/key/1/b", "/sharding/key/1/c");
private static final String TEST_REALM_2 = "testRealm2";
private static final List<String> TEST_SHARDING_KEYS_2 =
Arrays.asList("/sharding/key/1/d", "/sharding/key/1/e", "/sharding/key/1/f");
+ private static final String TEST_REALM_3 = "testRealm3";
+ private static final String TEST_SHARDING_KEY = "/sharding/key/1/x";
// List of all ZK addresses, each of which corresponds to a namespace/routing ZK
private List<String> _zkList;
+ private MetadataStoreDirectory _metadataStoreDirectory;
@BeforeClass
- public void beforeClass() {
+ public void beforeClass() throws InvalidRoutingDataException {
_zkList = new ArrayList<>(ZK_SERVER_MAP.keySet());
+ _zkList.forEach(zk -> ZK_SERVER_MAP.get(zk).getZkClient()
+ .deleteRecursively(MetadataStoreRoutingConstants.ROUTING_DATA_PATH));
Review comment:
Could add TestHelper.verify for making the test stable.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org
[GitHub] [helix] narendly commented on a change in pull request #757: Add
write REST endpoints to helix rest for metadata store directory
Posted by GitBox <gi...@apache.org>.
narendly commented on a change in pull request #757: Add write REST endpoints to helix rest for metadata store directory
URL: https://github.com/apache/helix/pull/757#discussion_r379122606
##########
File path: helix-rest/src/test/java/org/apache/helix/rest/server/resources/zookeeper/TestMetadataStoreDirectoryAccessor.java
##########
@@ -27,38 +27,60 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
+import javax.ws.rs.client.Entity;
+import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
+import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
-import org.apache.helix.ZNRecord;
-import org.apache.helix.manager.zk.ZNRecordSerializer;
+import org.apache.helix.rest.metadatastore.MetadataStoreDirectory;
+import org.apache.helix.rest.metadatastore.ZkMetadataStoreDirectory;
import org.apache.helix.rest.metadatastore.constant.MetadataStoreRoutingConstants;
+import org.apache.helix.rest.metadatastore.exceptions.InvalidRoutingDataException;
import org.apache.helix.rest.server.AbstractTestClass;
import org.apache.helix.rest.server.util.JerseyUriRequestBuilder;
+import org.apache.helix.zookeeper.datamodel.ZNRecord;
+import org.apache.helix.zookeeper.datamodel.serializer.ZNRecordSerializer;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
+import static org.apache.helix.rest.common.HelixRestNamespace.DEFAULT_NAMESPACE_NAME;
+
Review comment:
Since this is a test class, I am actually fine leaving it in either way if you think this improves readability.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org
[GitHub] [helix] narendly commented on a change in pull request #757: Add
write REST endpoints to helix rest for metadata store directory
Posted by GitBox <gi...@apache.org>.
narendly commented on a change in pull request #757: Add write REST endpoints to helix rest for metadata store directory
URL: https://github.com/apache/helix/pull/757#discussion_r379173157
##########
File path: helix-rest/src/test/java/org/apache/helix/rest/metadatastore/accessor/TestZkRoutingDataReader.java
##########
@@ -130,4 +133,18 @@ public void testGetRoutingDataMSRDChildEmptyValue() {
+ ". Routing ZooKeeper address: " + ZK_ADDR));
}
}
+
+ private void deleteRoutingDataPath() throws Exception {
Review comment:
Should we do an Assert.assertTrue on the return value of verify()?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org
[GitHub] [helix] narendly commented on a change in pull request #757: Add
write REST endpoints to helix rest for metadata store directory
Posted by GitBox <gi...@apache.org>.
narendly commented on a change in pull request #757: Add write REST endpoints to helix rest for metadata store directory
URL: https://github.com/apache/helix/pull/757#discussion_r379121271
##########
File path: helix-rest/src/test/java/org/apache/helix/rest/metadatastore/accessor/TestZkRoutingDataReader.java
##########
@@ -42,12 +42,16 @@
@BeforeClass
public void beforeClass() {
+ ZK_SERVER_MAP.get(ZK_ADDR).getZkClient()
+ .deleteRecursively(MetadataStoreRoutingConstants.ROUTING_DATA_PATH);
Review comment:
Nit: a good addition to this would be a TestHelper.verify() that checks that the deletion has completed.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org