Repository: jena
Updated Branches:
  refs/heads/master f3a1faaa2 -> 8c742f515


Some tidying up - comments and formatting.

Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/8c742f51
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/8c742f51
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/8c742f51

Branch: refs/heads/master
Commit: 8c742f5157a37cd4b298588f2248535c50e02242
Parents: 03b4b72
Author: Andy Seaborne <[email protected]>
Authored: Wed May 31 11:18:54 2017 +0100
Committer: Andy Seaborne <[email protected]>
Committed: Wed May 31 13:16:59 2017 +0100

----------------------------------------------------------------------
 .../tdb/base/recordbuffer/RecordBufferPageMgr.java   |  5 +----
 .../apache/jena/tdb/transaction/BlockMgrJournal.java | 15 +++++++--------
 .../org/apache/jena/tdb/transaction/Journal.java     |  6 ------
 .../apache/jena/tdb/transaction/JournalControl.java  |  1 -
 .../apache/jena/tdb/transaction/NodeTableTrans.java  |  2 +-
 .../org/apache/jena/tdb/transaction/Transaction.java |  5 +++--
 6 files changed, 12 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/8c742f51/jena-tdb/src/main/java/org/apache/jena/tdb/base/recordbuffer/RecordBufferPageMgr.java
----------------------------------------------------------------------
diff --git 
a/jena-tdb/src/main/java/org/apache/jena/tdb/base/recordbuffer/RecordBufferPageMgr.java
 
b/jena-tdb/src/main/java/org/apache/jena/tdb/base/recordbuffer/RecordBufferPageMgr.java
index 80b9eab..8bd3de6 100644
--- 
a/jena-tdb/src/main/java/org/apache/jena/tdb/base/recordbuffer/RecordBufferPageMgr.java
+++ 
b/jena-tdb/src/main/java/org/apache/jena/tdb/base/recordbuffer/RecordBufferPageMgr.java
@@ -77,12 +77,9 @@ public class RecordBufferPageMgr extends 
PageBlockMgr<RecordBufferPage>
         @Override
         public RecordBufferPage fromBlock(Block block)
         {
-            synchronized (block)    // [[TxTDB:TODO] needed? Right place?
+            synchronized (block)    // Needed? Right place?
             {
                 RecordBufferPage rb = RecordBufferPage.format(block, factory) ;
-//                int count = block.getByteBuffer().getInt(COUNT) ;
-//                int linkId = block.getByteBuffer().getInt(LINK) ;
-//                RecordBufferPage rb = new RecordBufferPage(block, linkId, 
factory, count) ;
                 return rb ;
             }
         }

http://git-wip-us.apache.org/repos/asf/jena/blob/8c742f51/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/BlockMgrJournal.java
----------------------------------------------------------------------
diff --git 
a/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/BlockMgrJournal.java 
b/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/BlockMgrJournal.java
index 7a15c54..89ab95d 100644
--- 
a/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/BlockMgrJournal.java
+++ 
b/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/BlockMgrJournal.java
@@ -41,6 +41,12 @@ import org.apache.jena.tdb.sys.SystemTDB ;
 import org.slf4j.Logger ;
 import org.slf4j.LoggerFactory ;
 
+/**
+ * Block manager that keeps temporary copies of updated blocks, then writes 
then
+ * to a journal when commitPrepare happens. No work is done in commitEnact
+ * because the {@link TransactionManager} is responsible to writing 
+ * the blocks to the main storage.
+ */
 public class BlockMgrJournal implements BlockMgr, TransactionLifecycle
 {
     private static Logger log = LoggerFactory.getLogger(BlockMgrJournal.class) 
;
@@ -55,24 +61,18 @@ public class BlockMgrJournal implements BlockMgr, 
TransactionLifecycle
     private final Map<Long, Block> writeBlocks = new HashMap<>() ;
     private final Map<Long, Block> freedBlocks = new HashMap<>() ;
     private boolean closed  = false ;
-    private boolean active  = false ;   // In a transaction, or preparing.
+    private boolean active  = false ;   // In the transaction, from begin to 
commitPrepare.
     
     public BlockMgrJournal(Transaction txn, FileRef fileRef, BlockMgr 
underlyingBlockMgr)
     {
         Context context = txn.getBaseDataset().getContext() ;
         String mode = (null != context) ? (String) 
context.get(TDB.transactionJournalWriteBlockMode, "") : "" ;
         if ("direct".equalsIgnoreCase(mode))
-        {
             writeBlockBufferAllocator = new BufferAllocatorDirect() ;
-        }
         else if ("mapped".equalsIgnoreCase(mode))
-        {
             writeBlockBufferAllocator = new 
BufferAllocatorMapped(SystemTDB.BlockSize) ;
-        }
         else
-        {
             writeBlockBufferAllocator = new BufferAllocatorMem() ;
-        }
         
         reset(txn, fileRef, underlyingBlockMgr) ;
         if ( txn.getMode() == ReadWrite.READ &&  underlyingBlockMgr instanceof 
BlockMgrJournal )
@@ -142,7 +142,6 @@ public class BlockMgrJournal implements BlockMgr, 
TransactionLifecycle
         // Might as well allocate now. 
         // This allocates the id.
         Block block = blockMgr.allocate(blockSize) ;
-        // [TxTDB:TODO]
         // But we "copy" it by allocating ByteBuffer space.
         if ( active ) 
         {

http://git-wip-us.apache.org/repos/asf/jena/blob/8c742f51/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/Journal.java
----------------------------------------------------------------------
diff --git 
a/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/Journal.java 
b/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/Journal.java
index dd49703..3c53fce 100644
--- a/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/Journal.java
+++ b/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/Journal.java
@@ -48,9 +48,6 @@ class Journal implements Sync, Closeable
 {
     private static Logger log = LoggerFactory.getLogger(Journal.class) ;
     
-    // Version 1 : issue might be excessive copying
-    // [TxTDB:TODO] Caching
-    
     // Why synchronized?
     // Object handling - avoid length twice. 
     
@@ -118,9 +115,6 @@ class Journal implements Sync, Closeable
         int bufferCapacity = 0 ; 
         int len = 0 ;
         
-        // [TxDEV:TODO] compress
-        // [TxDEV:TODO] Work in blocks - block asn remember, reset 
position/limit.
-        
         if ( buffer != null )
         {
             bufferCapacity = buffer.capacity() ;

http://git-wip-us.apache.org/repos/asf/jena/blob/8c742f51/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/JournalControl.java
----------------------------------------------------------------------
diff --git 
a/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/JournalControl.java 
b/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/JournalControl.java
index c06cfd3..ec9b5fa 100644
--- a/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/JournalControl.java
+++ b/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/JournalControl.java
@@ -194,7 +194,6 @@ public class JournalControl
     private static void recoverNodeDat(DatasetGraphTDB dsg, FileRef fileRef)
     {
         // See DatasetBuilderTxn - same name generation code.
-        // [TxTDB:TODO]
         
         RecordFactory recordFactory = new RecordFactory(SystemTDB.LenNodeHash, 
SystemTDB.SizeOfNodeId) ;
         NodeTable baseNodeTable = dsg.getConfig().nodeTables.get(fileRef) ;

http://git-wip-us.apache.org/repos/asf/jena/blob/8c742f51/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/NodeTableTrans.java
----------------------------------------------------------------------
diff --git 
a/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/NodeTableTrans.java 
b/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/NodeTableTrans.java
index b1fdaee..f8090d2 100644
--- a/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/NodeTableTrans.java
+++ b/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/NodeTableTrans.java
@@ -47,7 +47,7 @@ public class NodeTableTrans implements NodeTable, 
TransactionLifecycle
     private long allocOffset ;
     
     private NodeTable nodeTableJournal = null ;
-    private static int CacheSize = 10000 ;      // [TxTDB:TODO] Make 
configurable 
+    private static int CacheSize = 10000 ;      // Make configurable 
     private boolean passthrough = false ;
     
     private Index nodeIndex ;

http://git-wip-us.apache.org/repos/asf/jena/blob/8c742f51/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/Transaction.java
----------------------------------------------------------------------
diff --git 
a/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/Transaction.java 
b/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/Transaction.java
index 402ddb3..5bfd6f0 100644
--- a/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/Transaction.java
+++ b/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/Transaction.java
@@ -129,7 +129,9 @@ public class Transaction
                     
                     try {
                         journal.write(JournalEntryType.Commit, 
FileRef.Journal, null) ;
-                        journal.sync() ;        // Commit point.
+                        // **** COMMIT POINT
+                        journal.sync() ;
+                        // **** COMMIT POINT
                     } catch (RuntimeException ex) {
                         // It either did all commit or didn't but we don't 
know which.
                         // Some low level system error - probably a sign of 
something
@@ -203,7 +205,6 @@ public class Transaction
                     }
                     state = TxnState.ABORTED ;
                     outcome = TxnOutcome.W_ABORTED ;
-                    // [TxTDB:TODO]
                     // journal.truncate to last commit
                     // Not need currently as the journal is only written in
                     // prepare.

Reply via email to