(hbase) branch branch-2.5 updated: HBASE-28652 Backport HBASE-21785 master reports open regions as RITs and also messes up rit age metric (#5980)
This is an automated email from the ASF dual-hosted git repository. apurtell pushed a commit to branch branch-2.5 in repository https://gitbox.apache.org/repos/asf/hbase.git The following commit(s) were added to refs/heads/branch-2.5 by this push: new d44a224ea63 HBASE-28652 Backport HBASE-21785 master reports open regions as RITs and also messes up rit age metric (#5980) d44a224ea63 is described below commit d44a224ea636a1d0042c1736593bcfb0d867fde8 Author: szucsvillo <81696283+szucsvi...@users.noreply.github.com> AuthorDate: Tue Jun 11 23:04:06 2024 +0200 HBASE-28652 Backport HBASE-21785 master reports open regions as RITs and also messes up rit age metric (#5980) Signed-off-by: Duo Zhang Signed-off-by: Andrew Purtell Co-authored-by: Sergey Shelukhin --- .../hadoop/hbase/master/MetricsAssignmentManagerSourceImpl.java | 4 ++-- .../apache/hadoop/hbase/master/assignment/AssignmentManager.java | 8 +++- .../apache/hadoop/hbase/master/assignment/RegionStateNode.java| 6 +- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/master/MetricsAssignmentManagerSourceImpl.java b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/master/MetricsAssignmentManagerSourceImpl.java index 5512e906b67..819445bd586 100644 --- a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/master/MetricsAssignmentManagerSourceImpl.java +++ b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/master/MetricsAssignmentManagerSourceImpl.java @@ -117,8 +117,8 @@ public class MetricsAssignmentManagerSourceImpl extends BaseSourceImpl } @Override - public void setRITOldestAge(final long ritCount) { -ritOldestAgeGauge.set(ritCount); + public void setRITOldestAge(final long ritOldestAge) { +ritOldestAgeGauge.set(ritOldestAge); } @Override diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/AssignmentManager.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/AssignmentManager.java index d4735c1ae09..74590d235eb 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/AssignmentManager.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/AssignmentManager.java @@ -1597,7 +1597,13 @@ public class AssignmentManager { private void update(final Collection regions, final long currentTime) { for (RegionState state : regions) { totalRITs++; -final long ritTime = currentTime - state.getStamp(); +final long ritStartedMs = state.getStamp(); +if (ritStartedMs == 0) { + // Don't output bogus values to metrics if they accidentally make it here. + LOG.warn("The RIT {} has no start time", state.getRegion()); + continue; +} +final long ritTime = currentTime - ritStartedMs; if (ritTime > ritThreshold) { if (ritsOverThreshold == null) { ritsOverThreshold = new HashMap(); diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/RegionStateNode.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/RegionStateNode.java index 2c61d3d427b..91c0222facd 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/RegionStateNode.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/RegionStateNode.java @@ -178,7 +178,11 @@ public class RegionStateNode implements Comparable { public long getLastUpdate() { TransitRegionStateProcedure proc = this.procedure; -return proc != null ? proc.getLastUpdate() : lastUpdate; +if (proc != null) { + long lastUpdate = proc.getLastUpdate(); + return lastUpdate != 0 ? lastUpdate : proc.getSubmittedTime(); +} +return lastUpdate; } public void setLastHost(final ServerName serverName) {
(hbase) branch branch-2.6 updated: HBASE-28652 Backport HBASE-21785 master reports open regions as RITs and also messes up rit age metric (#5979)
This is an automated email from the ASF dual-hosted git repository. apurtell pushed a commit to branch branch-2.6 in repository https://gitbox.apache.org/repos/asf/hbase.git The following commit(s) were added to refs/heads/branch-2.6 by this push: new ba15d67a350 HBASE-28652 Backport HBASE-21785 master reports open regions as RITs and also messes up rit age metric (#5979) ba15d67a350 is described below commit ba15d67a350adb11ae1d4c44d214216406ae0b5a Author: szucsvillo <81696283+szucsvi...@users.noreply.github.com> AuthorDate: Tue Jun 11 23:03:48 2024 +0200 HBASE-28652 Backport HBASE-21785 master reports open regions as RITs and also messes up rit age metric (#5979) Signed-off-by: Duo Zhang Signed-off-by: Andrew Purtell Co-authored-by: Sergey Shelukhin --- .../hadoop/hbase/master/MetricsAssignmentManagerSourceImpl.java | 4 ++-- .../apache/hadoop/hbase/master/assignment/AssignmentManager.java | 8 +++- .../apache/hadoop/hbase/master/assignment/RegionStateNode.java| 6 +- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/master/MetricsAssignmentManagerSourceImpl.java b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/master/MetricsAssignmentManagerSourceImpl.java index 5512e906b67..819445bd586 100644 --- a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/master/MetricsAssignmentManagerSourceImpl.java +++ b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/master/MetricsAssignmentManagerSourceImpl.java @@ -117,8 +117,8 @@ public class MetricsAssignmentManagerSourceImpl extends BaseSourceImpl } @Override - public void setRITOldestAge(final long ritCount) { -ritOldestAgeGauge.set(ritCount); + public void setRITOldestAge(final long ritOldestAge) { +ritOldestAgeGauge.set(ritOldestAge); } @Override diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/AssignmentManager.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/AssignmentManager.java index a46f220f6db..5e06e5a4820 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/AssignmentManager.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/AssignmentManager.java @@ -1666,7 +1666,13 @@ public class AssignmentManager { private void update(final Collection regions, final long currentTime) { for (RegionState state : regions) { totalRITs++; -final long ritTime = currentTime - state.getStamp(); +final long ritStartedMs = state.getStamp(); +if (ritStartedMs == 0) { + // Don't output bogus values to metrics if they accidentally make it here. + LOG.warn("The RIT {} has no start time", state.getRegion()); + continue; +} +final long ritTime = currentTime - ritStartedMs; if (ritTime > ritThreshold) { if (ritsOverThreshold == null) { ritsOverThreshold = new HashMap(); diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/RegionStateNode.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/RegionStateNode.java index 2c61d3d427b..91c0222facd 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/RegionStateNode.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/RegionStateNode.java @@ -178,7 +178,11 @@ public class RegionStateNode implements Comparable { public long getLastUpdate() { TransitRegionStateProcedure proc = this.procedure; -return proc != null ? proc.getLastUpdate() : lastUpdate; +if (proc != null) { + long lastUpdate = proc.getLastUpdate(); + return lastUpdate != 0 ? lastUpdate : proc.getSubmittedTime(); +} +return lastUpdate; } public void setLastHost(final ServerName serverName) {
(hbase) branch branch-2 updated: HBASE-28652 Backport HBASE-21785 master reports open regions as RITs and also messes up rit age metric (#5978)
This is an automated email from the ASF dual-hosted git repository. apurtell pushed a commit to branch branch-2 in repository https://gitbox.apache.org/repos/asf/hbase.git The following commit(s) were added to refs/heads/branch-2 by this push: new e865c852c0e HBASE-28652 Backport HBASE-21785 master reports open regions as RITs and also messes up rit age metric (#5978) e865c852c0e is described below commit e865c852c0e9a1e9b55b9d1512d379072d3e7a7b Author: szucsvillo <81696283+szucsvi...@users.noreply.github.com> AuthorDate: Tue Jun 11 23:03:33 2024 +0200 HBASE-28652 Backport HBASE-21785 master reports open regions as RITs and also messes up rit age metric (#5978) Signed-off-by: Duo Zhang Signed-off-by: Andrew Purtell Co-authored-by: Sergey Shelukhin --- .../hadoop/hbase/master/MetricsAssignmentManagerSourceImpl.java | 4 ++-- .../apache/hadoop/hbase/master/assignment/AssignmentManager.java | 8 +++- .../apache/hadoop/hbase/master/assignment/RegionStateNode.java| 6 +- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/master/MetricsAssignmentManagerSourceImpl.java b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/master/MetricsAssignmentManagerSourceImpl.java index 5512e906b67..819445bd586 100644 --- a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/master/MetricsAssignmentManagerSourceImpl.java +++ b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/master/MetricsAssignmentManagerSourceImpl.java @@ -117,8 +117,8 @@ public class MetricsAssignmentManagerSourceImpl extends BaseSourceImpl } @Override - public void setRITOldestAge(final long ritCount) { -ritOldestAgeGauge.set(ritCount); + public void setRITOldestAge(final long ritOldestAge) { +ritOldestAgeGauge.set(ritOldestAge); } @Override diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/AssignmentManager.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/AssignmentManager.java index a46f220f6db..5e06e5a4820 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/AssignmentManager.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/AssignmentManager.java @@ -1666,7 +1666,13 @@ public class AssignmentManager { private void update(final Collection regions, final long currentTime) { for (RegionState state : regions) { totalRITs++; -final long ritTime = currentTime - state.getStamp(); +final long ritStartedMs = state.getStamp(); +if (ritStartedMs == 0) { + // Don't output bogus values to metrics if they accidentally make it here. + LOG.warn("The RIT {} has no start time", state.getRegion()); + continue; +} +final long ritTime = currentTime - ritStartedMs; if (ritTime > ritThreshold) { if (ritsOverThreshold == null) { ritsOverThreshold = new HashMap(); diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/RegionStateNode.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/RegionStateNode.java index 2c61d3d427b..91c0222facd 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/RegionStateNode.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/RegionStateNode.java @@ -178,7 +178,11 @@ public class RegionStateNode implements Comparable { public long getLastUpdate() { TransitRegionStateProcedure proc = this.procedure; -return proc != null ? proc.getLastUpdate() : lastUpdate; +if (proc != null) { + long lastUpdate = proc.getLastUpdate(); + return lastUpdate != 0 ? lastUpdate : proc.getSubmittedTime(); +} +return lastUpdate; } public void setLastHost(final ServerName serverName) {
(hbase) branch branch-2.5 updated: HBASE-28049 RSProcedureDispatcher to log the request details during retries (#5973)
This is an automated email from the ASF dual-hosted git repository. vjasani pushed a commit to branch branch-2.5 in repository https://gitbox.apache.org/repos/asf/hbase.git The following commit(s) were added to refs/heads/branch-2.5 by this push: new cfdc8ea1d68 HBASE-28049 RSProcedureDispatcher to log the request details during retries (#5973) cfdc8ea1d68 is described below commit cfdc8ea1d68498e49855de37b953482ec324322f Author: KhyatiVaghamshi AuthorDate: Tue Jun 11 12:15:52 2024 -0700 HBASE-28049 RSProcedureDispatcher to log the request details during retries (#5973) Signed-off-by: Viraj Jasani Signed-off-by: Pankaj Kumar --- .../apache/hadoop/hbase/master/procedure/RSProcedureDispatcher.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/RSProcedureDispatcher.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/RSProcedureDispatcher.java index 3b7f64041f5..1241c26ba59 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/RSProcedureDispatcher.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/RSProcedureDispatcher.java @@ -319,8 +319,8 @@ public class RSProcedureDispatcher extends RemoteProcedureDispatcher
(hbase) branch branch-2.6 updated: HBASE-28049 RSProcedureDispatcher to log the request details during retries (#5973)
This is an automated email from the ASF dual-hosted git repository. vjasani pushed a commit to branch branch-2.6 in repository https://gitbox.apache.org/repos/asf/hbase.git The following commit(s) were added to refs/heads/branch-2.6 by this push: new ae477aced35 HBASE-28049 RSProcedureDispatcher to log the request details during retries (#5973) ae477aced35 is described below commit ae477aced35d1a380ec6abbcc55963215443cc29 Author: KhyatiVaghamshi AuthorDate: Tue Jun 11 12:15:52 2024 -0700 HBASE-28049 RSProcedureDispatcher to log the request details during retries (#5973) Signed-off-by: Viraj Jasani Signed-off-by: Pankaj Kumar --- .../apache/hadoop/hbase/master/procedure/RSProcedureDispatcher.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/RSProcedureDispatcher.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/RSProcedureDispatcher.java index 96d0c78c827..acabc153978 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/RSProcedureDispatcher.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/RSProcedureDispatcher.java @@ -319,8 +319,8 @@ public class RSProcedureDispatcher extends RemoteProcedureDispatcher
(hbase) branch branch-2 updated: HBASE-28049 RSProcedureDispatcher to log the request details during retries (#5973)
This is an automated email from the ASF dual-hosted git repository. vjasani pushed a commit to branch branch-2 in repository https://gitbox.apache.org/repos/asf/hbase.git The following commit(s) were added to refs/heads/branch-2 by this push: new 5bcd60cce18 HBASE-28049 RSProcedureDispatcher to log the request details during retries (#5973) 5bcd60cce18 is described below commit 5bcd60cce1800b1d431fb00d672e9736d15b6181 Author: KhyatiVaghamshi AuthorDate: Tue Jun 11 12:15:52 2024 -0700 HBASE-28049 RSProcedureDispatcher to log the request details during retries (#5973) Signed-off-by: Viraj Jasani Signed-off-by: Pankaj Kumar --- .../apache/hadoop/hbase/master/procedure/RSProcedureDispatcher.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/RSProcedureDispatcher.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/RSProcedureDispatcher.java index 96d0c78c827..acabc153978 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/RSProcedureDispatcher.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/RSProcedureDispatcher.java @@ -319,8 +319,8 @@ public class RSProcedureDispatcher extends RemoteProcedureDispatcher
(hbase) branch branch-3 updated: HBASE-28049 RSProcedureDispatcher to log the request details during retries (#5973)
This is an automated email from the ASF dual-hosted git repository. vjasani pushed a commit to branch branch-3 in repository https://gitbox.apache.org/repos/asf/hbase.git The following commit(s) were added to refs/heads/branch-3 by this push: new 48cf2f761d8 HBASE-28049 RSProcedureDispatcher to log the request details during retries (#5973) 48cf2f761d8 is described below commit 48cf2f761d8d83c7c5532badb1fbd8d92b1e69e5 Author: KhyatiVaghamshi AuthorDate: Tue Jun 11 12:15:52 2024 -0700 HBASE-28049 RSProcedureDispatcher to log the request details during retries (#5973) Signed-off-by: Viraj Jasani Signed-off-by: Pankaj Kumar --- .../apache/hadoop/hbase/master/procedure/RSProcedureDispatcher.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/RSProcedureDispatcher.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/RSProcedureDispatcher.java index abc9c575a62..dfd8c9587b2 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/RSProcedureDispatcher.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/RSProcedureDispatcher.java @@ -314,8 +314,8 @@ public class RSProcedureDispatcher extends RemoteProcedureDispatcher
(hbase) branch master updated: HBASE-28049 RSProcedureDispatcher to log the request details during retries (#5973)
This is an automated email from the ASF dual-hosted git repository. vjasani pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/hbase.git The following commit(s) were added to refs/heads/master by this push: new 317ad3c2918 HBASE-28049 RSProcedureDispatcher to log the request details during retries (#5973) 317ad3c2918 is described below commit 317ad3c2918c69f119fb5839292decd73c3dba7c Author: KhyatiVaghamshi AuthorDate: Tue Jun 11 12:15:52 2024 -0700 HBASE-28049 RSProcedureDispatcher to log the request details during retries (#5973) Signed-off-by: Viraj Jasani Signed-off-by: Pankaj Kumar --- .../apache/hadoop/hbase/master/procedure/RSProcedureDispatcher.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/RSProcedureDispatcher.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/RSProcedureDispatcher.java index abc9c575a62..dfd8c9587b2 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/RSProcedureDispatcher.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/RSProcedureDispatcher.java @@ -314,8 +314,8 @@ public class RSProcedureDispatcher extends RemoteProcedureDispatcher
(hbase) branch branch-2.5 updated: HBASE-28646 Use Streams to unmarshall protobuf REST data (#5974)
This is an automated email from the ASF dual-hosted git repository. stoty pushed a commit to branch branch-2.5 in repository https://gitbox.apache.org/repos/asf/hbase.git The following commit(s) were added to refs/heads/branch-2.5 by this push: new c8d4db1698e HBASE-28646 Use Streams to unmarshall protobuf REST data (#5974) c8d4db1698e is described below commit c8d4db1698e3824a97ebd2b8aff57ec65226c76a Author: Istvan Toth AuthorDate: Tue Jun 11 20:00:44 2024 +0200 HBASE-28646 Use Streams to unmarshall protobuf REST data (#5974) Signed-off-by: Duo Zhang (cherry picked from commit 91b351264dec4ecf08103577c6bfa51da1197c39) --- .../hadoop/hbase/rest/ProtobufMessageHandler.java | 33 -- .../org/apache/hadoop/hbase/rest/RestUtil.java | 15 +- .../apache/hadoop/hbase/rest/model/CellModel.java | 5 ++-- .../hadoop/hbase/rest/model/CellSetModel.java | 5 ++-- .../hbase/rest/model/NamespacesInstanceModel.java | 6 ++-- .../hadoop/hbase/rest/model/NamespacesModel.java | 6 ++-- .../apache/hadoop/hbase/rest/model/RowModel.java | 3 +- .../hadoop/hbase/rest/model/ScannerModel.java | 5 ++-- .../rest/model/StorageClusterStatusModel.java | 5 ++-- .../hadoop/hbase/rest/model/TableInfoModel.java| 5 ++-- .../hadoop/hbase/rest/model/TableListModel.java| 5 ++-- .../hadoop/hbase/rest/model/TableSchemaModel.java | 5 ++-- .../hadoop/hbase/rest/model/VersionModel.java | 5 ++-- .../consumer/ProtobufMessageBodyConsumer.java | 16 +-- 14 files changed, 66 insertions(+), 53 deletions(-) diff --git a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/ProtobufMessageHandler.java b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/ProtobufMessageHandler.java index e3f58a23ce2..8aaacd7101b 100644 --- a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/ProtobufMessageHandler.java +++ b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/ProtobufMessageHandler.java @@ -17,9 +17,11 @@ */ package org.apache.hadoop.hbase.rest; +import com.google.protobuf.CodedInputStream; import com.google.protobuf.CodedOutputStream; import com.google.protobuf.Message; import java.io.IOException; +import java.io.InputStream; import java.io.OutputStream; import org.apache.yetus.audience.InterfaceAudience; @@ -46,7 +48,7 @@ public interface ProtobufMessageHandler { } /** - * Returns the protobuf represention of the model in a byte array Use + * Returns the protobuf represention of the model in a byte array. Use * {@link org.apache.hadoop.hbase.rest.ProtobufMessageHandler#writeProtobufOutput(OutputStream)} * for better performance * @return the protobuf encoded object in a byte array @@ -62,15 +64,28 @@ public interface ProtobufMessageHandler { Message messageFromObject(); /** - * Initialize the model from a protobuf representation. + * Initialize the model from a protobuf representation. Use + * {@link org.apache.hadoop.hbase.rest.ProtobufMessageHandler#getObjectFromMessage(InputStream)} + * for better performance * @param message the raw bytes of the protobuf message * @return reference to self for convenience */ - // TODO implement proper stream handling for unmarshalling. - // Using byte array here lets us use ProtobufUtil.mergeFrom in the implementations to - // avoid the CodedOutputStream size limitation, but is slow - // and memory intensive. We could use the ProtobufUtil.mergeFrom() variant that takes - // an inputStream and sets the size limit to maxInt. - // This would help both on the client side, and when processing large Puts on the server. - ProtobufMessageHandler getObjectFromMessage(byte[] message) throws IOException; + default ProtobufMessageHandler getObjectFromMessage(byte[] message) throws IOException { +final CodedInputStream codedInput = CodedInputStream.newInstance(message); +codedInput.setSizeLimit(message.length); +return getObjectFromMessage(codedInput); + } + + /** + * Initialize the model from a protobuf representation. + * @param is InputStream providing the protobuf message + * @return reference to self for convenience + */ + default ProtobufMessageHandler getObjectFromMessage(InputStream is) throws IOException { +final CodedInputStream codedInput = CodedInputStream.newInstance(is); +codedInput.setSizeLimit(Integer.MAX_VALUE); +return getObjectFromMessage(codedInput); + } + + ProtobufMessageHandler getObjectFromMessage(CodedInputStream cis) throws IOException; } diff --git a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/RestUtil.java b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/RestUtil.java index 13b4d35098e..5c7217f6e54 100644 --- a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/RestUtil.java +++ b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/RestUtil.java @@ -50,15 +50,14 @@ public final class RestUtil { } /** - * Copied fr
(hbase) branch branch-2.5 updated: HBASE-28526 hbase-rest client shading conflict with hbase-shaded-client in HBase 2.x (#5959)
This is an automated email from the ASF dual-hosted git repository. stoty pushed a commit to branch branch-2.5 in repository https://gitbox.apache.org/repos/asf/hbase.git The following commit(s) were added to refs/heads/branch-2.5 by this push: new a4e7c7c0e3c HBASE-28526 hbase-rest client shading conflict with hbase-shaded-client in HBase 2.x (#5959) a4e7c7c0e3c is described below commit a4e7c7c0e3ce1265a9f092e13685072b8708dc09 Author: Istvan Toth AuthorDate: Wed Jun 5 06:56:03 2024 +0200 HBASE-28526 hbase-rest client shading conflict with hbase-shaded-client in HBase 2.x (#5959) Signed-off-by: Ankit Singhal (cherry picked from commit 57ead2814347508c3cdce8c958380fed1108dca4) --- .../java/org/apache/hadoop/hbase/rest/RestUtil.java | 17 + .../org/apache/hadoop/hbase/rest/model/CellModel.java | 4 ++-- .../apache/hadoop/hbase/rest/model/CellSetModel.java| 4 ++-- .../apache/hadoop/hbase/rest/model/ScannerModel.java| 4 ++-- .../hbase/rest/model/StorageClusterStatusModel.java | 4 ++-- .../apache/hadoop/hbase/rest/model/TableInfoModel.java | 4 ++-- .../apache/hadoop/hbase/rest/model/TableListModel.java | 4 ++-- .../hadoop/hbase/rest/model/TableSchemaModel.java | 4 ++-- .../apache/hadoop/hbase/rest/model/VersionModel.java| 4 ++-- 9 files changed, 33 insertions(+), 16 deletions(-) diff --git a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/RestUtil.java b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/RestUtil.java index 5f884c510d6..13b4d35098e 100644 --- a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/RestUtil.java +++ b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/RestUtil.java @@ -17,6 +17,9 @@ */ package org.apache.hadoop.hbase.rest; +import com.google.protobuf.CodedInputStream; +import com.google.protobuf.Message; +import java.io.IOException; import org.apache.hadoop.hbase.Cell; import org.apache.hadoop.hbase.client.Result; import org.apache.hadoop.hbase.rest.model.CellModel; @@ -45,4 +48,18 @@ public final class RestUtil { } return rowModel; } + + /** + * Copied from org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil to avoid shading conflicts + * between hbase-shaded-client and hbase-rest in HBase 2.x. This version of protobuf's mergeFrom + * avoids the hard-coded 64MB limit for decoding buffers when working with byte arrays + * @param builder current message builder + * @param b byte array + */ + public static void mergeFrom(Message.Builder builder, byte[] b) throws IOException { +final CodedInputStream codedInput = CodedInputStream.newInstance(b); +codedInput.setSizeLimit(b.length); +builder.mergeFrom(codedInput); +codedInput.checkLastTagWas(0); + } } diff --git a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/model/CellModel.java b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/model/CellModel.java index 7eb35f3f507..606ff0357e5 100644 --- a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/model/CellModel.java +++ b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/model/CellModel.java @@ -34,8 +34,8 @@ import org.apache.commons.lang3.builder.HashCodeBuilder; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.hadoop.hbase.CellUtil; import org.apache.hadoop.hbase.HConstants; -import org.apache.hadoop.hbase.protobuf.ProtobufUtil; import org.apache.hadoop.hbase.rest.ProtobufMessageHandler; +import org.apache.hadoop.hbase.rest.RestUtil; import org.apache.hadoop.hbase.rest.protobuf.generated.CellMessage.Cell; import org.apache.hadoop.hbase.util.ByteStringer; import org.apache.yetus.audience.InterfaceAudience; @@ -218,7 +218,7 @@ public class CellModel implements ProtobufMessageHandler, Serializable { @Override public ProtobufMessageHandler getObjectFromMessage(byte[] message) throws IOException { Cell.Builder builder = Cell.newBuilder(); -ProtobufUtil.mergeFrom(builder, message); +RestUtil.mergeFrom(builder, message); setColumn(builder.getColumn().toByteArray()); setValue(builder.getData().toByteArray()); if (builder.hasTimestamp()) { diff --git a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/model/CellSetModel.java b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/model/CellSetModel.java index c161bbcfe18..fedfe1de26c 100644 --- a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/model/CellSetModel.java +++ b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/model/CellSetModel.java @@ -29,8 +29,8 @@ import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import org.apache.hadoop.hbase.HConstants; -import org.apache.hadoop.hbase.protobuf.ProtobufUtil; import org.apache.hadoop.hbase.rest.ProtobufMessageHandler; +import org.apache.hadoop.hbase.rest.RestUtil; import org.apache.hadoop.hbase.rest.protobuf.generated.
(hbase) branch branch-2.6 updated: HBASE-28646 Use Streams to unmarshall protobuf REST data (#5974)
This is an automated email from the ASF dual-hosted git repository. stoty pushed a commit to branch branch-2.6 in repository https://gitbox.apache.org/repos/asf/hbase.git The following commit(s) were added to refs/heads/branch-2.6 by this push: new c683576aca9 HBASE-28646 Use Streams to unmarshall protobuf REST data (#5974) c683576aca9 is described below commit c683576aca986764a34a370ca58c5f7a314f6335 Author: Istvan Toth AuthorDate: Tue Jun 11 20:00:44 2024 +0200 HBASE-28646 Use Streams to unmarshall protobuf REST data (#5974) Signed-off-by: Duo Zhang (cherry picked from commit 91b351264dec4ecf08103577c6bfa51da1197c39) --- .../hadoop/hbase/rest/ProtobufMessageHandler.java | 33 -- .../org/apache/hadoop/hbase/rest/RestUtil.java | 15 +- .../apache/hadoop/hbase/rest/model/CellModel.java | 5 ++-- .../hadoop/hbase/rest/model/CellSetModel.java | 5 ++-- .../hbase/rest/model/NamespacesInstanceModel.java | 6 ++-- .../hadoop/hbase/rest/model/NamespacesModel.java | 6 ++-- .../apache/hadoop/hbase/rest/model/RowModel.java | 3 +- .../hadoop/hbase/rest/model/ScannerModel.java | 5 ++-- .../rest/model/StorageClusterStatusModel.java | 5 ++-- .../hadoop/hbase/rest/model/TableInfoModel.java| 5 ++-- .../hadoop/hbase/rest/model/TableListModel.java| 5 ++-- .../hadoop/hbase/rest/model/TableSchemaModel.java | 5 ++-- .../hadoop/hbase/rest/model/VersionModel.java | 5 ++-- .../consumer/ProtobufMessageBodyConsumer.java | 16 +-- 14 files changed, 66 insertions(+), 53 deletions(-) diff --git a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/ProtobufMessageHandler.java b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/ProtobufMessageHandler.java index e3f58a23ce2..8aaacd7101b 100644 --- a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/ProtobufMessageHandler.java +++ b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/ProtobufMessageHandler.java @@ -17,9 +17,11 @@ */ package org.apache.hadoop.hbase.rest; +import com.google.protobuf.CodedInputStream; import com.google.protobuf.CodedOutputStream; import com.google.protobuf.Message; import java.io.IOException; +import java.io.InputStream; import java.io.OutputStream; import org.apache.yetus.audience.InterfaceAudience; @@ -46,7 +48,7 @@ public interface ProtobufMessageHandler { } /** - * Returns the protobuf represention of the model in a byte array Use + * Returns the protobuf represention of the model in a byte array. Use * {@link org.apache.hadoop.hbase.rest.ProtobufMessageHandler#writeProtobufOutput(OutputStream)} * for better performance * @return the protobuf encoded object in a byte array @@ -62,15 +64,28 @@ public interface ProtobufMessageHandler { Message messageFromObject(); /** - * Initialize the model from a protobuf representation. + * Initialize the model from a protobuf representation. Use + * {@link org.apache.hadoop.hbase.rest.ProtobufMessageHandler#getObjectFromMessage(InputStream)} + * for better performance * @param message the raw bytes of the protobuf message * @return reference to self for convenience */ - // TODO implement proper stream handling for unmarshalling. - // Using byte array here lets us use ProtobufUtil.mergeFrom in the implementations to - // avoid the CodedOutputStream size limitation, but is slow - // and memory intensive. We could use the ProtobufUtil.mergeFrom() variant that takes - // an inputStream and sets the size limit to maxInt. - // This would help both on the client side, and when processing large Puts on the server. - ProtobufMessageHandler getObjectFromMessage(byte[] message) throws IOException; + default ProtobufMessageHandler getObjectFromMessage(byte[] message) throws IOException { +final CodedInputStream codedInput = CodedInputStream.newInstance(message); +codedInput.setSizeLimit(message.length); +return getObjectFromMessage(codedInput); + } + + /** + * Initialize the model from a protobuf representation. + * @param is InputStream providing the protobuf message + * @return reference to self for convenience + */ + default ProtobufMessageHandler getObjectFromMessage(InputStream is) throws IOException { +final CodedInputStream codedInput = CodedInputStream.newInstance(is); +codedInput.setSizeLimit(Integer.MAX_VALUE); +return getObjectFromMessage(codedInput); + } + + ProtobufMessageHandler getObjectFromMessage(CodedInputStream cis) throws IOException; } diff --git a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/RestUtil.java b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/RestUtil.java index 13b4d35098e..5c7217f6e54 100644 --- a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/RestUtil.java +++ b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/RestUtil.java @@ -50,15 +50,14 @@ public final class RestUtil { } /** - * Copied fr
(hbase) branch branch-2 updated: HBASE-28646 Use Streams to unmarshall protobuf REST data (#5974)
This is an automated email from the ASF dual-hosted git repository. stoty pushed a commit to branch branch-2 in repository https://gitbox.apache.org/repos/asf/hbase.git The following commit(s) were added to refs/heads/branch-2 by this push: new 0729862d0b7 HBASE-28646 Use Streams to unmarshall protobuf REST data (#5974) 0729862d0b7 is described below commit 0729862d0b73be5881924ec2e7f3f65abd265066 Author: Istvan Toth AuthorDate: Tue Jun 11 20:00:44 2024 +0200 HBASE-28646 Use Streams to unmarshall protobuf REST data (#5974) Signed-off-by: Duo Zhang (cherry picked from commit 91b351264dec4ecf08103577c6bfa51da1197c39) --- .../hadoop/hbase/rest/ProtobufMessageHandler.java | 33 -- .../org/apache/hadoop/hbase/rest/RestUtil.java | 15 +- .../apache/hadoop/hbase/rest/model/CellModel.java | 5 ++-- .../hadoop/hbase/rest/model/CellSetModel.java | 5 ++-- .../hbase/rest/model/NamespacesInstanceModel.java | 6 ++-- .../hadoop/hbase/rest/model/NamespacesModel.java | 6 ++-- .../apache/hadoop/hbase/rest/model/RowModel.java | 3 +- .../hadoop/hbase/rest/model/ScannerModel.java | 5 ++-- .../rest/model/StorageClusterStatusModel.java | 5 ++-- .../hadoop/hbase/rest/model/TableInfoModel.java| 5 ++-- .../hadoop/hbase/rest/model/TableListModel.java| 5 ++-- .../hadoop/hbase/rest/model/TableSchemaModel.java | 5 ++-- .../hadoop/hbase/rest/model/VersionModel.java | 5 ++-- .../consumer/ProtobufMessageBodyConsumer.java | 16 +-- 14 files changed, 66 insertions(+), 53 deletions(-) diff --git a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/ProtobufMessageHandler.java b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/ProtobufMessageHandler.java index e3f58a23ce2..8aaacd7101b 100644 --- a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/ProtobufMessageHandler.java +++ b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/ProtobufMessageHandler.java @@ -17,9 +17,11 @@ */ package org.apache.hadoop.hbase.rest; +import com.google.protobuf.CodedInputStream; import com.google.protobuf.CodedOutputStream; import com.google.protobuf.Message; import java.io.IOException; +import java.io.InputStream; import java.io.OutputStream; import org.apache.yetus.audience.InterfaceAudience; @@ -46,7 +48,7 @@ public interface ProtobufMessageHandler { } /** - * Returns the protobuf represention of the model in a byte array Use + * Returns the protobuf represention of the model in a byte array. Use * {@link org.apache.hadoop.hbase.rest.ProtobufMessageHandler#writeProtobufOutput(OutputStream)} * for better performance * @return the protobuf encoded object in a byte array @@ -62,15 +64,28 @@ public interface ProtobufMessageHandler { Message messageFromObject(); /** - * Initialize the model from a protobuf representation. + * Initialize the model from a protobuf representation. Use + * {@link org.apache.hadoop.hbase.rest.ProtobufMessageHandler#getObjectFromMessage(InputStream)} + * for better performance * @param message the raw bytes of the protobuf message * @return reference to self for convenience */ - // TODO implement proper stream handling for unmarshalling. - // Using byte array here lets us use ProtobufUtil.mergeFrom in the implementations to - // avoid the CodedOutputStream size limitation, but is slow - // and memory intensive. We could use the ProtobufUtil.mergeFrom() variant that takes - // an inputStream and sets the size limit to maxInt. - // This would help both on the client side, and when processing large Puts on the server. - ProtobufMessageHandler getObjectFromMessage(byte[] message) throws IOException; + default ProtobufMessageHandler getObjectFromMessage(byte[] message) throws IOException { +final CodedInputStream codedInput = CodedInputStream.newInstance(message); +codedInput.setSizeLimit(message.length); +return getObjectFromMessage(codedInput); + } + + /** + * Initialize the model from a protobuf representation. + * @param is InputStream providing the protobuf message + * @return reference to self for convenience + */ + default ProtobufMessageHandler getObjectFromMessage(InputStream is) throws IOException { +final CodedInputStream codedInput = CodedInputStream.newInstance(is); +codedInput.setSizeLimit(Integer.MAX_VALUE); +return getObjectFromMessage(codedInput); + } + + ProtobufMessageHandler getObjectFromMessage(CodedInputStream cis) throws IOException; } diff --git a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/RestUtil.java b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/RestUtil.java index 13b4d35098e..5c7217f6e54 100644 --- a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/RestUtil.java +++ b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/RestUtil.java @@ -50,15 +50,14 @@ public final class RestUtil { } /** - * Copied from o
(hbase) branch branch-3 updated: HBASE-28646 Use Streams to unmarshall protobuf REST data (#5974)
This is an automated email from the ASF dual-hosted git repository. stoty pushed a commit to branch branch-3 in repository https://gitbox.apache.org/repos/asf/hbase.git The following commit(s) were added to refs/heads/branch-3 by this push: new 7f60bd4b2c0 HBASE-28646 Use Streams to unmarshall protobuf REST data (#5974) 7f60bd4b2c0 is described below commit 7f60bd4b2c05cabf96178c500a70f647ec7f8a2a Author: Istvan Toth AuthorDate: Tue Jun 11 20:00:44 2024 +0200 HBASE-28646 Use Streams to unmarshall protobuf REST data (#5974) Signed-off-by: Duo Zhang (cherry picked from commit 91b351264dec4ecf08103577c6bfa51da1197c39) --- .../hadoop/hbase/rest/ProtobufMessageHandler.java | 33 -- .../org/apache/hadoop/hbase/rest/RestUtil.java | 17 +++ .../apache/hadoop/hbase/rest/model/CellModel.java | 7 +++-- .../hadoop/hbase/rest/model/CellSetModel.java | 7 +++-- .../hbase/rest/model/NamespacesInstanceModel.java | 6 ++-- .../hadoop/hbase/rest/model/NamespacesModel.java | 6 ++-- .../apache/hadoop/hbase/rest/model/RowModel.java | 3 +- .../hadoop/hbase/rest/model/ScannerModel.java | 7 +++-- .../rest/model/StorageClusterStatusModel.java | 7 +++-- .../hadoop/hbase/rest/model/TableInfoModel.java| 7 +++-- .../hadoop/hbase/rest/model/TableListModel.java| 7 +++-- .../hadoop/hbase/rest/model/TableSchemaModel.java | 7 +++-- .../hadoop/hbase/rest/model/VersionModel.java | 7 +++-- .../consumer/ProtobufMessageBodyConsumer.java | 16 +-- 14 files changed, 84 insertions(+), 53 deletions(-) diff --git a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/ProtobufMessageHandler.java b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/ProtobufMessageHandler.java index 962e5dfae86..1b84dc7c93d 100644 --- a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/ProtobufMessageHandler.java +++ b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/ProtobufMessageHandler.java @@ -18,9 +18,11 @@ package org.apache.hadoop.hbase.rest; import java.io.IOException; +import java.io.InputStream; import java.io.OutputStream; import org.apache.yetus.audience.InterfaceAudience; +import org.apache.hbase.thirdparty.com.google.protobuf.CodedInputStream; import org.apache.hbase.thirdparty.com.google.protobuf.CodedOutputStream; import org.apache.hbase.thirdparty.com.google.protobuf.Message; @@ -47,7 +49,7 @@ public interface ProtobufMessageHandler { } /** - * Returns the protobuf represention of the model in a byte array Use + * Returns the protobuf represention of the model in a byte array. Use * {@link org.apache.hadoop.hbase.rest.ProtobufMessageHandler#writeProtobufOutput(OutputStream)} * for better performance * @return the protobuf encoded object in a byte array @@ -63,15 +65,28 @@ public interface ProtobufMessageHandler { Message messageFromObject(); /** - * Initialize the model from a protobuf representation. + * Initialize the model from a protobuf representation. Use + * {@link org.apache.hadoop.hbase.rest.ProtobufMessageHandler#getObjectFromMessage(InputStream)} + * for better performance * @param message the raw bytes of the protobuf message * @return reference to self for convenience */ - // TODO implement proper stream handling for unmarshalling. - // Using byte array here lets us use ProtobufUtil.mergeFrom in the implementations to - // avoid the CodedOutputStream size limitation, but is slow - // and memory intensive. We could use the ProtobufUtil.mergeFrom() variant that takes - // an inputStream and sets the size limit to maxInt. - // This would help both on the client side, and when processing large Puts on the server. - ProtobufMessageHandler getObjectFromMessage(byte[] message) throws IOException; + default ProtobufMessageHandler getObjectFromMessage(byte[] message) throws IOException { +final CodedInputStream codedInput = CodedInputStream.newInstance(message); +codedInput.setSizeLimit(message.length); +return getObjectFromMessage(codedInput); + } + + /** + * Initialize the model from a protobuf representation. + * @param is InputStream providing the protobuf message + * @return reference to self for convenience + */ + default ProtobufMessageHandler getObjectFromMessage(InputStream is) throws IOException { +final CodedInputStream codedInput = CodedInputStream.newInstance(is); +codedInput.setSizeLimit(Integer.MAX_VALUE); +return getObjectFromMessage(codedInput); + } + + ProtobufMessageHandler getObjectFromMessage(CodedInputStream cis) throws IOException; } diff --git a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/RestUtil.java b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/RestUtil.java index 5f884c510d6..ffd5fb208d7 100644 --- a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/RestUtil.java +++ b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/RestUti
(hbase) branch master updated: HBASE-28646 Use Streams to unmarshall protobuf REST data (#5974)
This is an automated email from the ASF dual-hosted git repository. stoty pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/hbase.git The following commit(s) were added to refs/heads/master by this push: new 91b351264de HBASE-28646 Use Streams to unmarshall protobuf REST data (#5974) 91b351264de is described below commit 91b351264dec4ecf08103577c6bfa51da1197c39 Author: Istvan Toth AuthorDate: Tue Jun 11 20:00:44 2024 +0200 HBASE-28646 Use Streams to unmarshall protobuf REST data (#5974) Signed-off-by: Duo Zhang --- .../hadoop/hbase/rest/ProtobufMessageHandler.java | 33 -- .../org/apache/hadoop/hbase/rest/RestUtil.java | 17 +++ .../apache/hadoop/hbase/rest/model/CellModel.java | 7 +++-- .../hadoop/hbase/rest/model/CellSetModel.java | 7 +++-- .../hbase/rest/model/NamespacesInstanceModel.java | 6 ++-- .../hadoop/hbase/rest/model/NamespacesModel.java | 6 ++-- .../apache/hadoop/hbase/rest/model/RowModel.java | 3 +- .../hadoop/hbase/rest/model/ScannerModel.java | 7 +++-- .../rest/model/StorageClusterStatusModel.java | 7 +++-- .../hadoop/hbase/rest/model/TableInfoModel.java| 7 +++-- .../hadoop/hbase/rest/model/TableListModel.java| 7 +++-- .../hadoop/hbase/rest/model/TableSchemaModel.java | 7 +++-- .../hadoop/hbase/rest/model/VersionModel.java | 7 +++-- .../consumer/ProtobufMessageBodyConsumer.java | 16 +-- 14 files changed, 84 insertions(+), 53 deletions(-) diff --git a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/ProtobufMessageHandler.java b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/ProtobufMessageHandler.java index 962e5dfae86..1b84dc7c93d 100644 --- a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/ProtobufMessageHandler.java +++ b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/ProtobufMessageHandler.java @@ -18,9 +18,11 @@ package org.apache.hadoop.hbase.rest; import java.io.IOException; +import java.io.InputStream; import java.io.OutputStream; import org.apache.yetus.audience.InterfaceAudience; +import org.apache.hbase.thirdparty.com.google.protobuf.CodedInputStream; import org.apache.hbase.thirdparty.com.google.protobuf.CodedOutputStream; import org.apache.hbase.thirdparty.com.google.protobuf.Message; @@ -47,7 +49,7 @@ public interface ProtobufMessageHandler { } /** - * Returns the protobuf represention of the model in a byte array Use + * Returns the protobuf represention of the model in a byte array. Use * {@link org.apache.hadoop.hbase.rest.ProtobufMessageHandler#writeProtobufOutput(OutputStream)} * for better performance * @return the protobuf encoded object in a byte array @@ -63,15 +65,28 @@ public interface ProtobufMessageHandler { Message messageFromObject(); /** - * Initialize the model from a protobuf representation. + * Initialize the model from a protobuf representation. Use + * {@link org.apache.hadoop.hbase.rest.ProtobufMessageHandler#getObjectFromMessage(InputStream)} + * for better performance * @param message the raw bytes of the protobuf message * @return reference to self for convenience */ - // TODO implement proper stream handling for unmarshalling. - // Using byte array here lets us use ProtobufUtil.mergeFrom in the implementations to - // avoid the CodedOutputStream size limitation, but is slow - // and memory intensive. We could use the ProtobufUtil.mergeFrom() variant that takes - // an inputStream and sets the size limit to maxInt. - // This would help both on the client side, and when processing large Puts on the server. - ProtobufMessageHandler getObjectFromMessage(byte[] message) throws IOException; + default ProtobufMessageHandler getObjectFromMessage(byte[] message) throws IOException { +final CodedInputStream codedInput = CodedInputStream.newInstance(message); +codedInput.setSizeLimit(message.length); +return getObjectFromMessage(codedInput); + } + + /** + * Initialize the model from a protobuf representation. + * @param is InputStream providing the protobuf message + * @return reference to self for convenience + */ + default ProtobufMessageHandler getObjectFromMessage(InputStream is) throws IOException { +final CodedInputStream codedInput = CodedInputStream.newInstance(is); +codedInput.setSizeLimit(Integer.MAX_VALUE); +return getObjectFromMessage(codedInput); + } + + ProtobufMessageHandler getObjectFromMessage(CodedInputStream cis) throws IOException; } diff --git a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/RestUtil.java b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/RestUtil.java index 5f884c510d6..ffd5fb208d7 100644 --- a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/RestUtil.java +++ b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/RestUtil.java @@ -17,12 +17,16 @@ */ package org.apache.hadoop.hbase.rest; +imp
(hbase-site) branch asf-site updated: INFRA-10751 Empty commit
This is an automated email from the ASF dual-hosted git repository. git-site-role pushed a commit to branch asf-site in repository https://gitbox.apache.org/repos/asf/hbase-site.git The following commit(s) were added to refs/heads/asf-site by this push: new 87f0b92c52e INFRA-10751 Empty commit 87f0b92c52e is described below commit 87f0b92c52e8c033104360df7eeb37efee784774 Author: jenkins AuthorDate: Tue Jun 11 14:44:16 2024 + INFRA-10751 Empty commit
(hbase) branch branch-3 updated: HBASE-28651 Reformat the javadoc for CellChunkMap (#5977)
This is an automated email from the ASF dual-hosted git repository. zhangduo pushed a commit to branch branch-3 in repository https://gitbox.apache.org/repos/asf/hbase.git The following commit(s) were added to refs/heads/branch-3 by this push: new cb6cdbd3ce6 HBASE-28651 Reformat the javadoc for CellChunkMap (#5977) cb6cdbd3ce6 is described below commit cb6cdbd3ce6058ac963f230393a925297b305dba Author: Duo Zhang AuthorDate: Tue Jun 11 22:03:35 2024 +0800 HBASE-28651 Reformat the javadoc for CellChunkMap (#5977) Signed-off-by: Yi Mei (cherry picked from commit 580361820f6d678ef8044dc2b1a8b00b1b30c5ee) --- .../hadoop/hbase/regionserver/CellChunkMap.java| 32 ++ 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CellChunkMap.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CellChunkMap.java index 8a5f28c2870..e4bfcf05ab2 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CellChunkMap.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CellChunkMap.java @@ -27,18 +27,28 @@ import org.apache.yetus.audience.InterfaceAudience; /** * CellChunkMap is an array of serialized representations of Cell (pointing to Chunks with full Cell - * data) and can be allocated both off-heap and on-heap. CellChunkMap is a byte array (chunk) - * holding all that is needed to access a Cell, which is actually saved on another deeper chunk. Per - * Cell we have a reference to this deeper byte array B (chunk ID, integer), offset in bytes in B - * (integer), length in bytes in B (integer) and seqID of the cell (long). In order to save - * reference to byte array we use the Chunk's ID given by ChunkCreator. The CellChunkMap memory - * layout on chunk A relevant to a deeper byte array B, holding the actual cell data: < header > - * <--- first Cell -> <-- second Cell ... + * data) and can be allocated both off-heap and on-heap. + * + * CellChunkMap is a byte array (chunk) holding all that is needed to access a Cell, which is + * actually saved on another deeper chunk. Per Cell we have a reference to this deeper byte array B + * (chunk ID, integer), offset in bytes in B (integer), length in bytes in B (integer) and seqID of + * the cell (long). In order to save reference to byte array we use the Chunk's ID given by + * ChunkCreator. + * + * The CellChunkMap memory layout on chunk A relevant to a deeper byte array B, holding the actual + * cell data: + * + * + * + * < header > <--- first Cell -> <-- second Cell ... * --- ... - * integer | integer | integer | integer | long | 4 bytes | 4 bytes | 4 bytes | 4 bytes | 8 bytes | - * ChunkID | chunkID of | offset in B | length of | sequence | ... of this | chunk B with | where - * Cell's | Cell's | ID of | chunk A | Cell data | data starts | data in B | the Cell | + * integer | integer | integer | integer | long | + * 4 bytes | 4 bytes | 4 bytes | 4 bytes | 8 bytes | + * ChunkID | chunkID of | offset in B | length of | sequence | ... + * of this | chunk B with | where Cell's | Cell's | ID of| + * chunk A | Cell data| data starts | data in B | the Cell | * --- ... + * */ @InterfaceAudience.Private public class CellChunkMap extends CellFlatMap { @@ -71,7 +81,7 @@ public class CellChunkMap extends CellFlatMap { } } - /* + /** * To be used by base (CellFlatMap) class only to create a sub-CellFlatMap Should be used only to * create only CellChunkMap from CellChunkMap */
(hbase) branch branch-2 updated: HBASE-28651 Reformat the javadoc for CellChunkMap (#5977)
This is an automated email from the ASF dual-hosted git repository. zhangduo pushed a commit to branch branch-2 in repository https://gitbox.apache.org/repos/asf/hbase.git The following commit(s) were added to refs/heads/branch-2 by this push: new c81601f33e2 HBASE-28651 Reformat the javadoc for CellChunkMap (#5977) c81601f33e2 is described below commit c81601f33e25c00a7d24aaf402dd17e6f70cdaf9 Author: Duo Zhang AuthorDate: Tue Jun 11 22:03:35 2024 +0800 HBASE-28651 Reformat the javadoc for CellChunkMap (#5977) Signed-off-by: Yi Mei (cherry picked from commit 580361820f6d678ef8044dc2b1a8b00b1b30c5ee) --- .../hadoop/hbase/regionserver/CellChunkMap.java| 32 ++ 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CellChunkMap.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CellChunkMap.java index 8a5f28c2870..e4bfcf05ab2 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CellChunkMap.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CellChunkMap.java @@ -27,18 +27,28 @@ import org.apache.yetus.audience.InterfaceAudience; /** * CellChunkMap is an array of serialized representations of Cell (pointing to Chunks with full Cell - * data) and can be allocated both off-heap and on-heap. CellChunkMap is a byte array (chunk) - * holding all that is needed to access a Cell, which is actually saved on another deeper chunk. Per - * Cell we have a reference to this deeper byte array B (chunk ID, integer), offset in bytes in B - * (integer), length in bytes in B (integer) and seqID of the cell (long). In order to save - * reference to byte array we use the Chunk's ID given by ChunkCreator. The CellChunkMap memory - * layout on chunk A relevant to a deeper byte array B, holding the actual cell data: < header > - * <--- first Cell -> <-- second Cell ... + * data) and can be allocated both off-heap and on-heap. + * + * CellChunkMap is a byte array (chunk) holding all that is needed to access a Cell, which is + * actually saved on another deeper chunk. Per Cell we have a reference to this deeper byte array B + * (chunk ID, integer), offset in bytes in B (integer), length in bytes in B (integer) and seqID of + * the cell (long). In order to save reference to byte array we use the Chunk's ID given by + * ChunkCreator. + * + * The CellChunkMap memory layout on chunk A relevant to a deeper byte array B, holding the actual + * cell data: + * + * + * + * < header > <--- first Cell -> <-- second Cell ... * --- ... - * integer | integer | integer | integer | long | 4 bytes | 4 bytes | 4 bytes | 4 bytes | 8 bytes | - * ChunkID | chunkID of | offset in B | length of | sequence | ... of this | chunk B with | where - * Cell's | Cell's | ID of | chunk A | Cell data | data starts | data in B | the Cell | + * integer | integer | integer | integer | long | + * 4 bytes | 4 bytes | 4 bytes | 4 bytes | 8 bytes | + * ChunkID | chunkID of | offset in B | length of | sequence | ... + * of this | chunk B with | where Cell's | Cell's | ID of| + * chunk A | Cell data| data starts | data in B | the Cell | * --- ... + * */ @InterfaceAudience.Private public class CellChunkMap extends CellFlatMap { @@ -71,7 +81,7 @@ public class CellChunkMap extends CellFlatMap { } } - /* + /** * To be used by base (CellFlatMap) class only to create a sub-CellFlatMap Should be used only to * create only CellChunkMap from CellChunkMap */
(hbase) branch branch-2.6 updated: HBASE-28651 Reformat the javadoc for CellChunkMap (#5977)
This is an automated email from the ASF dual-hosted git repository. zhangduo pushed a commit to branch branch-2.6 in repository https://gitbox.apache.org/repos/asf/hbase.git The following commit(s) were added to refs/heads/branch-2.6 by this push: new c86bc95bb43 HBASE-28651 Reformat the javadoc for CellChunkMap (#5977) c86bc95bb43 is described below commit c86bc95bb433bd3dc940131a53240850ea0d667a Author: Duo Zhang AuthorDate: Tue Jun 11 22:03:35 2024 +0800 HBASE-28651 Reformat the javadoc for CellChunkMap (#5977) Signed-off-by: Yi Mei (cherry picked from commit 580361820f6d678ef8044dc2b1a8b00b1b30c5ee) --- .../hadoop/hbase/regionserver/CellChunkMap.java| 32 ++ 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CellChunkMap.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CellChunkMap.java index 8a5f28c2870..e4bfcf05ab2 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CellChunkMap.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CellChunkMap.java @@ -27,18 +27,28 @@ import org.apache.yetus.audience.InterfaceAudience; /** * CellChunkMap is an array of serialized representations of Cell (pointing to Chunks with full Cell - * data) and can be allocated both off-heap and on-heap. CellChunkMap is a byte array (chunk) - * holding all that is needed to access a Cell, which is actually saved on another deeper chunk. Per - * Cell we have a reference to this deeper byte array B (chunk ID, integer), offset in bytes in B - * (integer), length in bytes in B (integer) and seqID of the cell (long). In order to save - * reference to byte array we use the Chunk's ID given by ChunkCreator. The CellChunkMap memory - * layout on chunk A relevant to a deeper byte array B, holding the actual cell data: < header > - * <--- first Cell -> <-- second Cell ... + * data) and can be allocated both off-heap and on-heap. + * + * CellChunkMap is a byte array (chunk) holding all that is needed to access a Cell, which is + * actually saved on another deeper chunk. Per Cell we have a reference to this deeper byte array B + * (chunk ID, integer), offset in bytes in B (integer), length in bytes in B (integer) and seqID of + * the cell (long). In order to save reference to byte array we use the Chunk's ID given by + * ChunkCreator. + * + * The CellChunkMap memory layout on chunk A relevant to a deeper byte array B, holding the actual + * cell data: + * + * + * + * < header > <--- first Cell -> <-- second Cell ... * --- ... - * integer | integer | integer | integer | long | 4 bytes | 4 bytes | 4 bytes | 4 bytes | 8 bytes | - * ChunkID | chunkID of | offset in B | length of | sequence | ... of this | chunk B with | where - * Cell's | Cell's | ID of | chunk A | Cell data | data starts | data in B | the Cell | + * integer | integer | integer | integer | long | + * 4 bytes | 4 bytes | 4 bytes | 4 bytes | 8 bytes | + * ChunkID | chunkID of | offset in B | length of | sequence | ... + * of this | chunk B with | where Cell's | Cell's | ID of| + * chunk A | Cell data| data starts | data in B | the Cell | * --- ... + * */ @InterfaceAudience.Private public class CellChunkMap extends CellFlatMap { @@ -71,7 +81,7 @@ public class CellChunkMap extends CellFlatMap { } } - /* + /** * To be used by base (CellFlatMap) class only to create a sub-CellFlatMap Should be used only to * create only CellChunkMap from CellChunkMap */
(hbase) branch branch-2.5 updated: HBASE-28651 Reformat the javadoc for CellChunkMap (#5977)
This is an automated email from the ASF dual-hosted git repository. zhangduo pushed a commit to branch branch-2.5 in repository https://gitbox.apache.org/repos/asf/hbase.git The following commit(s) were added to refs/heads/branch-2.5 by this push: new 9b33ab6feb5 HBASE-28651 Reformat the javadoc for CellChunkMap (#5977) 9b33ab6feb5 is described below commit 9b33ab6feb5bc5bfb7d56371105a1e681061e04e Author: Duo Zhang AuthorDate: Tue Jun 11 22:03:35 2024 +0800 HBASE-28651 Reformat the javadoc for CellChunkMap (#5977) Signed-off-by: Yi Mei (cherry picked from commit 580361820f6d678ef8044dc2b1a8b00b1b30c5ee) --- .../hadoop/hbase/regionserver/CellChunkMap.java| 32 ++ 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CellChunkMap.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CellChunkMap.java index 8a5f28c2870..e4bfcf05ab2 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CellChunkMap.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CellChunkMap.java @@ -27,18 +27,28 @@ import org.apache.yetus.audience.InterfaceAudience; /** * CellChunkMap is an array of serialized representations of Cell (pointing to Chunks with full Cell - * data) and can be allocated both off-heap and on-heap. CellChunkMap is a byte array (chunk) - * holding all that is needed to access a Cell, which is actually saved on another deeper chunk. Per - * Cell we have a reference to this deeper byte array B (chunk ID, integer), offset in bytes in B - * (integer), length in bytes in B (integer) and seqID of the cell (long). In order to save - * reference to byte array we use the Chunk's ID given by ChunkCreator. The CellChunkMap memory - * layout on chunk A relevant to a deeper byte array B, holding the actual cell data: < header > - * <--- first Cell -> <-- second Cell ... + * data) and can be allocated both off-heap and on-heap. + * + * CellChunkMap is a byte array (chunk) holding all that is needed to access a Cell, which is + * actually saved on another deeper chunk. Per Cell we have a reference to this deeper byte array B + * (chunk ID, integer), offset in bytes in B (integer), length in bytes in B (integer) and seqID of + * the cell (long). In order to save reference to byte array we use the Chunk's ID given by + * ChunkCreator. + * + * The CellChunkMap memory layout on chunk A relevant to a deeper byte array B, holding the actual + * cell data: + * + * + * + * < header > <--- first Cell -> <-- second Cell ... * --- ... - * integer | integer | integer | integer | long | 4 bytes | 4 bytes | 4 bytes | 4 bytes | 8 bytes | - * ChunkID | chunkID of | offset in B | length of | sequence | ... of this | chunk B with | where - * Cell's | Cell's | ID of | chunk A | Cell data | data starts | data in B | the Cell | + * integer | integer | integer | integer | long | + * 4 bytes | 4 bytes | 4 bytes | 4 bytes | 8 bytes | + * ChunkID | chunkID of | offset in B | length of | sequence | ... + * of this | chunk B with | where Cell's | Cell's | ID of| + * chunk A | Cell data| data starts | data in B | the Cell | * --- ... + * */ @InterfaceAudience.Private public class CellChunkMap extends CellFlatMap { @@ -71,7 +81,7 @@ public class CellChunkMap extends CellFlatMap { } } - /* + /** * To be used by base (CellFlatMap) class only to create a sub-CellFlatMap Should be used only to * create only CellChunkMap from CellChunkMap */
(hbase) branch master updated: HBASE-28651 Reformat the javadoc for CellChunkMap (#5977)
This is an automated email from the ASF dual-hosted git repository. zhangduo pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/hbase.git The following commit(s) were added to refs/heads/master by this push: new 580361820f6 HBASE-28651 Reformat the javadoc for CellChunkMap (#5977) 580361820f6 is described below commit 580361820f6d678ef8044dc2b1a8b00b1b30c5ee Author: Duo Zhang AuthorDate: Tue Jun 11 22:03:35 2024 +0800 HBASE-28651 Reformat the javadoc for CellChunkMap (#5977) Signed-off-by: Yi Mei --- .../hadoop/hbase/regionserver/CellChunkMap.java| 32 ++ 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CellChunkMap.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CellChunkMap.java index 8a5f28c2870..e4bfcf05ab2 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CellChunkMap.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CellChunkMap.java @@ -27,18 +27,28 @@ import org.apache.yetus.audience.InterfaceAudience; /** * CellChunkMap is an array of serialized representations of Cell (pointing to Chunks with full Cell - * data) and can be allocated both off-heap and on-heap. CellChunkMap is a byte array (chunk) - * holding all that is needed to access a Cell, which is actually saved on another deeper chunk. Per - * Cell we have a reference to this deeper byte array B (chunk ID, integer), offset in bytes in B - * (integer), length in bytes in B (integer) and seqID of the cell (long). In order to save - * reference to byte array we use the Chunk's ID given by ChunkCreator. The CellChunkMap memory - * layout on chunk A relevant to a deeper byte array B, holding the actual cell data: < header > - * <--- first Cell -> <-- second Cell ... + * data) and can be allocated both off-heap and on-heap. + * + * CellChunkMap is a byte array (chunk) holding all that is needed to access a Cell, which is + * actually saved on another deeper chunk. Per Cell we have a reference to this deeper byte array B + * (chunk ID, integer), offset in bytes in B (integer), length in bytes in B (integer) and seqID of + * the cell (long). In order to save reference to byte array we use the Chunk's ID given by + * ChunkCreator. + * + * The CellChunkMap memory layout on chunk A relevant to a deeper byte array B, holding the actual + * cell data: + * + * + * + * < header > <--- first Cell -> <-- second Cell ... * --- ... - * integer | integer | integer | integer | long | 4 bytes | 4 bytes | 4 bytes | 4 bytes | 8 bytes | - * ChunkID | chunkID of | offset in B | length of | sequence | ... of this | chunk B with | where - * Cell's | Cell's | ID of | chunk A | Cell data | data starts | data in B | the Cell | + * integer | integer | integer | integer | long | + * 4 bytes | 4 bytes | 4 bytes | 4 bytes | 8 bytes | + * ChunkID | chunkID of | offset in B | length of | sequence | ... + * of this | chunk B with | where Cell's | Cell's | ID of| + * chunk A | Cell data| data starts | data in B | the Cell | * --- ... + * */ @InterfaceAudience.Private public class CellChunkMap extends CellFlatMap { @@ -71,7 +81,7 @@ public class CellChunkMap extends CellFlatMap { } } - /* + /** * To be used by base (CellFlatMap) class only to create a sub-CellFlatMap Should be used only to * create only CellChunkMap from CellChunkMap */