freeside/FS/FS svc_acct.pm,1.159,1.160

ivan ivan at pouncequick.420.am
Sun Sep 5 02:41:37 PDT 2004


Update of /home/cvs/cvsroot/freeside/FS/FS
In directory pouncequick:/tmp/cvs-serv21931

Modified Files:
	svc_acct.pm 
Log Message:
acquire a database lock to prevent race conditions in duplicate checking

Index: svc_acct.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/svc_acct.pm,v
retrieving revision 1.159
retrieving revision 1.160
diff -u -d -r1.159 -r1.160
--- svc_acct.pm	14 Aug 2004 12:26:57 -0000	1.159
+++ svc_acct.pm	5 Sep 2004 09:41:33 -0000	1.160
@@ -247,6 +247,13 @@
 
   #new duplicate username/username at domain/uid checking
 
+  #this is Pg-specific.  what to do for mysql etc?
+  # ( mysql LOCK TABLES certainly isn't equivalent or useful here :/ )
+  warn "$me locking svc_acct table for duplicate search" if $DEBUG;
+  dbh->do("LOCK TABLE svc_acct IN SHARE ROW EXCLUSIVE MODE")
+    or die dbh->errstr;
+  warn "$me acquired svc_acct table lock for duplicate search" if $DEBUG;
+
   my $part_svc = qsearchs('part_svc', { 'svcpart' => $self->svcpart } );
   unless ( $part_svc ) {
     $dbh->rollback if $oldAutoCommit;




More information about the freeside-commits mailing list