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:
{"errcode":0,"insert_id":1,"affected_rows":1}
, 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: 10.102.17.232, server: , request:
"POST http://foo/v1/publish HTTP/1.1", subrequest: "/mysql", upstream:
"drizzle://10.102.17.232:3306", host: "foo"
Here's the location:
location /mysql {
internal;
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 {
internal;
content_by_lua "
local query = <bunch of query building code>
local res = ngx.location.capture('/mysql', { args = query} )
ngx.say(res.status..query)
ngx.say(res.status)
}
ngx_openresty/1.0.6.22
configure
arguments:
--prefix=/usr/local/encap/nginx-resty-1.0.6.22/nginx
--add-module=../ngx_devel_kit-0.2.17
--add-module=../echo-nginx-module-0.37rc4
--add-module=../xss-nginx-module-0.03rc3
--add-module=../set-misc-nginx-module-0.22rc2
--add-module=../form-input-nginx-module-0.07rc5
--add-module=../encrypted-session-nginx-module-0.01
--add-module=../drizzle-nginx-module-0.1.1
--add-module=../ngx_lua-0.3.1rc8
--add-module=../headers-more-nginx-module-0.16rc2
--add-module=../srcache-nginx-module-0.12
--add-module=../array-var-nginx-module-0.03rc1
--add-module=../memc-nginx-module-0.12
--add-module=../redis2-nginx-module-0.07
--add-module=../upstream-keepalive-nginx-module-0.3
--add-module=../auth-request-nginx-module-0.2
--add-module=../rds-json-nginx-module-0.12rc5
--add-module=../rds-csv-nginx-module-0.03
--add-module=/foursquare/david/src/third-party/nginx-gridfs
--add-module=/foursquare/david/src/third-party/nginx_upload_module-2.2.0
--with-http_ssl_module
Posted at Nginx Forum: http://forum.nginx.org/read.php?2,216768,216768#msg-216768
More information about the nginx
mailing list