From user-return-1708-archive-asf-public=cust-asf.ponee.io@kudu.apache.org Sun Aug 25 22:02:10 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id F0711180656 for ; Mon, 26 Aug 2019 00:02:09 +0200 (CEST) Received: (qmail 83798 invoked by uid 500); 25 Aug 2019 22:02:09 -0000 Mailing-List: contact user-help@kudu.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@kudu.apache.org Delivered-To: mailing list user@kudu.apache.org Received: (qmail 83788 invoked by uid 99); 25 Aug 2019 22:02:08 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 25 Aug 2019 22:02:08 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 4B951C0660 for ; Sun, 25 Aug 2019 22:02:08 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.801 X-Spam-Level: * X-Spam-Status: No, score=1.801 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=cloudera.com Received: from mx1-he-de.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id kMdLLQjC5bHL for ; Sun, 25 Aug 2019 22:02:06 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2607:f8b0:4864:20::742; helo=mail-qk1-x742.google.com; envelope-from=aserbin@cloudera.com; receiver= Received: from mail-qk1-x742.google.com (mail-qk1-x742.google.com [IPv6:2607:f8b0:4864:20::742]) by mx1-he-de.apache.org (ASF Mail Server at mx1-he-de.apache.org) with ESMTPS id 88C8E7DD30 for ; Sun, 25 Aug 2019 22:02:05 +0000 (UTC) Received: by mail-qk1-x742.google.com with SMTP id d79so12607465qke.11 for ; Sun, 25 Aug 2019 15:02:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloudera.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=bYcHA27BkhH5tjbXdTgI0GoFpdu3iC6eqmVNP5SKer8=; b=JIgNbNUU2bGxENn44h8aWBY/fe4qQ0ImJbgDKRRFZdqjrm4Ym00Ehu5JJVzkG/qWOo 8cMePFwtXMxVpD7FTi2J83OJ7Ls77IIZaou+Wxh3705vlrFjDevGP6f8V0r8OBcdwkGW +xcUMBFELXnMSU7cElZOIwT/e8/y+UN3Fby4pI/CbPgQGv6Cz6CX7HC08phv2F+BDX2b ysigtMFzh3Ey10E0XcgTVTMrT2dV5XHkGmvR9vCKR1fxQwE7YoSAiu9vRQgMkpCCvf5O spRC/P4G0pLIPq/TUz2Y7GcOOhW5wqbXFaJ7HDb5VpTHIaPo3K+/kWNkcDehhOXrG5QJ vXwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=bYcHA27BkhH5tjbXdTgI0GoFpdu3iC6eqmVNP5SKer8=; b=hnMESvbbUKDCxfxaUVqsYoz8Yr+qlsZTT3tyQEbtZaCx93vYlUvgwAQS2FtEF5iOiY 2duH+0Uu26H2K6Cxlm2nbJT9ghfpvrZzN08ZfYHCwBmrjGVbMckkid+ndRRIklKHd51f 294ipTeMCvtvgU/AOUA/1hZf1wLD9Mx60K9o1yrTsCVYr7IPErTKo/LHZfv9ssg2hSDC 6bzyWv49oug9yE6q3YIfHGg59dqBX4J4cMZBnQjBMZ2ZwuyJhvNdqU8Qn5H0StQma/24 PrjBE+D6ap2GhBksLr6zA5ez8/03XpM0V8+S5uDtl1kwyiLdf/QGc7JFP3C6QbNC2Ajv LU4Q== X-Gm-Message-State: APjAAAV57RMi3cl8JDa5kflhbanWn/2yg4VFoF9mKjLsHOqQ3L0+yWVf ihJ/DPNTtafjKug+pV25i10J5cMvAZsIaDlKiM++4jC0PB0= X-Google-Smtp-Source: APXvYqwqHxs9DwCeAyZLKFs/SSGmS2crc2ZJ9X8gXJQxLquWsdCKYqlAbgdxtBNqhDzTbLEleCGGPr3RZ33UCNpOqRo= X-Received: by 2002:a05:620a:1413:: with SMTP id d19mr13406026qkj.341.1566770524153; Sun, 25 Aug 2019 15:02:04 -0700 (PDT) MIME-Version: 1.0 References: <89EA5581-3611-4CB7-814D-64D9D73A7B80@apache.org> In-Reply-To: <89EA5581-3611-4CB7-814D-64D9D73A7B80@apache.org> From: Alexey Serbin Date: Sun, 25 Aug 2019 15:01:38 -0700 Message-ID: Subject: Re: KuduSession - is not thread-safe To: user@kudu.apache.org Content-Type: multipart/alternative; boundary="0000000000008994810590f8301d" --0000000000008994810590f8301d Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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.htm= l 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 wrote: > Hi John, > > I=E2=80=99m not sure if there=E2=80=99s 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 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. > > --0000000000008994810590f8301d Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi John,

If my understanding is correct, Kud= uSession is designed to be used by a single thread, not multiple.=C2=A0 For= details, see=C2=A0https://kudu.apache.org/apidocs/org/apache/kudu/client/AsyncKuduSess= ion.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/Kud= uSession.=C2=A0 Would using multiple sessions on the same KuduClient fit yo= ur case?=C2=A0 Otherwise, what is the rationale behind using a single sessi= on by multiple threads?


Thanks,

Alexey

On Sat, Aug 24, 2019 at 1:27 AM Attila Bukor = <abukor@apache.org> wrote:
Hi John,
<= span style=3D"background-color:rgba(255,255,255,0)">
<= span style=3D"background-color:rgba(255,255,255,0)">I=E2=80=99m not sure if= there=E2=80=99s a existing pooling solution that would work, but I would s= uggest handle locking manually in your application by putting the session.a= pply(op) in a synchronized (session) block. I believe you could also use mu= ltiple 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 th= e class KuduSession[1] claims that it is not thread-safe. So, I was wonderi= ng If there is a pooling mechanism or similar for multi-threaded applicatio= ns.

I would like to execute multiple operations such as: session.app= ly(upsert), session.apply(update) and session.apply(delete) in a multiple t= hreads using a shared variable session.

Is that possible? How should= I be handling KuduSession and flushing in a multi thread environment.
<= br>Thanks in advance for your help.


Cheers,
John Mora.=
--0000000000008994810590f8301d--