kaisun2000 commented on a change in pull request #1108:
URL: https://github.com/apache/helix/pull/1108#discussion_r445208758



##########
File path: 
helix-rest/src/main/java/org/apache/helix/rest/server/resources/helix/PropertyStoreAccessor.java
##########
@@ -158,4 +187,59 @@ public Response 
deletePropertyByPath(@PathParam("clusterId") String clusterId,
     }
     return OK();
   }
+
+  private byte[] readPropertyStoreBytes(String recordPath) {
+    BaseDataAccessor<byte[]> propertyStoreDataAccessor = 
getByteArrayDataAccessor();
+
+    // If znode does not exist, bytes is null. But content of an existing 
znode could be null.
+    // We use stat ctime to check if znode exists or not. ctime == 0L means 
znode does not exist.
+    Stat stat = new Stat();
+    byte[] bytes = propertyStoreDataAccessor.get(recordPath, stat, 
AccessOption.PERSISTENT);
+    if (stat.getCtime() == 0L) {
+      throw new 
WebApplicationException(Response.status(Response.Status.NOT_FOUND)
+          .entity(String.format("The property store path %s doesn't exist", 
recordPath)).build());
+    }
+
+    return bytes;
+  }
+
+  private Response decompressBytes(byte[] bytes, String recordPath, String 
compression) {
+    byte[] decompressedBytes;
+    try {
+      switch (compression) {
+        case ZLIB_COMPRESSION:
+        case DEFLATER_COMPRESSION:
+          decompressedBytes = ZLibCompressionUtil.decompress(bytes);
+          break;
+        case GZIP_COMPRESSION:
+          decompressedBytes = GZipCompressionUtil.uncompress(new 
ByteArrayInputStream(bytes));
+          break;
+        default:
+          LOG.info("{} compression method is not supported.", compression);

Review comment:
       LOG.ERROR()?




----------------------------------------------------------------
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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to