← Back to team overview

maria-developers team mailing list archive

Rev 2758: Atomic operation removed because we do not need it. in file:///home/bell/maria/bzr/work-maria-5.2-sync/

 

At file:///home/bell/maria/bzr/work-maria-5.2-sync/

------------------------------------------------------------
revno: 2758
revision-id: sanja@xxxxxxxxxxxx-20100329185318-s8s6lsuvm12oi8yb
parent: sergii@xxxxxxxxx-20100329151428-zkvrkidiyqmb19pn
committer: sanja@xxxxxxxxxxxx
branch nick: work-maria-5.2-sync
timestamp: Mon 2010-03-29 21:53:18 +0300
message:
  Atomic operation removed because we do not need it.
=== modified file 'storage/maria/ma_loghandler.c'
--- a/storage/maria/ma_loghandler.c	2010-03-15 11:51:23 +0000
+++ b/storage/maria/ma_loghandler.c	2010-03-29 18:53:18 +0000
@@ -8060,18 +8060,14 @@
     /* keep values for soft sync() and forced sync() actual */
     {
       uint32 fileno= LSN_FILE_NO(lsn);
-      my_atomic_rwlock_wrlock(&soft_sync_rwl);
-      my_atomic_store32(&soft_sync_min, fileno);
-      my_atomic_store32(&soft_sync_max, fileno);
-      my_atomic_rwlock_wrunlock(&soft_sync_rwl);
+      soft_sync_min= fileno;
+      soft_sync_max= fileno;
     }
   }
   else
   {
-    my_atomic_rwlock_wrlock(&soft_sync_rwl);
-    my_atomic_store32(&soft_sync_max, LSN_FILE_NO(lsn));
-    my_atomic_store32(&soft_need_sync, 1);
-    my_atomic_rwlock_wrunlock(&soft_sync_rwl);
+    soft_sync_max= lsn;
+    soft_need_sync= 1;
   }
 
   DBUG_ASSERT(flush_horizon <= log_descriptor.horizon);
@@ -8464,9 +8460,7 @@
               translog_status == TRANSLOG_READONLY);
 
   soft= soft_sync;
-  my_atomic_rwlock_wrlock(&soft_sync_rwl);
-  min_unsync= my_atomic_load32(&soft_sync_min);
-  my_atomic_rwlock_wrunlock(&soft_sync_rwl);
+  min_unsync= soft_sync_min;
   DBUG_PRINT("info", ("min_unsync: %lu", (ulong) min_unsync));
   if (soft && min_unsync < last_need_file)
   {
@@ -8748,9 +8742,7 @@
   uint32 min;
   DBUG_ENTER("ma_translog_sync");
 
-  my_atomic_rwlock_rdlock(&soft_sync_rwl);
-  min= my_atomic_load32(&soft_sync_min);
-  my_atomic_rwlock_rdunlock(&soft_sync_rwl);
+  min= soft_sync_min;
   if (!min)
     min= max;
 
@@ -8796,13 +8788,11 @@
       ulonglong prev_loop= my_micro_time();
       ulonglong time, sleep;
       uint32 min, max, sync_request;
-      my_atomic_rwlock_rdlock(&soft_sync_rwl);
-      min= my_atomic_load32(&soft_sync_min);
-      max= my_atomic_load32(&soft_sync_max);
-      sync_request= my_atomic_load32(&soft_need_sync);
-      my_atomic_store32(&soft_sync_min, max);
-      my_atomic_store32(&soft_need_sync, 0);
-      my_atomic_rwlock_rdunlock(&soft_sync_rwl);
+      min= soft_sync_min;
+      max= soft_sync_max;
+      sync_request= soft_need_sync;
+      soft_sync_min= max;
+      soft_need_sync= 0;
 
       sleep= group_commit_wait;
       if (sync_request)
@@ -8834,15 +8824,13 @@
   DBUG_ENTER("translog_soft_sync_start");
 
   /* check and init variables */
-  my_atomic_rwlock_rdlock(&soft_sync_rwl);
-  min= my_atomic_load32(&soft_sync_min);
-  max= my_atomic_load32(&soft_sync_max);
+  min= soft_sync_min;
+  max= soft_sync_max;
   if (!max)
-    my_atomic_store32(&soft_sync_max, (max= get_current_logfile()->number));
+    soft_sync_max= max= get_current_logfile()->number;
   if (!min)
-    my_atomic_store32(&soft_sync_min, max);
-  my_atomic_store32(&soft_need_sync, 1);
-  my_atomic_rwlock_rdunlock(&soft_sync_rwl);
+    soft_sync_min= max;
+  soft_need_sync= 1;
 
   if (!(res= ma_service_thread_control_init(&soft_sync_control)))
     if (!(res= pthread_create(&th, NULL, ma_soft_sync_background, NULL)))