Should probably clear recently unloaded set when a tablets are loaded

On Mon, Oct 15, 2012 at 9:28 AM,  <[email protected]> wrote:
> Author: ecn
> Date: Mon Oct 15 13:28:25 2012
> New Revision: 1398283
>
> URL: http://svn.apache.org/viewvc?rev=1398283&view=rev
> Log:
> ACCUMULO-774 merge to 1.4 branch
>
> Added:
>     
> accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/tabletserver/SimpleLRUCache.java
>       - copied unchanged from r1398282, 
> accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/SimpleLRUCache.java
>     
> accumulo/branches/1.4/src/server/src/test/java/org/apache/accumulo/server/tabletserver/SimpleLRUCacheTest.java
>       - copied, changed from r1397990, 
> accumulo/trunk/server/src/test/java/org/apache/accumulo/server/tabletserver/SimpleLRUCacheTest.java
> Modified:
>     accumulo/branches/1.4/   (props changed)
>     accumulo/branches/1.4/src/   (props changed)
>     accumulo/branches/1.4/src/core/   (props changed)
>     accumulo/branches/1.4/src/server/   (props changed)
>     
> accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java
>
> Propchange: accumulo/branches/1.4/
> ------------------------------------------------------------------------------
>   Merged /accumulo/trunk:r1397928,1397975,1397990
>
> Propchange: accumulo/branches/1.4/src/
> ------------------------------------------------------------------------------
>   Merged /accumulo/trunk/src:r1397928,1397975,1397990
>   Merged /accumulo/trunk:r1397928,1397975,1397990,1398090
>
> Propchange: accumulo/branches/1.4/src/core/
> ------------------------------------------------------------------------------
>   Merged /accumulo/trunk/src/core:r1397928,1397975,1397990
>   Merged /accumulo/trunk/core:r1397928,1397975,1397990,1398090
>
> Propchange: accumulo/branches/1.4/src/server/
> ------------------------------------------------------------------------------
>   Merged /accumulo/trunk/src/server:r1397928,1397975,1397990
>   Merged /accumulo/trunk/server:r1397928,1397975,1397990,1398090
>
> Modified: 
> accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java
> URL: 
> http://svn.apache.org/viewvc/accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java?rev=1398283&r1=1398282&r2=1398283&view=diff
> ==============================================================================
> --- 
> accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java
>  (original)
> +++ 
> accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java
>  Mon Oct 15 13:28:25 2012
> @@ -2258,8 +2258,10 @@ public class TabletServer extends Abstra
>        if (t == null) {
>          // Tablet has probably been recently unloaded: repeated master
>          // unload request is crossing the successful unloaded message
> -        log.info("told to unload tablet that was not being served " + 
> extent);
> -        enqueueMasterMessage(new 
> TabletStatusMessage(TabletLoadState.UNLOAD_FAILURE_NOT_SERVING, extent));
> +        if (!recentlyUnloadedCache.contains(extent)) {
> +          log.info("told to unload tablet that was not being served " + 
> extent);
> +          enqueueMasterMessage(new 
> TabletStatusMessage(TabletLoadState.UNLOAD_FAILURE_NOT_SERVING, extent));
> +        }
>          return;
>        }
>
> @@ -2279,6 +2281,7 @@ public class TabletServer extends Abstra
>
>        // stop serving tablet - client will get not serving tablet
>        // exceptions
> +      recentlyUnloadedCache.add(extent);
>        onlineTablets.remove(extent);
>
>        try {
> @@ -2501,6 +2504,7 @@ public class TabletServer extends Abstra
>    private SortedMap<KeyExtent,Tablet> onlineTablets = 
> Collections.synchronizedSortedMap(new TreeMap<KeyExtent,Tablet>());
>    private SortedSet<KeyExtent> unopenedTablets = 
> Collections.synchronizedSortedSet(new TreeSet<KeyExtent>());
>    private SortedSet<KeyExtent> openingTablets = 
> Collections.synchronizedSortedSet(new TreeSet<KeyExtent>());
> +  private Set<KeyExtent> recentlyUnloadedCache = 
> Collections.synchronizedSet(new SimpleLRUCache<KeyExtent>(10));
>
>    private Thread majorCompactorThread;
>
>
> Copied: 
> accumulo/branches/1.4/src/server/src/test/java/org/apache/accumulo/server/tabletserver/SimpleLRUCacheTest.java
>  (from r1397990, 
> accumulo/trunk/server/src/test/java/org/apache/accumulo/server/tabletserver/SimpleLRUCacheTest.java)
> URL: 
> http://svn.apache.org/viewvc/accumulo/branches/1.4/src/server/src/test/java/org/apache/accumulo/server/tabletserver/SimpleLRUCacheTest.java?p2=accumulo/branches/1.4/src/server/src/test/java/org/apache/accumulo/server/tabletserver/SimpleLRUCacheTest.java&p1=accumulo/trunk/server/src/test/java/org/apache/accumulo/server/tabletserver/SimpleLRUCacheTest.java&r1=1397990&r2=1398283&rev=1398283&view=diff
> ==============================================================================
> --- 
> accumulo/trunk/server/src/test/java/org/apache/accumulo/server/tabletserver/SimpleLRUCacheTest.java
>  (original)
> +++ 
> accumulo/branches/1.4/src/server/src/test/java/org/apache/accumulo/server/tabletserver/SimpleLRUCacheTest.java
>  Mon Oct 15 13:28:25 2012
> @@ -21,7 +21,7 @@ import static org.junit.Assert.*;
>  import org.junit.Test;
>
>  public class SimpleLRUCacheTest {
> -
> +
>    @Test
>    public void test() {
>      SimpleLRUCache<Integer> test = new SimpleLRUCache<Integer>(4);
> @@ -34,5 +34,11 @@ public class SimpleLRUCacheTest {
>      test.add(3);
>      test.add(4);
>      assertFalse(test.contains(0));
> +    test.add(2);
> +    test.add(2);
> +    test.add(2);
> +    test.add(2);
> +    assertTrue(test.contains(3));
> +    assertTrue(test.contains(4));
>    }
>  }
>
>

Reply via email to