cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Juho Mäkinen <juho.maki...@gmail.com>
Subject Re: Thrift + PHP: help!
Date Mon, 30 Aug 2010 13:17:33 GMT
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:
		$tries = 0;
		$this->last_exception = null;
		$delay = 1000; // start with 1ms retry delay
		do {
			try {
				$this->client->insert($this->keyspace, $key, $column_path, $value,
$timestamp, $consistency_level);
				return;
			} catch (cassandra_InvalidRequestException $e) {
				Logger::error("InvalidRequestException: " . $e->why . ',
stacktrace: ' . $e->getMessage());
				throw $e;
			} catch (Exception $e) {
				$this->last_exception = $e;
				$tries++;

				// sleep for some time and try again
				usleep($delay);
				$delay = $delay * 3;
				$this->connect(); // Drop current server and reopen a connection
into another server
			}



		} while ($tries < 4);
		// Give up and throw the last exception
		throw $this->last_exception;


 - Juho Mäkinen

On Mon, Aug 30, 2010 at 3:48 PM, Mike Peters
<cassandra@softwareprojects.com> wrote:
>
> 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.
>

Mime
View raw message