[mirrorbrain-commits] [opensuse-svn] r6641 - trunk/tools/download-redirector-v2/sql

From: Novell Forge SVN <noreply_at_novell.com>
Date: Sun, 1 Mar 2009 16:47:50 -0700 (MST)
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)
_at_@ -162,7 +162,6 @@
 DECLARE
     fileid integer;
     arr smallint[];
-    rc boolean;
 BEGIN
     SELECT INTO fileid, arr
         id, mirrors FROM filearr WHERE path = arg_path;
_at_@ -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.org
Received on Sun Mar 01 2009 - 23:48:07 GMT

This archive was generated by hypermail 2.3.0 : Mon Feb 20 2012 - 23:47:04 GMT