You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stanbol.apache.org by su...@apache.org on 2012/07/30 16:31:46 UTC

svn commit: r1367105 - in /incubator/stanbol/branches/contenthub-two-layered-structure/contenthub: index/src/main/java/org/apache/stanbol/contenthub/index/ldpath/ revisionmanager/src/main/java/org/apache/stanbol/contenthub/revisionmanager/ store/file/s...

Author: suat
Date: Mon Jul 30 14:31:46 2012
New Revision: 1367105

URL: http://svn.apache.org/viewvc?rev=1367105&view=rev
Log:
STANBOL-498: 
-Called truncateTable() method in RevisionManager only when the epoch of the Store is updated
-Some logging

Modified:
    incubator/stanbol/branches/contenthub-two-layered-structure/contenthub/index/src/main/java/org/apache/stanbol/contenthub/index/ldpath/LDPathSemanticIndex.java
    incubator/stanbol/branches/contenthub-two-layered-structure/contenthub/revisionmanager/src/main/java/org/apache/stanbol/contenthub/revisionmanager/RevisionManager.java
    incubator/stanbol/branches/contenthub-two-layered-structure/contenthub/store/file/src/main/java/org/apache/stanbol/contenthub/store/file/FileStore.java

Modified: incubator/stanbol/branches/contenthub-two-layered-structure/contenthub/index/src/main/java/org/apache/stanbol/contenthub/index/ldpath/LDPathSemanticIndex.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/branches/contenthub-two-layered-structure/contenthub/index/src/main/java/org/apache/stanbol/contenthub/index/ldpath/LDPathSemanticIndex.java?rev=1367105&r1=1367104&r2=1367105&view=diff
==============================================================================
--- incubator/stanbol/branches/contenthub-two-layered-structure/contenthub/index/src/main/java/org/apache/stanbol/contenthub/index/ldpath/LDPathSemanticIndex.java (original)
+++ incubator/stanbol/branches/contenthub-two-layered-structure/contenthub/index/src/main/java/org/apache/stanbol/contenthub/index/ldpath/LDPathSemanticIndex.java Mon Jul 30 14:31:46 2012
@@ -924,8 +924,9 @@ public class LDPathSemanticIndex impleme
                     changeSet = store.changes(store.getEpoch(), revision, batchSize);
                 } catch (StoreException e) {
                     logger.error(
-                        "Failed to get changes from FileRevisionManager with start revision: {} and batch size: {}",
-                        revision, batchSize);
+                        String.format(
+                            "Failed to get changes from FileRevisionManager with start revision: %s and batch size: %s for Store: %s",
+                            revision, batchSize, store.getName()), e);
                 }
                 if (changeSet != null) {
                     Iterator<String> changedItems = changeSet.iterator();

Modified: incubator/stanbol/branches/contenthub-two-layered-structure/contenthub/revisionmanager/src/main/java/org/apache/stanbol/contenthub/revisionmanager/RevisionManager.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/branches/contenthub-two-layered-structure/contenthub/revisionmanager/src/main/java/org/apache/stanbol/contenthub/revisionmanager/RevisionManager.java?rev=1367105&r1=1367104&r2=1367105&view=diff
==============================================================================
--- incubator/stanbol/branches/contenthub-two-layered-structure/contenthub/revisionmanager/src/main/java/org/apache/stanbol/contenthub/revisionmanager/RevisionManager.java (original)
+++ incubator/stanbol/branches/contenthub-two-layered-structure/contenthub/revisionmanager/src/main/java/org/apache/stanbol/contenthub/revisionmanager/RevisionManager.java Mon Jul 30 14:31:46 2012
@@ -250,8 +250,6 @@ public class RevisionManager {
 
     private <Item> void updateEpoch(Store<Item> store, boolean insert) throws StoreException {
         String storeID = getStoreID(store);
-        // truncate the revision table
-        dbManager.truncateTable(storeID);
 
         // get connection
         Connection con = dbManager.getConnection();
@@ -261,6 +259,9 @@ public class RevisionManager {
         try {
             long newEpoch = System.currentTimeMillis();
             if (!insert) {
+                // truncate the revision table
+                dbManager.truncateTable(storeID);
+
                 log.debug("New epoch: {} for the Store: {} will be updated", newEpoch, storeID);
                 ps = con.prepareStatement(UPDATE_EPOCH);
             } else {
@@ -276,7 +277,6 @@ public class RevisionManager {
                     }
 
                 } catch (SQLException e) {
-                    dbManager.closeConnection(con);
                     log.error("Failed to query revision of content item", e);
                     throw new StoreException("Failed to query revision of content item", e);
                 } finally {
@@ -284,12 +284,12 @@ public class RevisionManager {
                     dbManager.closeStatement(ps);
                 }
 
-                if (recordExist) {
+                if (!recordExist) {
                     log.debug("New epoch: {} for the Store: {} will be added", newEpoch, storeID);
                     ps = con.prepareStatement(INSERT_EPOCH);
                 } else {
-                    // if there already exists an entry in the "epochTable" for the given store, return from
-                    // the method
+                    // if there already exists an entry in the "epochTable"
+                    // for the given store, return from the method
                     return;
                 }
             }

Modified: incubator/stanbol/branches/contenthub-two-layered-structure/contenthub/store/file/src/main/java/org/apache/stanbol/contenthub/store/file/FileStore.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/branches/contenthub-two-layered-structure/contenthub/store/file/src/main/java/org/apache/stanbol/contenthub/store/file/FileStore.java?rev=1367105&r1=1367104&r2=1367105&view=diff
==============================================================================
--- incubator/stanbol/branches/contenthub-two-layered-structure/contenthub/store/file/src/main/java/org/apache/stanbol/contenthub/store/file/FileStore.java (original)
+++ incubator/stanbol/branches/contenthub-two-layered-structure/contenthub/store/file/src/main/java/org/apache/stanbol/contenthub/store/file/FileStore.java Mon Jul 30 14:31:46 2012
@@ -271,7 +271,8 @@ public class FileStore implements Store<
             if (rs.next()) {
                 epoch = rs.getLong(1);
             } else {
-                throw new StoreException(String.format("There is no an epoch record for the Store: %s",
+                log.error(String.format("There is not an epoch record for the Store: %s", getName()));
+                throw new StoreException(String.format("There is not an epoch record for the Store: %s",
                     getName()));
             }