Return-Path: Delivered-To: apmail-cassandra-user-archive@www.apache.org Received: (qmail 90729 invoked from network); 30 Aug 2010 14:43:30 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 30 Aug 2010 14:43:30 -0000 Received: (qmail 55427 invoked by uid 500); 30 Aug 2010 14:43:28 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 55240 invoked by uid 500); 30 Aug 2010 14:43:26 -0000 Mailing-List: contact user-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cassandra.apache.org Delivered-To: mailing list user@cassandra.apache.org Received: (qmail 55231 invoked by uid 99); 30 Aug 2010 14:43:26 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 Aug 2010 14:43:26 +0000 X-ASF-Spam-Status: No, hits=1.3 required=10.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL,URI_HEX X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of juho.makinen@gmail.com designates 209.85.216.179 as permitted sender) Received: from [209.85.216.179] (HELO mail-qy0-f179.google.com) (209.85.216.179) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 Aug 2010 14:43:21 +0000 Received: by qyk9 with SMTP id 9so5107070qyk.10 for ; Mon, 30 Aug 2010 07:43:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=N5BT8rgEdRFLLq+JDLOkRh4FJb0vvztyU1B4kgw9RQs=; b=TY+CpkIFDjYtre0+iZZqPWJgYL/Ba8PCCMGXW3fqx2rFd/momaokFs/pnkJL7IJ1SC u9sbv+RXXk7ZN3talz+FlspU1zEmPPw1g+ry8lvns2I/K9IMZ7Coin0AA0lI6i+V03Wv SitOtlfOd6u+/snWTkpZF83MQ5iINs8f/Hkc8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=UCcxbYcKRQABfRp5bix1ZBESaW5UqsJGELAUrQO29yKJ4cmhe/g0kGegs1omI/7yjY bEQm7M/auQB3byVE9eo+CPbefxjoB97vylGxEnpST4XU7iT66euihhwpsgQh8Rix2CGr 6SnJHITtoouc1ZQGs3Njr0wGWTxVp8Nm5RJNY= MIME-Version: 1.0 Received: by 10.224.19.200 with SMTP id c8mr2915276qab.202.1283179380823; Mon, 30 Aug 2010 07:43:00 -0700 (PDT) Received: by 10.229.13.82 with HTTP; Mon, 30 Aug 2010 07:43:00 -0700 (PDT) In-Reply-To: <4C7BB121.6090301@softwareprojects.com> References: <1283172538437-5478057.post@n2.nabble.com> <4C7BB121.6090301@softwareprojects.com> Date: Mon, 30 Aug 2010 17:43:00 +0300 Message-ID: Subject: Re: Thrift + PHP: help! From: =?ISO-8859-1?Q?Juho_M=E4kinen?= To: user@cassandra.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Mon, Aug 30, 2010 at 4:24 PM, Mike Peters wrote: > Have you considered instead of retrying the failing node, to iterate thro= ugh > other nodes in your cluster? Yes, the $this->connect() does just that: it removes the previous node from the node list and gives the list back to thrift connection function. In case all nodes have been tried (and thus removed) it refills the node list and starts looping it again. In practice this will never happen but the code is there just to be sure :) - Juho M=E4kinen > > If one node is failing (let's assume it's overloaded for a minute), you'r= e > probably going to be better off having the client send the insert to the > next node in line. > > Thoughts? > > On 8/30/2010 9:17 AM, Juho M=E4kinen wrote: >> >> Yes, I've already planning to do so. The class has still some >> dependencies into our other functions which I need to first clear out. >> >> Basically each api call is wrapped inside a retry loop as we can >> assume that each operation can be retried as many times as needed: >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0$tries =3D 0; >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0$this->last_exception =3D null; >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0$delay =3D 1000; // start with 1ms retry = delay >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0do { >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0try { >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0$this->cl= ient->insert($this->keyspace, >> $key, $column_path, $value, >> $timestamp, $consistency_level); >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return; >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0} catch (cassandra_Invali= dRequestException $e) { >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Logger::e= rror("InvalidRequestException: " . >> $e->why . ', >> stacktrace: ' . $e->getMessage()); >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0throw $e; >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0} catch (Exception $e) { >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0$this->la= st_exception =3D $e; >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0$tries++; >> >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0// sleep = for some time and try again >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0usleep($d= elay); >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0$delay = =3D $delay * 3; >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0$this->co= nnect(); // Drop current server >> and reopen a connection >> into another server >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0} >> >> >> >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0} while ($tries< =A04); >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0// Give up and throw the last exception >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0throw $this->last_exception; >> >> >> =A0- Juho M=E4kinen >> >> On Mon, Aug 30, 2010 at 3:48 PM, Mike Peters >> =A0wrote: >>> >>> Juho, do you mind sharing your implementation with the group? >>> >>> We'd love to help as well with rewriting the thrift interface, >>> specificaly >>> TSocket.php which seems to be where the majority of the problems are >>> lurking. >>> >>> Has anyone tried compiling native thrift support as described here >>> https://wiki.fourkitchens.com/display/PF/Using+Cassandra+with+PHP >>> https://wiki.fourkitchens.com/display/PF/Using+Cassandra+with+PHP >>> -- >>> View this message in context: >>> http://cassandra-user-incubator-apache-org.3065146.n2.nabble.com/Thrift= -PHP-help-tp5437314p5478057.html >>> Sent from the cassandra-user@incubator.apache.org mailing list archive = at >>> Nabble.com. >>> >> > >