Commits

bitblaze  committed d6cd1d6

Fixed OCC. Still need to tweak and maybe fix up analysis

  • Participants
  • Parent commits e4b310f

Comments (0)

Files changed (2)

File analysis.txt

 
 The performance numbers are as follows:
 
-			    Average Transaction Duration
+                            Average Transaction Duration
 		0.1ms		1ms		10ms		100ms
 Read only
- Serial   	5632.05		927.96		99.6178		10.0338	
- Locking A	43902		25734.2		4555.47		386.677	
- Locking B	34735		33098.5		9571.27		931.052	
- OCC      	84283.4		85719.2		9596.57		936.716	
- MVCC     	83183.4		68633.1		9596.34		935.053	
+ Serial   	5775.21		939.732		99.17		9.9717	
+ Locking A	42149.7		26098.5		4553.62		434.921	
+ Locking B	37609		33479.5		9577.9		942.646	
+ OCC      	81382.2		85680.5		9597.2		938.752	
+ MVCC     	80183.2		66426.3		9587.99		938.774	
 1% contention
- Serial   	5485.33		922.828		99.0379		10.1271	
- Locking A	18386.9		9155.45		1219.47		143.552	
- Locking B	19015.7		10062.3		1637.88		153.985	
- OCC      	40755.7		46178.4		9524.57		887.451	
- MVCC     	28132.3		19519.2		4590.21		406.559	
+ Serial   	5382.6		917.08		99.4902		10.0483	
+ Locking A	18764.5		9094.55		1292.38		116.441	
+ Locking B	19645.4		9675.5		1517.77		159.474	
+ OCC      	37639		34529.2		4029.47		332.515	
+ MVCC     	27976.8		20250.6		4615.32		364.303	
 10% contention
- Serial   	5441.97		921.831		99.3269		9.94297	
- Locking A	7645.78		1954.16		233.504		23.0837	
- Locking B	8124.31		2371.28		276.807		26.4953	
- OCC      	40302.3		48176.5		9475.88		854.707	
- MVCC     	16753		5315.58		609.028		54.7324	
+ Serial   	5494.8		919.099		99.2073		10.0018	
+ Locking A	7623.34		1996.9		240.012		22.5453	
+ Locking B	8148.6		2294.48		298.131		28.5295	
+ OCC      	19777.6		9003.55		991.551		92.555	
+ MVCC     	16755.3		5200.42		632.332		55.8744	
 65% contention
- Serial   	5459.29		921.003		98.6258		9.98485	
- Locking A	4012.38		875.417		99.8224		10.1182	
- Locking B	3834.24		889.6		100.728		10.1121	
- OCC      	37450.1		45666.7		9455.47		863.189	
- MVCC     	5810.49		1213.22		139.135		14.5296	
+ Serial   	5499.21		925.796		99.4235		9.84017	
+ Locking A	3960.43		878.508		99.1562		10.0753	
+ Locking B	3809.39		891.491		100.649		10.1093	
+ OCC      	3317.64		1725.45		185.837		18.0807	
+ MVCC     	5866.96		1237.95		142.795		14.2617	
 100% contention
- Serial   	5445.03		929.975		99.8217		10.0644	
- Locking A	4543.01		897.928		99.0479		10.0028	
- Locking B	4509.93		895.21		98.949		9.9417	
- OCC      	45757.5		62012.1		9486.07		763.496	
- MVCC     	4444.57		889.066		99.1565		10.014	
+ Serial   	5525.55		928.642		99.3166		10.0312	
+ Locking A	4513.51		895.229		99.0387		9.89119	
+ Locking B	4457.46		892.811		98.4178		10.0403	
+ OCC      	2618.8		930.924		100.598		9.94582	
+ MVCC     	4416.66		893.404		98.0856		9.94103	
 High contention mixed read/write
- Serial   	10940.7		5743.33		821.875		104.826	
- Locking A	9020.58		5018.39		791.244		91.4806	
- Locking B	9233.27		5222.45		1112.6		155.654	
- OCC      	48534.1		61946.3		76702.3		7914.42	
- MVCC     	11647.7		11499.8		11326.9		7925.51	
-
+ Serial   	10755.6		5277.38		929.729		154.321	
+ Locking A	8972.63		5076.54		920.856		97.1613	
+ Locking B	9085.42		5391.73		977.492		84.104	
+ OCC      	7360.55		8139.98		2220.43		769.946	
+ MVCC     	11481.7		11636.3		11356.4		8165.26	
 
 # -----------------------------------------------------------------------------
 # 2. Simulations are doomed to succeed

File txn/txn_processor.cc

 }
 
 void TxnProcessor::RunOCCScheduler() {
+
   Txn* txn;
 
   while (tp_.Active()) {
     // start transitions
-    while (txn_requests_.Pop(&txn)) {
+    if (txn_requests_.Pop(&txn)) {
       txn->occ_start_time_ = GetTime();
       tp_.RunTask(new Method<TxnProcessor, void, Txn*>(
             this,
 
     // deal with finished transactions
     while (completed_txns_.Pop(&txn)) {
+
+      if (txn->Status() == COMPLETED_A) {
+        txn->status_ = ABORTED;
+	txn_results_.Push(txn);
+	continue;
+      }
+
       bool valid = true;
-      time_t txn_start = txn->occ_start_time_;
-      for (set<Key>::iterator key_it = txn->readset_.begin();
+      set<Key>::iterator key_it;
+
+      for (key_it = txn->readset_.begin(); 
            key_it != txn->readset_.end(); ++key_it) {
-        Key key = *key_it;
-        time_t key_time = storage_.Timestamp(key);
-        if (key_time > txn_start) {
+        if (storage_.Timestamp(*key_it) > txn->occ_start_time_) {
           valid = false;
         }
       }
-      for (set<Key>::iterator key_it = txn->writeset_.begin();
+      for (key_it = txn->writeset_.begin();
            key_it != txn->writeset_.end(); ++key_it) {
-        Key key = *key_it;
-        time_t key_time = storage_.Timestamp(key);
-        if (key_time > txn_start) {
+        if (storage_.Timestamp(*key_it) > txn->occ_start_time_) {
           valid = false;
         }
       }
 
       // Commit/restart
-      if (valid) {
-        if (txn->status_ == COMPLETED_C) {
-          ApplyWrites(txn);
-          txn->status_ = COMMITTED;
-          txn_results_.Push(txn);
-        } else if (txn->status_ == COMPLETED_A) {
-          txn->status_ = ABORTED;
-          txn_results_.Push(txn);
-        }
-      } else {
+      if (!valid) {
         txn->status_ = INCOMPLETE;
 	txn->occ_start_time_ = GetTime();
 	tp_.RunTask(new Method<TxnProcessor, void, Txn*>(
 	      this,
 	      &TxnProcessor::ExecuteTxn,
 	      txn));
+      } else {
+        ApplyWrites(txn);
+	txn_results_.Push(txn);
       }
     }
   }