public IndexOperation peekNext() throws AnalyticsException {
   try {
     byte[] data;
     if (this.secondaryProcessedCount < this.secondaryQueueInitialCount) {
       /* the following will not end up in strict FIFO, but it's
        * rare that the secondary queue processing will also fail,
        * and even when that happens, it's unlikely you need strict
        * ordered retrieval of records then */
       data = this.secondaryQueue.peek();
       this.secondaryQueue.enqueue(data);
       this.secondaryQueue.dequeue();
     } else {
       data = this.primaryQueue.peek();
       this.secondaryQueue.enqueue(data);
       this.primaryQueue.dequeue();
     }
     this.secondaryProcessedCount++;
     IndexOperation indexOp = IndexOperation.fromBytes(data);
     this.removedDataSize += indexOp.getByteSize();
     if (this.removedDataSize > QUEUE_CLEANUP_THRESHOLD) {
       this.primaryQueue.gc();
       this.secondaryQueue.gc();
       this.removedDataSize = 0;
       if (log.isDebugEnabled()) {
         log.debug("Queue GC: " + this.primaryQueue + "|" + this.secondaryQueue);
       }
     }
     return indexOp;
   } catch (IOException e) {
     throw new AnalyticsException("Error in index data peekNext: " + e.getMessage(), e);
   }
 }