Author: poeml Date: 2009-03-01 16:47:48 -0700 (Sun, 01 Mar 2009) New Revision: 6641 Modified: trunk/tools/download-redirector-v2/sql/schema-postgresql.sql Log: scanner: - handle concurrent insertion of a new file by another scanner. When scanning for the first time (starting with an empty database) there is a certain likelyhood that this may occur. Modified: trunk/tools/download-redirector-v2/sql/schema-postgresql.sql =================================================================== --- trunk/tools/download-redirector-v2/sql/schema-postgresql.sql 2009-03-01 23:26:54 UTC (rev 6640) +++ trunk/tools/download-redirector-v2/sql/schema-postgresql.sql 2009-03-01 23:47:48 UTC (rev 6641) @@ -162,7 +162,6 @@ DECLARE fileid integer; arr smallint[]; - rc boolean; BEGIN SELECT INTO fileid, arr id, mirrors FROM filearr WHERE path = arg_path; @@ -183,6 +182,12 @@ END IF; RETURN fileid; +EXCEPTION + WHEN unique_violation THEN + RAISE NOTICE 'file % was just inserted by somebody else', arg_path; + -- just update it by calling ourselves again + SELECT into fileid mirr_add_bypath(arg_serverid, arg_path); + RETURN fileid; END; $$ LANGUAGE 'plpgsql'; _______________________________________________ Opensuse-svn mailing list Opensuse-svn_at_forge.novell.com http://forge.novell.com/mailman/listinfo/opensuse-svn _______________________________________________ mirrorbrain-commits mailing list Note: To remove yourself from this list, send a mail with the content unsubscribe to the address mirrorbrain-commits-request_at_mirrorbrain.orgReceived on 2009-03-01Z23:48:07
This archive was generated by hypermail 2.2.0 : 2009-07-10Z19:18:11 GMT