You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Minwoo Kang <it...@gmail.com> on 2024/09/09 12:15:14 UTC
How to handle Remote Exceptions when shading HBase client
Hello, community
I am creating an in-house library using the HBase client library and
distributing it so that other users can use it.
To prevent conflicts with the user library, we shaded the HBase package.
(For example, org.apahce.hadoop.hbase... ->
good.company.org.apahce.hadoop.hbase...)
However, there is one problem here.
When an error occurs on the HBase server, it passes the class name to the
client.
The client, which receives the error class name from the server, attempts
to create an error object with that class name.
However, because the error class is shaded, the client cannot find the
appropriate error class received from the server.
There is a problem where the client does not find the appropriate error
class and mistakenly determines it to be a DoNotRetryIOException, even
though it should be retried.
To solve this problem, I am considering forcing the shading package prefix
when creating an object from the class received from the server in the
HBase client.
(For example, if the error class name received from the server is
org.apache.hadoop.hbase.regionserver.RegionServerStoppedException, I am
considering making it also find
good.company.org.apache.hadoop.hbase.regionserver.RegionServerStoppedException.)
Is there a nicer way to do this than the method mentioned above?
I wonder if there are any plans to add support features for shade users in
HBase.
(For example, a feature that allows the client to find the shaded class
name when creating an object from the class name received from the server.)
Kind Regards
Re: How to handle Remote Exceptions when shading HBase client
Posted by "张铎(Duo Zhang)" <pa...@gmail.com>.
I searched on master branch, ExceptionResponse.getExceptionClassName
and ExceptionResponse.getStackTrace, they are only called in
IPCUtil.createRemoteException and IPCUtil.isFatalConnectionException,
so you just need to patch these two methods. I guess for other
branches are almost the same.
Basically there are two possible ways, one is to introduce a
configuration, to config what package name you want to map
org.apache.hadoop.hbase in the package to. Another is to check the
package name for IPCUtil to automatically map the package name.
Thanks.
Bryan Beaudreault <bb...@apache.org> 于2024年9月9日周一 20:35写道:
>
> We used to do this years ago at my company. You have to find the various
> ProtobufUtil and RemoteException related classes, wherever the remote
> classname string is parsed from a protobuf into a Class. You need to push
> some custom code to rewrite the strings there. I think there were two or
> three spots where we shimmed in that code. I don't have any more specifics
> than that, because it was a while ago.
>
> I don't think there are currently plans to add support for shaded class
> names, but it's an open source project so you're more than welcome to
> create a JIRA and even contribute to it. I don't think it's too hard of a
> task.
>
> On Mon, Sep 9, 2024 at 8:15 AM Minwoo Kang <it...@gmail.com>
> wrote:
>
> > Hello, community
> >
> > I am creating an in-house library using the HBase client library and
> > distributing it so that other users can use it.
> > To prevent conflicts with the user library, we shaded the HBase package.
> > (For example, org.apahce.hadoop.hbase... ->
> > good.company.org.apahce.hadoop.hbase...)
> >
> > However, there is one problem here.
> > When an error occurs on the HBase server, it passes the class name to the
> > client.
> > The client, which receives the error class name from the server, attempts
> > to create an error object with that class name.
> > However, because the error class is shaded, the client cannot find the
> > appropriate error class received from the server.
> >
> > There is a problem where the client does not find the appropriate error
> > class and mistakenly determines it to be a DoNotRetryIOException, even
> > though it should be retried.
> >
> > To solve this problem, I am considering forcing the shading package prefix
> > when creating an object from the class received from the server in the
> > HBase client.
> > (For example, if the error class name received from the server is
> > org.apache.hadoop.hbase.regionserver.RegionServerStoppedException, I am
> > considering making it also find
> >
> > good.company.org.apache.hadoop.hbase.regionserver.RegionServerStoppedException.)
> >
> > Is there a nicer way to do this than the method mentioned above?
> > I wonder if there are any plans to add support features for shade users in
> > HBase.
> > (For example, a feature that allows the client to find the shaded class
> > name when creating an object from the class name received from the server.)
> >
> > Kind Regards
> >
Re: How to handle Remote Exceptions when shading HBase client
Posted by Bryan Beaudreault <bb...@apache.org>.
We used to do this years ago at my company. You have to find the various
ProtobufUtil and RemoteException related classes, wherever the remote
classname string is parsed from a protobuf into a Class. You need to push
some custom code to rewrite the strings there. I think there were two or
three spots where we shimmed in that code. I don't have any more specifics
than that, because it was a while ago.
I don't think there are currently plans to add support for shaded class
names, but it's an open source project so you're more than welcome to
create a JIRA and even contribute to it. I don't think it's too hard of a
task.
On Mon, Sep 9, 2024 at 8:15 AM Minwoo Kang <it...@gmail.com>
wrote:
> Hello, community
>
> I am creating an in-house library using the HBase client library and
> distributing it so that other users can use it.
> To prevent conflicts with the user library, we shaded the HBase package.
> (For example, org.apahce.hadoop.hbase... ->
> good.company.org.apahce.hadoop.hbase...)
>
> However, there is one problem here.
> When an error occurs on the HBase server, it passes the class name to the
> client.
> The client, which receives the error class name from the server, attempts
> to create an error object with that class name.
> However, because the error class is shaded, the client cannot find the
> appropriate error class received from the server.
>
> There is a problem where the client does not find the appropriate error
> class and mistakenly determines it to be a DoNotRetryIOException, even
> though it should be retried.
>
> To solve this problem, I am considering forcing the shading package prefix
> when creating an object from the class received from the server in the
> HBase client.
> (For example, if the error class name received from the server is
> org.apache.hadoop.hbase.regionserver.RegionServerStoppedException, I am
> considering making it also find
>
> good.company.org.apache.hadoop.hbase.regionserver.RegionServerStoppedException.)
>
> Is there a nicer way to do this than the method mentioned above?
> I wonder if there are any plans to add support features for shade users in
> HBase.
> (For example, a feature that allows the client to find the shaded class
> name when creating an object from the class name received from the server.)
>
> Kind Regards
>