Armin Rigo avatar Armin Rigo committed b0df504

Trying to implement the idea of decreasing the limit more subtly: set it
to 94% of the read size at the point the abort occurred. (This is what
I meant, and not f3d388a6c22d from stm-logging.) Measures needed.

Comments (0)

Files changed (2)


 static void AbortTransaction(int num)
   struct tx_descriptor *d = thread_descriptor;
+  long limit;
   assert(num < ABORT_REASONS);
+  /* upon abort, set the reads size limit to 94% of how much was read
+     so far.  This should ensure that, assuming the retry does the same
+     thing, it will commit just before it reaches the conflicting point. */
+  limit = d->list_of_read_objects.size;
+  if (limit > 0) {
+      limit -= (limit >> 4);
+      d->reads_size_limit_nonatomic = limit;
+  }


       v_counter = counter + 1;
-      /* initialize 'reads_size_limit_nonatomic' from the configured
-         length limit, scaled down by a factor of 2 for each time we
-         retry an aborted transaction.  Note that as soon as such a
-         shortened transaction succeeds, the next one will again have
-         full length, for now. */
-      d->reads_size_limit_nonatomic = stm_regular_length_limit >> counter;
+      /* If counter==0, initialize 'reads_size_limit_nonatomic' from the
+         configured length limit.  If counter>0, we did an abort, which
+         has configured 'reads_size_limit_nonatomic' to a smaller value.
+         When such a shortened transaction succeeds, the next one will
+         see its length limit doubled, up to the maximum. */
+      if (counter == 0) {
+          long limit = d->reads_size_limit_nonatomic;
+          if (limit != 0 && limit < (stm_regular_length_limit >> 1))
+              limit = (limit << 1) | 1;
+          else
+              limit = stm_regular_length_limit;
+          d->reads_size_limit_nonatomic = limit;
+      }
       if (!d->atomic)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.