Author: amitj
Date: Fri Dec 14 03:41:40 2018
New Revision: 1848909

URL: http://svn.apache.org/viewvc?rev=1848909&view=rev
Log:
OAK-7951: Datastore GC stats not updated with failure when "Not all 
repositories have marked references available"

Merge r1848822,r1848823 from trunk

Added:
    
jackrabbit/oak/branches/1.6/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/blob/SharedDataStoreMarkSweepGarbageCollectorTest.java
   (with props)
Modified:
    jackrabbit/oak/branches/1.6/   (props changed)
    
jackrabbit/oak/branches/1.6/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/blob/MarkSweepGarbageCollector.java
    
jackrabbit/oak/branches/1.6/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/SharedBlobStoreGCTest.java

Propchange: jackrabbit/oak/branches/1.6/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Dec 14 03:41:40 2018
@@ -1,4 +1,4 @@
 /jackrabbit/oak/branches/1.0:1665962
 /jackrabbit/oak/branches/1.8:1844835
-/jackrabbit/oak/trunk:1781068,1781075,1781248,1781386,1781846,1781907,1782000,1782029,1782196,1782447,1782476,1782770,1782945,1782966,1782973,1782990,1783061,1783066,1783089,1783104-1783105,1783110,1783619,1783720,1783731,1783733,1783738,1783742,1783773,1783855,1783891,1784023,1784034,1784130,1784162,1784251,1784401,1784551,1784574,1784689,1785095,1785108,1785161,1785172,1785283,1785652,1785838,1785916-1785917,1785919,1785946,1786122,1787074,1787145,1787151,1787217,1787425,1788056,1788378,1788387-1788389,1788463,1788476,1788850,1789056,1789534,1789925,1789940,1789987,1790006,1790013,1790069,1790077,1790079,1790382,1790502-1790503,1792049,1792463,1792742,1792746,1793013,1793088,1793618,1793627,1793644,1794393,1794417,1794683,1795138,1795314,1795330,1795475,1795488,1795491,1795502,1795594,1795613,1795618,1796144,1796230,1796239,1796274,1796278,1796988,1797378,1798035,1798832,1798834,1799219,1799389,1799393,1799924,1800244,1800269,1800606,1800613,1800974,1801011,1801013,1801118-1801119
 
,1801675,1802260,1802262,1802286,1802548,1802905,1802934,1802938,1802973,1803026,1803247-1803249,1803951,1803953-1803955,1804437,1805851-1805852,1806668,1807308,1807688,1808022,1808053,1808125,1808128,1808142,1808240,1808246,1808731,1809024,1809026,1809131,1809163,1809178-1809179,1809253,1809255-1809256,1809289,1809745,1811071-1811072,1811155,1811380,1811655,1811952,1811963,1811986,1813192,1813538,1814052,1814189,1814332,1814397,1814475,1815201,1815438,1815926,1816019,1817326,1817919,1817987-1817988,1817990,1818038,1818042,1818056,1818124,1818137,1818554,1818576,1818645,1819048,1819050,1821237,1821325,1821358,1821495,1821516,1821847,1822207,1822850,1823172,1823655,1824896,1825471,1825654,1826237,1826338,1826532,1826640,1826932,1826957,1827472,1827486,1827977,1828502,1829527,1829569,1829587,1829665,1829854,1829864,1829987,1829998,1830019,1830160,1830239,1830748,1831190,1831374,1832258,1832379,1832535,1833308,1834112,1834648-1834649,1834681,1835060,1835780,1836082,1837475,1837998,1838
 
637,1839746,1840024,1840226,1842677,1843175,1843222,1843231,1844549,1844642,1844728,1845135,1845405,1845415,1845730-1845731,1845863,1845865,1846057,1846617,1848181-1848182,1848191,1848217
+/jackrabbit/oak/trunk:1781068,1781075,1781248,1781386,1781846,1781907,1782000,1782029,1782196,1782447,1782476,1782770,1782945,1782966,1782973,1782990,1783061,1783066,1783089,1783104-1783105,1783110,1783619,1783720,1783731,1783733,1783738,1783742,1783773,1783855,1783891,1784023,1784034,1784130,1784162,1784251,1784401,1784551,1784574,1784689,1785095,1785108,1785161,1785172,1785283,1785652,1785838,1785916-1785917,1785919,1785946,1786122,1787074,1787145,1787151,1787217,1787425,1788056,1788378,1788387-1788389,1788463,1788476,1788850,1789056,1789534,1789925,1789940,1789987,1790006,1790013,1790069,1790077,1790079,1790382,1790502-1790503,1792049,1792463,1792742,1792746,1793013,1793088,1793618,1793627,1793644,1794393,1794417,1794683,1795138,1795314,1795330,1795475,1795488,1795491,1795502,1795594,1795613,1795618,1796144,1796230,1796239,1796274,1796278,1796988,1797378,1798035,1798832,1798834,1799219,1799389,1799393,1799924,1800244,1800269,1800606,1800613,1800974,1801011,1801013,1801118-1801119
 
,1801675,1802260,1802262,1802286,1802548,1802905,1802934,1802938,1802973,1803026,1803247-1803249,1803951,1803953-1803955,1804437,1805851-1805852,1806668,1807308,1807688,1808022,1808053,1808125,1808128,1808142,1808240,1808246,1808731,1809024,1809026,1809131,1809163,1809178-1809179,1809253,1809255-1809256,1809289,1809745,1811071-1811072,1811155,1811380,1811655,1811952,1811963,1811986,1813192,1813538,1814052,1814189,1814332,1814397,1814475,1815201,1815438,1815926,1816019,1817326,1817919,1817987-1817988,1817990,1818038,1818042,1818056,1818124,1818137,1818554,1818576,1818645,1819048,1819050,1821237,1821325,1821358,1821495,1821516,1821847,1822207,1822850,1823172,1823655,1824896,1825471,1825654,1826237,1826338,1826532,1826640,1826932,1826957,1827472,1827486,1827977,1828502,1829527,1829569,1829587,1829665,1829854,1829864,1829987,1829998,1830019,1830160,1830239,1830748,1831190,1831374,1832258,1832379,1832535,1833308,1834112,1834648-1834649,1834681,1835060,1835780,1836082,1837475,1837998,1838
 
637,1839746,1840024,1840226,1842677,1843175,1843222,1843231,1844549,1844642,1844728,1845135,1845405,1845415,1845730-1845731,1845863,1845865,1846057,1846617,1848181-1848182,1848191,1848217,1848822-1848823
 /jackrabbit/trunk:1345480

Modified: 
jackrabbit/oak/branches/1.6/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/blob/MarkSweepGarbageCollector.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.6/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/blob/MarkSweepGarbageCollector.java?rev=1848909&r1=1848908&r2=1848909&view=diff
==============================================================================
--- 
jackrabbit/oak/branches/1.6/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/blob/MarkSweepGarbageCollector.java
 (original)
+++ 
jackrabbit/oak/branches/1.6/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/blob/MarkSweepGarbageCollector.java
 Fri Dec 14 03:41:40 2018
@@ -71,10 +71,10 @@ import static org.apache.jackrabbit.oak.
 
 /**
  * Mark and sweep garbage collector.
- * 
+ *
  * Uses the file system to store internal state while in process to account 
for huge data.
  * This class is not thread safe.
- * 
+ *
  */
 public class MarkSweepGarbageCollector implements BlobGarbageCollector {
 
@@ -83,7 +83,7 @@ public class MarkSweepGarbageCollector i
     public static final String TEMP_DIR = 
StandardSystemProperty.JAVA_IO_TMPDIR.value();
 
     public static final int DEFAULT_BATCH_COUNT = 1024;
-    
+
     public static final String DELIM = ",";
 
     private static final Function<String, String> transformer = new 
Function<String, String>() {
@@ -180,7 +180,7 @@ public class MarkSweepGarbageCollector i
 
     /**
      * Returns the stats related to GC for all repos
-     * 
+     *
      * @return a list of GarbageCollectionRepoStats objects
      * @throws Exception
      */
@@ -192,12 +192,12 @@ public class MarkSweepGarbageCollector i
             List<DataRecord> refFiles =
                 ((SharedDataStore) 
blobStore).getAllMetadataRecords(SharedStoreRecordType.REFERENCES.getType());
             Map<String, DataRecord> references = Maps.uniqueIndex(refFiles, 
new Function<DataRecord, String>() {
-                @Override 
+                @Override
                 public String apply(DataRecord input) {
                     return 
SharedStoreRecordType.REFERENCES.getIdFromName(input.getIdentifier().toString());
                 }
             });
-    
+
             // Get all the markers available
             List<DataRecord> markerFiles =
                 ((SharedDataStore) 
blobStore).getAllMetadataRecords(SharedStoreRecordType.MARKED_START_MARKER.getType());
@@ -207,11 +207,11 @@ public class MarkSweepGarbageCollector i
                     return 
SharedStoreRecordType.MARKED_START_MARKER.getIdFromName(input.getIdentifier().toString());
                 }
             });
-            
+
             // Get all the repositories registered
             List<DataRecord> repoFiles =
                 ((SharedDataStore) 
blobStore).getAllMetadataRecords(SharedStoreRecordType.REPOSITORY.getType());
-    
+
             for (DataRecord repoRec : repoFiles) {
                 String id = 
SharedStoreRecordType.REFERENCES.getIdFromName(repoRec.getIdentifier().toString());
                 GarbageCollectionRepoStats stat = new 
GarbageCollectionRepoStats();
@@ -224,11 +224,11 @@ public class MarkSweepGarbageCollector i
                     DataRecord refRec = references.get(id);
                     stat.setEndTime(refRec.getLastModified());
                     stat.setLength(refRec.getLength());
-                    
+
                     if (markers.containsKey(id)) {
                         stat.setStartTime(markers.get(id).getLastModified());
                     }
-                    
+
                     LineNumberReader reader = null;
                     try {
                         reader = new LineNumberReader(new 
InputStreamReader(refRec.getStream()));
@@ -259,7 +259,7 @@ public class MarkSweepGarbageCollector i
         try {
             Stopwatch sw = Stopwatch.createStarted();
             LOG.info("Starting Blob garbage collection with markOnly [{}]", 
markOnly);
-            
+
             long markStart = System.currentTimeMillis();
             mark(fs);
             if (!markOnly) {
@@ -303,7 +303,7 @@ public class MarkSweepGarbageCollector i
 
     /**
      * Difference phase where the GC candidates are identified.
-     * 
+     *
      * @param fs the garbage collector file state
      * @throws IOException
      *             Signals that an I/O exception has occurred.
@@ -362,14 +362,10 @@ public class MarkSweepGarbageCollector i
         long earliestRefAvailTime;
         // Merge all the blob references available from all the reference 
files in the data store meta store
         // Only go ahead if merge succeeded
-        try {
-            earliestRefAvailTime =
-                    
GarbageCollectionType.get(blobStore).mergeAllMarkedReferences(blobStore, fs);
-            LOG.debug("Earliest reference available for timestamp [{}]", 
earliestRefAvailTime);
-            earliestRefAvailTime = (earliestRefAvailTime < markStart ? 
earliestRefAvailTime : markStart);
-        } catch (Exception e) {
-            return 0;
-        }
+        earliestRefAvailTime =
+                
GarbageCollectionType.get(blobStore).mergeAllMarkedReferences(blobStore, fs);
+        LOG.debug("Earliest reference available for timestamp [{}]", 
earliestRefAvailTime);
+        earliestRefAvailTime = (earliestRefAvailTime < markStart ? 
earliestRefAvailTime : markStart);
 
         // Find all blob references after iterating over the whole repository
         (new BlobIdRetriever(fs, forceBlobRetrieve)).call();
@@ -378,8 +374,8 @@ public class MarkSweepGarbageCollector i
         difference(fs);
         long count = 0;
         long deleted = 0;
-        
-        long lastMaxModifiedTime = 
getLastMaxModifiedTime(earliestRefAvailTime); 
+
+        long lastMaxModifiedTime = 
getLastMaxModifiedTime(earliestRefAvailTime);
         LOG.debug("Starting sweep phase of the garbage collector");
         LOG.debug("Sweeping blobs with modified time > than the configured max 
deleted time ({}). ",
                 timestampToString(lastMaxModifiedTime));
@@ -409,7 +405,7 @@ public class MarkSweepGarbageCollector i
         BlobCollectionType.get(blobStore).handleRemoves(blobStore, 
fs.getGarbage());
 
         if(count != deleted) {
-            LOG.warn("Deleted only [{}] blobs entries from the [{}] candidates 
identified. This may happen if blob " 
+            LOG.warn("Deleted only [{}] blobs entries from the [{}] candidates 
identified. This may happen if blob "
                          + "modified time is > "
                          + "than the max deleted time ({})", deleted, count,
                         timestampToString(lastMaxModifiedTime));
@@ -505,10 +501,10 @@ public class MarkSweepGarbageCollector i
             closeQuietly(writer);
         }
     }
-    
+
     /**
      * Checks for the DataStore consistency and reports the number of missing 
blobs still referenced.
-     * 
+     *
      * @return the missing blobs
      * @throws Exception
      */
@@ -517,18 +513,18 @@ public class MarkSweepGarbageCollector i
         boolean threw = true;
         GarbageCollectorFileState fs = new GarbageCollectorFileState(root);
         long candidates = 0;
-        
+
         try {
             LOG.info("Starting blob consistency check");
-    
+
             // Find all blobs available in the blob store
             ListenableFutureTask<Integer> blobIdRetriever = 
ListenableFutureTask.create(new BlobIdRetriever(fs,
                 true));
             executor.execute(blobIdRetriever);
-    
+
             // Mark all used blob references
             iterateNodeTree(fs, true);
-            
+
             try {
                 blobIdRetriever.get();
             } catch (ExecutionException e) {
@@ -536,7 +532,7 @@ public class MarkSweepGarbageCollector i
                 threw = false;
                 throw e;
             }
-            
+
             LOG.trace("Starting difference phase of the consistency check");
             FileLineDifferenceIterator iter = new FileLineDifferenceIterator(
                 fs.getAvailableRefs(),
@@ -544,7 +540,7 @@ public class MarkSweepGarbageCollector i
                 transformer);
             candidates = FileIOUtils.writeStrings(iter, fs.getGcCandidates(), 
true);
             LOG.trace("Ending difference phase of the consistency check");
-            
+
             LOG.info("Consistency check found [{}] missing blobs", candidates);
             if (candidates > 0) {
                 LOG.warn("Consistency check failure in the the blob store : 
{}, check missing candidates in file {}",
@@ -568,7 +564,7 @@ public class MarkSweepGarbageCollector i
             this.fs = fs;
             this.forceRetrieve = forceBlobRetrieve;
         }
-    
+
         @Override
         public Integer call() throws Exception {
             if (!forceRetrieve) {
@@ -603,7 +599,7 @@ public class MarkSweepGarbageCollector i
         SHARED {
             /**
              * Remove the maked references and the marked markers from the 
blob store root. Default NOOP.
-             * 
+             *
              * @param blobStore the blobStore instance
              */
             @Override
@@ -614,7 +610,7 @@ public class MarkSweepGarbageCollector i
 
             /**
              * Merge all marked references available from all repositories and 
return the earliest time of the references.
-             * 
+             *
              * @param blobStore the blob store
              * @param fs the fs
              * @return the long the earliest time of the available references
@@ -645,7 +641,7 @@ public class MarkSweepGarbageCollector i
                     }
 
                     merge(files, fs.getMarkedRefs());
-                    
+
                     // Get the timestamp to indicate the earliest mark phase 
start
                     List<DataRecord> markerFiles =
                         ((SharedDataStore) blobStore).getAllMetadataRecords(
@@ -665,7 +661,7 @@ public class MarkSweepGarbageCollector i
 
             /**
              * Adds the marked references to the blob store root. Default NOOP
-             * 
+             *
              * @param blobStore the blob store
              * @param fs the fs
              * @param repoId the repo id
@@ -678,7 +674,7 @@ public class MarkSweepGarbageCollector i
                 ((SharedDataStore) blobStore)
                     .addMetadataRecord(fs.getMarkedRefs(), 
SharedStoreRecordType.REFERENCES.getNameFromId(repoId));
             }
-            
+
             @Override
             public void addMarkedStartMarker(GarbageCollectableBlobStore 
blobStore, String repoId) {
                 try {
@@ -713,7 +709,7 @@ public class MarkSweepGarbageCollector i
             }
             return DEFAULT;
         }
-    
+
         public void addMarkedStartMarker(GarbageCollectableBlobStore 
blobStore, String repoId) {}
     }
 

Added: 
jackrabbit/oak/branches/1.6/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/blob/SharedDataStoreMarkSweepGarbageCollectorTest.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.6/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/blob/SharedDataStoreMarkSweepGarbageCollectorTest.java?rev=1848909&view=auto
==============================================================================
--- 
jackrabbit/oak/branches/1.6/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/blob/SharedDataStoreMarkSweepGarbageCollectorTest.java
 (added)
+++ 
jackrabbit/oak/branches/1.6/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/blob/SharedDataStoreMarkSweepGarbageCollectorTest.java
 Fri Dec 14 03:41:40 2018
@@ -0,0 +1,115 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.jackrabbit.oak.plugins.blob;
+
+import com.google.common.collect.ImmutableList;
+import org.apache.jackrabbit.core.data.DataIdentifier;
+import org.apache.jackrabbit.core.data.DataRecord;
+import org.apache.jackrabbit.core.data.DataStoreException;
+import org.apache.jackrabbit.oak.plugins.blob.datastore.SharedDataStoreUtils;
+import org.apache.jackrabbit.oak.spi.blob.GarbageCollectableBlobStore;
+import org.hamcrest.CoreMatchers;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.util.List;
+import java.util.concurrent.Executor;
+
+import static 
org.apache.jackrabbit.oak.plugins.blob.SharedDataStore.Type.SHARED;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+@RunWith(MockitoJUnitRunner.class)
+public class SharedDataStoreMarkSweepGarbageCollectorTest {
+
+  @Mock
+  private Executor executor;
+
+  @Mock
+  private MockGarbageCollectableSharedDataStore blobStore;
+
+  @Mock
+  private BlobReferenceRetriever marker;
+
+  @Rule
+  public ExpectedException exception = ExpectedException.none();
+
+  private MarkSweepGarbageCollector collector;
+
+  @Before
+  public void setUp() throws IOException {
+    when(blobStore.getType()).thenReturn(SHARED);
+
+    collector = new MarkSweepGarbageCollector(
+      marker,
+      blobStore,
+      executor,
+      MarkSweepGarbageCollector.TEMP_DIR,
+      1,
+      0L,
+      "repo"
+    );
+  }
+
+  @Test
+  public void 
markAndSweepShouldFailIfNotAllRepositoriesHaveMarkedReferencesAvailable() 
throws Exception {
+    exception.expect(IOException.class);
+    exception.expectMessage(CoreMatchers.containsString("Not all repositories 
have marked references available"));
+
+    setupSharedDataRecords("REPO1", "REPO2");
+
+    collector.markAndSweep(false, true);
+  }
+
+  @Test
+  public void markAndSweepShouldSucceedWhenAllRepositoriesAreAvailable() 
throws Exception {
+    setupSharedDataRecords("REPO1", "REPO1");
+    
when(blobStore.getAllChunkIds(0L)).thenReturn(ImmutableList.<String>of().iterator());
+
+    collector.markAndSweep(false, true);
+  }
+
+  private void setupSharedDataRecords(final String refRepoId, final String 
repoRepoId) throws DataStoreException {
+    DataRecord refDataRecord = mock(DataRecord.class);
+    when(refDataRecord.getIdentifier()).thenReturn(new 
DataIdentifier("references-" + refRepoId));
+    when(refDataRecord.getStream()).thenReturn(new ByteArrayInputStream(new 
byte[0]));
+    when(refDataRecord.getLastModified()).thenReturn(10L);
+
+    DataRecord repoDataRecord = mock(DataRecord.class);
+    when(repoDataRecord.getIdentifier()).thenReturn(new 
DataIdentifier("repository-" + repoRepoId));
+
+    List<DataRecord> refs = ImmutableList.of(refDataRecord);
+    List<DataRecord> repos = ImmutableList.of(repoDataRecord);
+
+    
when(blobStore.getAllMetadataRecords(SharedDataStoreUtils.SharedStoreRecordType.REFERENCES.getType())).thenReturn(refs);
+    
when(blobStore.getAllMetadataRecords(SharedDataStoreUtils.SharedStoreRecordType.REPOSITORY.getType())).thenReturn(repos);
+    
when(blobStore.getAllMetadataRecords(SharedDataStoreUtils.SharedStoreRecordType.MARKED_START_MARKER.getType())).thenReturn(refs);
+  }
+
+  private interface MockGarbageCollectableSharedDataStore extends 
GarbageCollectableBlobStore, SharedDataStore {
+  }
+}

Propchange: 
jackrabbit/oak/branches/1.6/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/blob/SharedDataStoreMarkSweepGarbageCollectorTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: 
jackrabbit/oak/branches/1.6/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/SharedBlobStoreGCTest.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.6/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/SharedBlobStoreGCTest.java?rev=1848909&r1=1848908&r2=1848909&view=diff
==============================================================================
--- 
jackrabbit/oak/branches/1.6/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/SharedBlobStoreGCTest.java
 (original)
+++ 
jackrabbit/oak/branches/1.6/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/SharedBlobStoreGCTest.java
 Fri Dec 14 03:41:40 2018
@@ -64,6 +64,8 @@ import org.junit.rules.TemporaryFolder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import static org.junit.Assert.fail;
+
 /**
  * Test for gc in a shared data store among hetrogeneous oak node stores.
  */
@@ -162,15 +164,15 @@ public class SharedBlobStoreGCTest {
         // Only run the mark phase on both the clusters to get the stats
         cluster1.gc.collectGarbage(true);
         cluster2.gc.collectGarbage(true);
-    
+
         Set<String> actualRepoIds = Sets.newHashSet();
         actualRepoIds.add(cluster1.repoId);
         actualRepoIds.add(cluster2.repoId);
-    
+
         Set<Integer> actualNumBlobs = Sets.newHashSet();
         actualNumBlobs.add(cluster1.initBlobs.size());
         actualNumBlobs.add(cluster2.initBlobs.size());
-    
+
         List<GarbageCollectionRepoStats> statsList = cluster1.gc.getStats();
         Set<Integer> observedNumBlobs = Sets.newHashSet();
         Set<String> observedRepoIds = Sets.newHashSet();
@@ -182,7 +184,7 @@ public class SharedBlobStoreGCTest {
                 Assert.assertTrue(stat.isLocal());
             }
         }
-    
+
         Assert.assertTrue(Sets.difference(actualNumBlobs, 
observedNumBlobs).isEmpty());
         Assert.assertTrue(Sets.difference(actualRepoIds, 
observedRepoIds).isEmpty());
     }
@@ -196,7 +198,12 @@ public class SharedBlobStoreGCTest {
         cluster1.gc.collectGarbage(true);
 
         // Execute the gc with sweep
-        cluster1.gc.collectGarbage(false);
+        try {
+            cluster1.gc.collectGarbage(false);
+            fail("DSGC should fail");
+        } catch (IOException e) {
+            log.error("BlobGC threw exception", e);
+        }
 
         Set<String> existing = cluster1.getExistingBlobIds();
         log.debug("Existing blobs {}", existing);
@@ -260,7 +267,7 @@ public class SharedBlobStoreGCTest {
 
         /**
          * Creates the setup load with deletions.
-         * 
+         *
          * @throws Exception
          */
         public void init() throws Exception {
@@ -342,7 +349,7 @@ public class SharedBlobStoreGCTest {
         public Date getDate() {
             return startDate;
         }
-        
+
         public DocumentNodeStore getDocumentNodeStore() {
             return ds;
         }


Reply via email to