kudu-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexey Serbin <aser...@cloudera.com>
Subject Re: KuduSession - is not thread-safe
Date Sun, 25 Aug 2019 22:01:38 GMT
Hi John,

If my understanding is correct, KuduSession is designed to be used by a
single thread, not multiple.  For details, see
https://kudu.apache.org/apidocs/org/apache/kudu/client/AsyncKuduSession.html

As Attila mentioned, it's possible to use multiple sessions spawned by the
same KuduClient, and that's the recommended usage pattern for
KuduClient/KuduSession.  Would using multiple sessions on the same
KuduClient fit your case?  Otherwise, what is the rationale behind using a
single session by multiple threads?


Thanks,

Alexey

On Sat, Aug 24, 2019 at 1:27 AM Attila Bukor <abukor@apache.org> wrote:

> Hi John,
>
> I’m not sure if there’s a existing pooling solution that would work, but I
> would suggest handle locking manually in your application by putting the
> session.apply(op) in a synchronized (session) block. I believe you could
> also use multiple sessions on the same client.
>
> Attila
>
> Sent from my iPhone
>
> On Aug 24, 2019, at 7:55 AM, John Mora <jhnmora000@gmail.com> wrote:
>
> Hi.
>
> The javadoc documentation of the class KuduSession[1] claims that it is
> not thread-safe. So, I was wondering If there is a pooling mechanism or
> similar for multi-threaded applications.
>
> I would like to execute multiple operations such as:
> session.apply(upsert), session.apply(update) and session.apply(delete) in a
> multiple threads using a shared variable session.
>
> Is that possible? How should I be handling KuduSession and flushing in a
> multi thread environment.
>
> Thanks in advance for your help.
>
> [1]
> https://kudu.apache.org/apidocs/org/apache/kudu/client/KuduSession.html
>
> Cheers,
> John Mora.
>
>

Mime
View raw message