Class SnapshotDefragService

java.lang.Object
org.apache.hadoop.hdds.utils.BackgroundService
org.apache.hadoop.ozone.om.SnapshotDefragService
All Implemented Interfaces:
org.apache.hadoop.ozone.lock.BootstrapStateHandler

public class SnapshotDefragService extends org.apache.hadoop.hdds.utils.BackgroundService implements org.apache.hadoop.ozone.lock.BootstrapStateHandler
Background service for defragmenting snapshots in the active snapshot chain. When snapshots are taken, they capture the entire OM RocksDB state but may contain fragmented data. This service defragments snapshots by creating new compacted RocksDB instances with only the necessary data for tracked column families.

The service processes snapshots in the active chain sequentially, starting with the first non-defragmented snapshot. For the first snapshot in the chain, it performs a full defragmentation by copying all keys. For subsequent snapshots, it uses incremental defragmentation based on diffs from the previous defragmented snapshot.

  • Nested Class Summary

    Nested classes/interfaces inherited from class org.apache.hadoop.hdds.utils.BackgroundService

    org.apache.hadoop.hdds.utils.BackgroundService.PeriodicalTask

    Nested classes/interfaces inherited from interface org.apache.hadoop.ozone.lock.BootstrapStateHandler

    org.apache.hadoop.ozone.lock.BootstrapStateHandler.Lock
  • Constructor Summary

    Constructors
    Constructor
    Description
    SnapshotDefragService(long interval, TimeUnit unit, long serviceTimeout, OzoneManager ozoneManager, org.apache.hadoop.hdds.conf.OzoneConfiguration configuration)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.apache.hadoop.ozone.lock.BootstrapStateHandler.Lock
     
     
    org.apache.hadoop.hdds.utils.BackgroundTaskQueue
     
    void
     
    void
     
    void
     
    void
     
    boolean
     

    Methods inherited from class org.apache.hadoop.hdds.utils.BackgroundService

    execTaskCompletion, getExecutorService, getFuture, getIntervalMillis, getThreadCount, runPeriodicalTaskNow, setInterval, setPoolSize, setServiceTimeoutInNanos

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SnapshotDefragService

      public SnapshotDefragService(long interval, TimeUnit unit, long serviceTimeout, OzoneManager ozoneManager, org.apache.hadoop.hdds.conf.OzoneConfiguration configuration)
  • Method Details

    • start

      public void start()
      Overrides:
      start in class org.apache.hadoop.hdds.utils.BackgroundService
    • pause

      public void pause()
    • resume

      public void resume()
    • triggerSnapshotDefragOnce

      public boolean triggerSnapshotDefragOnce() throws IOException
      Throws:
      IOException
    • getTasks

      public org.apache.hadoop.hdds.utils.BackgroundTaskQueue getTasks()
      Specified by:
      getTasks in class org.apache.hadoop.hdds.utils.BackgroundService
    • getSnapshotsDefraggedCount

      public AtomicLong getSnapshotsDefraggedCount()
    • getBootstrapStateLock

      public org.apache.hadoop.ozone.lock.BootstrapStateHandler.Lock getBootstrapStateLock()
      Specified by:
      getBootstrapStateLock in interface org.apache.hadoop.ozone.lock.BootstrapStateHandler
    • shutdown

      public void shutdown()
      Overrides:
      shutdown in class org.apache.hadoop.hdds.utils.BackgroundService