Package org.apache.hadoop.hbase.io.hfile

Examples of org.apache.hadoop.hbase.io.hfile.Cacheable


          if (lenRead != len) {
            throw new RuntimeException("Only " + lenRead + " bytes read, " + len + " expected");
          }
          CacheableDeserializer<Cacheable> deserializer =
            bucketEntry.deserializerReference(this.deserialiserMap);
          Cacheable cachedBlock = deserializer.deserialize(bb, true);
          long timeTaken = System.nanoTime() - start;
          if (updateCacheMetrics) {
            cacheStats.hit(caching);
            cacheStats.ioHit(timeTaken);
          }
View Full Code Here


   * Manually run the WriterThread.
   * @throws InterruptedException
   */
  @Test
  public void testTooBigEntry() throws InterruptedException {
    Cacheable tooBigCacheable = Mockito.mock(Cacheable.class);
    Mockito.when(tooBigCacheable.getSerializedLength()).thenReturn(Integer.MAX_VALUE);
    this.bc.cacheBlock(this.plainKey, tooBigCacheable);
    doDrainOfOneEntry(this.bc, this.wt, this.q);
  }
View Full Code Here

          if (lenRead != len) {
            throw new RuntimeException("Only " + lenRead + " bytes read, " + len + " expected");
          }
          CacheableDeserializer<Cacheable> deserializer =
            bucketEntry.deserializerReference(this.deserialiserMap);
          Cacheable cachedBlock = deserializer.deserialize(bb, true);
          long timeTaken = System.nanoTime() - start;
          if (updateCacheMetrics) {
            cacheStats.hit(caching);
            cacheStats.ioHit(timeTaken);
          }
View Full Code Here

          if (lenRead != len) {
            throw new RuntimeException("Only " + lenRead + " bytes read, " + len + " expected");
          }
          CacheableDeserializer<Cacheable> deserializer =
            bucketEntry.deserializerReference(this.deserialiserMap);
          Cacheable cachedBlock = deserializer.deserialize(bb, true);
          long timeTaken = System.nanoTime() - start;
          if (updateCacheMetrics) {
            cacheStats.hit(caching);
            cacheStats.ioHit(timeTaken);
          }
View Full Code Here

    if (cachedBlock == null) {
      if (!repeat) stats.miss(caching);
      return null;
    }

    Cacheable contentBlock = cachedBlock.getBlock(key, caching, false);

    if (contentBlock != null) {
      stats.hit(caching);
    } else if (!repeat) {
      stats.miss(caching);
View Full Code Here

          ByteBuffer bb = ByteBuffer.allocate(len);
          int lenRead = ioEngine.read(bb, bucketEntry.offset());
          if (lenRead != len) {
            throw new RuntimeException("Only " + lenRead + " bytes read, " + len + " expected");
          }
          Cacheable cachedBlock = bucketEntry.deserializerReference(
              deserialiserMap).deserialize(bb, true);
          long timeTaken = System.nanoTime() - start;
          cacheStats.hit(caching);
          cacheStats.ioHit(timeTaken);
          bucketEntry.access(accessCount.incrementAndGet());
View Full Code Here

          if (lenRead != len) {
            throw new RuntimeException("Only " + lenRead + " bytes read, " + len + " expected");
          }
          CacheableDeserializer<Cacheable> deserializer =
            bucketEntry.deserializerReference(this.deserialiserMap);
          Cacheable cachedBlock = deserializer.deserialize(bb, true);
          long timeTaken = System.nanoTime() - start;
          if (updateCacheMetrics) {
            cacheStats.hit(caching);
            cacheStats.ioHit(timeTaken);
          }
View Full Code Here

    if (cachedBlock == null) {
      stats.miss(caching);
      return null;
    }

    Cacheable contentBlock = cachedBlock.getBlock(key, caching);

    if (contentBlock != null) {
      stats.hit(caching);
    } else {
      stats.miss(caching);
View Full Code Here

    if (cachedBlock == null) {
      if (!repeat) stats.miss(caching);
      return null;
    }

    Cacheable contentBlock = cachedBlock.getBlock(key, caching, false, updateCacheMetrics);

    if (contentBlock != null) {
      if (updateCacheMetrics) stats.hit(caching);
    } else if (!repeat) {
      if (updateCacheMetrics) stats.miss(caching);
View Full Code Here

      }

      @Override
      public CachedBlock next() {
        final Map.Entry<BlockCacheKey, SingleSizeCache> e = i.next();
        final Cacheable cacheable = e.getValue().getBlock(e.getKey(), false, false, false);
        return new CachedBlock() {
          @Override
          public String toString() {
            return BlockCacheUtil.toString(this, now);
          }

          @Override
          public BlockPriority getBlockPriority() {
            return null;
          }

          @Override
          public BlockType getBlockType() {
            return cacheable.getBlockType();
          }

          @Override
          public long getOffset() {
            return e.getKey().getOffset();
          }

          @Override
          public long getSize() {
            return cacheable == null? 0: cacheable.getSerializedLength();
          }

          @Override
          public long getCachedTime() {
            return -1;
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hbase.io.hfile.Cacheable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.