Hi Olaf,

On 23/03/11 08:55, Olaf van der Spek wrote:
On Wed, Mar 23, 2011 at 9:17 AM, Anurag Priyam<[email protected]>  wrote:
Say:
- I have a pool of connection to multiple drizzle servers, say
d1.yeban.in, d2.yeban.in
- query = "INSERT INTO Users VALUES (4, 'Anurag", 'Priyam');"
- now when I do something like $drizzle.sharded_query(key, query),
depending on the sharding implementation, the query will be routed to
the appropriate drizzle server
- so, after 1000 writes some values are in d1.yeban.in, while others
in d2.yeban.in

I doubt it, as that'd require a SQL parser in the client (to retrieve
the key from the query text.

No, in almost every app I have ever worked on the app is passing something like:

SELECT * FROM t1 WHERE pkey = $somevalue;

The flaw comes with inserts relying on auto_increment, but I don't know of many scaling apps that use auto_increment. Would also be interested if someone came up with a workaround for this (I'm guessing a proxy?)

So you would do something like this pseudo code:

$conn = drizzle_con_get_shard($somevalue, strlen($somevalue));
drizzle_query($conn, $result, $query, strlen($query), $ret);

Or wrap that all into one function or something.

Kind Regards
--
Andrew Hutchings - LinuxJedi - http://www.linuxjedi.co.uk/

_______________________________________________
Mailing list: https://launchpad.net/~drizzle-discuss
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~drizzle-discuss
More help   : https://help.launchpad.net/ListHelp

Reply via email to