This is an automated email from the ASF dual-hosted git repository.
mayanks pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git
The following commit(s) were added to refs/heads/master by this push:
new 7a4eaa9 Show uncompressed znRecord from zk api (#7304)
7a4eaa9 is described below
commit 7a4eaa97b6968934268e1b64decbb84e0c9438d2
Author: Xiang Fu <[email protected]>
AuthorDate: Sun Aug 15 07:53:05 2021 -0700
Show uncompressed znRecord from zk api (#7304)
---
.../pinot/controller/api/resources/ZookeeperResource.java | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git
a/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/ZookeeperResource.java
b/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/ZookeeperResource.java
index ad6661f..c7c7c68 100644
---
a/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/ZookeeperResource.java
+++
b/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/ZookeeperResource.java
@@ -25,6 +25,8 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.Map;
@@ -40,6 +42,7 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.apache.helix.ZNRecord;
import org.apache.helix.manager.zk.ZNRecordSerializer;
+import org.apache.helix.util.GZipCompressionUtil;
import org.apache.pinot.controller.api.access.AccessType;
import org.apache.pinot.controller.api.access.Authenticate;
import
org.apache.pinot.controller.api.exception.ControllerApplicationException;
@@ -76,7 +79,15 @@ public class ZookeeperResource {
ZNRecord znRecord = pinotHelixResourceManager.readZKData(path);
if (znRecord != null) {
- return new String(_znRecordSerializer.serialize(znRecord),
StandardCharsets.UTF_8);
+ byte[] serializeBytes = _znRecordSerializer.serialize(znRecord);
+ if (GZipCompressionUtil.isCompressed(serializeBytes)) {
+ try {
+ serializeBytes = GZipCompressionUtil.uncompress(new
ByteArrayInputStream(serializeBytes));
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ return new String(serializeBytes, StandardCharsets.UTF_8);
}
return null;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]