drizzle-nginx-module error body missing?

dannynoonan nginx-forum at nginx.us
Sun Oct 16 05:00:58 UTC 2011

Hey nginx list, it's been awhile. This question is directed at agentzh
and chaoslawful.

I'm using nginx drizzle to insert to a table. I have a unique key
constraint on the table. When I try to insert and violate the unique
constraint, I get a 500 from the nginx location doing the mysql query,
but no response body or headers to pass on to my client indicating what
the mysql error was. I can easily check for the 500 in the location
calling the mysql location, but I'd like to pass on the error code to
the actual client with some useful error information and not mask any
further 500's.

The json-ified output of a successful insert has an errcode field:

, but an actual error returns an empty body. Is there no way to grab the
error relating to my failed insert? Any suggestions?

Here's the error log:
2011/10/16 04:08:53 [error] 2847#0: *60 failed to send query: 17 (1062):
Duplicate entry '2-200-6094279b20' for key 'id_versions' while sending
query to drizzle upstream, client:, server: , request:
"POST http://foo/v1/publish HTTP/1.1", subrequest: "/mysql", upstream:
"drizzle://", host: "foo"

Here's the location:
    location /mysql {
      drizzle_pass mysqldb;
      drizzle_module_header off;
      set_unescape_uri $mysql_query $query_string;
      drizzle_query $mysql_query;
      rds_json on;

Here's the query I'm sending lua and proven via ngx.say(query)
INSERT INTO published SET packages_id=(SELECT id FROM packages WHERE
name='infra-package'), sha='6094279b2033a9dfa8bd38cadffeb9d274657936',
version='200', path='678459e1ce';

 location /addpackage {
      content_by_lua "

      local query = <bunch of query building code>
      local res = ngx.location.capture('/mysql', { args = query} )




Posted at Nginx Forum: http://forum.nginx.org/read.php?2,216768,216768#msg-216768

More information about the nginx mailing list