From: <n-...@us...> - 2012-08-29 22:50:03
|
Revision: 6600 http://gfarm.svn.sourceforge.net/gfarm/?rev=6600&view=rev Author: n-soda Date: 2012-08-29 22:49:57 +0000 (Wed, 29 Aug 2012) Log Message: ----------- alternative workaround against #431 - <err> [1000425] pgsql_filecopy_add: INSERT INTO FileCopy (inumber, hostname) VALUES ($1, $2): ERROR: duplicate key value violates unique constraint "filecopy_pkey"#012DETAIL: Key (inumber, hostname)=(391680, rgfsd109) already exists. the workaround in r6591 may have a problem, if a transaction which has such INSERT statement includes other SQL statements (see such symptom about dead_file_copy in comment:4:ticket:407). this change is a sequel to r6597, and fixes the problem by implementing the workaround in SQL, similar to r6599. Revision Links: -------------- http://gfarm.svn.sourceforge.net/gfarm/?rev=6591&view=rev http://gfarm.svn.sourceforge.net/gfarm/?rev=6597&view=rev http://gfarm.svn.sourceforge.net/gfarm/?rev=6599&view=rev Modified Paths: -------------- gfarm_v2/branches/2.5/server/gfmd/db_pgsql.c Modified: gfarm_v2/branches/2.5/server/gfmd/db_pgsql.c =================================================================== --- gfarm_v2/branches/2.5/server/gfmd/db_pgsql.c 2012-08-29 21:59:26 UTC (rev 6599) +++ gfarm_v2/branches/2.5/server/gfmd/db_pgsql.c 2012-08-29 22:49:57 UTC (rev 6600) @@ -2277,7 +2277,22 @@ struct db_filecopy_arg *arg) { return (pgsql_filecopy_call(seqnum, arg, - "INSERT INTO FileCopy (inumber, hostname) VALUES ($1, $2)", + "INSERT INTO FileCopy (inumber, hostname) " +#if 0 + "VALUES ($1, $2)", +#else /* XXX FIXME: workaround for SourceForge #431 */ + /* + * without "::varchar" just after $2, + * the following error occurrs with PostgreSQL-8.4.4: + * ERROR: inconsistent types deduced for parameter $2 + * DETAIL: text versus character varying + * + * "::int8" was not necessary, but added for + * style consistency. + */ + "SELECT $1::int8, $2::varchar WHERE NOT EXISTS " + "(SELECT * FROM FileCopy WHERE inumber=$1 AND hostname=$2)", +#endif gfarm_pgsql_insert, "pgsql_filecopy_add")); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |