Package org.rocksdb

Interface EventListener

    • Method Detail

      • onFlushBegin

        void onFlushBegin​(RocksDB db,
                          FlushJobInfo flushJobInfo)
        A callback function to RocksDB which will be called before a RocksDB starts to flush memtables. Note that the this function must be implemented in a way such that it should not run for an extended period of time before the function returns. Otherwise, RocksDB may be blocked.
        Parameters:
        db - the database
        flushJobInfo - the flush job info, contains data copied from respective native structure.
      • onFlushCompleted

        void onFlushCompleted​(RocksDB db,
                              FlushJobInfo flushJobInfo)
        callback function to RocksDB which will be called whenever a registered RocksDB flushes a file. Note that the this function must be implemented in a way such that it should not run for an extended period of time before the function returns. Otherwise, RocksDB may be blocked.
        Parameters:
        db - the database
        flushJobInfo - the flush job info, contains data copied from respective native structure.
      • onCompactionBegin

        void onCompactionBegin​(RocksDB db,
                               CompactionJobInfo compactionJobInfo)
        A callback function to RocksDB which will be called before a RocksDB starts to compact. The default implementation is no-op. Note that the this function must be implemented in a way such that it should not run for an extended period of time before the function returns. Otherwise, RocksDB may be blocked.
        Parameters:
        db - a pointer to the rocksdb instance which just compacted a file.
        compactionJobInfo - a reference to a native CompactionJobInfo struct, which is released after this function is returned, and must be copied if it is needed outside of this function.
      • onCompactionCompleted

        void onCompactionCompleted​(RocksDB db,
                                   CompactionJobInfo compactionJobInfo)
        A callback function for RocksDB which will be called whenever a registered RocksDB compacts a file. The default implementation is a no-op. Note that this function must be implemented in a way such that it should not run for an extended period of time before the function returns. Otherwise, RocksDB may be blocked.
        Parameters:
        db - a pointer to the rocksdb instance which just compacted a file.
        compactionJobInfo - a reference to a native CompactionJobInfo struct, which is released after this function is returned, and must be copied if it is needed outside of this function.
      • onTableFileCreated

        void onTableFileCreated​(TableFileCreationInfo tableFileCreationInfo)
        A callback function for RocksDB which will be called whenever a SST file is created. Different from OnCompactionCompleted and OnFlushCompleted, this callback is designed for external logging service and thus only provide string parameters instead of a pointer to DB. Applications that build logic basic based on file creations and deletions is suggested to implement OnFlushCompleted and OnCompactionCompleted. Historically it will only be called if the file is successfully created. Now it will also be called on failure case. User can check info.status to see if it succeeded or not. Note that if applications would like to use the passed reference outside this function call, they should make copies from these returned value.
        Parameters:
        tableFileCreationInfo - the table file creation info, contains data copied from respective native structure.
      • onTableFileCreationStarted

        void onTableFileCreationStarted​(TableFileCreationBriefInfo tableFileCreationBriefInfo)
        A callback function for RocksDB which will be called before a SST file is being created. It will follow by OnTableFileCreated after the creation finishes. Note that if applications would like to use the passed reference outside this function call, they should make copies from these returned value.
        Parameters:
        tableFileCreationBriefInfo - the table file creation brief info, contains data copied from respective native structure.
      • onMemTableSealed

        void onMemTableSealed​(MemTableInfo memTableInfo)
        A callback function for RocksDB which will be called before a memtable is made immutable. Note that the this function must be implemented in a way such that it should not run for an extended period of time before the function returns. Otherwise, RocksDB may be blocked. Note that if applications would like to use the passed reference outside this function call, they should make copies from these returned value.
        Parameters:
        memTableInfo - the mem table info, contains data copied from respective native structure.
      • onColumnFamilyHandleDeletionStarted

        void onColumnFamilyHandleDeletionStarted​(ColumnFamilyHandle columnFamilyHandle)
        A callback function for RocksDB which will be called before a column family handle is deleted. Note that the this function must be implemented in a way such that it should not run for an extended period of time before the function returns. Otherwise, RocksDB may be blocked.
        Parameters:
        columnFamilyHandle - is a pointer to the column family handle to be deleted which will become a dangling pointer after the deletion.
      • onExternalFileIngested

        void onExternalFileIngested​(RocksDB db,
                                    ExternalFileIngestionInfo externalFileIngestionInfo)
        A callback function for RocksDB which will be called after an external file is ingested using IngestExternalFile. Note that the this function will run on the same thread as IngestExternalFile(), if this function is blocked, IngestExternalFile() will be blocked from finishing.
        Parameters:
        db - the database
        externalFileIngestionInfo - the external file ingestion info, contains data copied from respective native structure.
      • onBackgroundError

        void onBackgroundError​(BackgroundErrorReason backgroundErrorReason,
                               Status backgroundError)
        A callback function for RocksDB which will be called before setting the background error status to a non-OK value. The new background error status is provided in `bg_error` and can be modified by the callback. E.g., a callback can suppress errors by resetting it to Status::OK(), thus preventing the database from entering read-only mode. We do not provide any guarantee when failed flushes/compactions will be rescheduled if the user suppresses an error. Note that this function can run on the same threads as flush, compaction, and user writes. So, it is extremely important not to perform heavy computations or blocking calls in this function.
        Parameters:
        backgroundErrorReason - background error reason code
        backgroundError - background error codes
      • onStallConditionsChanged

        void onStallConditionsChanged​(WriteStallInfo writeStallInfo)
        A callback function for RocksDB which will be called whenever a change of superversion triggers a change of the stall conditions. Note that the this function must be implemented in a way such that it should not run for an extended period of time before the function returns. Otherwise, RocksDB may be blocked.
        Parameters:
        writeStallInfo - write stall info, contains data copied from respective native structure.
      • onFileReadFinish

        void onFileReadFinish​(FileOperationInfo fileOperationInfo)
        A callback function for RocksDB which will be called whenever a file read operation finishes.
        Parameters:
        fileOperationInfo - file operation info, contains data copied from respective native structure.
      • onFileWriteFinish

        void onFileWriteFinish​(FileOperationInfo fileOperationInfo)
        A callback function for RocksDB which will be called whenever a file write operation finishes.
        Parameters:
        fileOperationInfo - file operation info, contains data copied from respective native structure.
      • onFileFlushFinish

        void onFileFlushFinish​(FileOperationInfo fileOperationInfo)
        A callback function for RocksDB which will be called whenever a file flush operation finishes.
        Parameters:
        fileOperationInfo - file operation info, contains data copied from respective native structure.
      • onFileSyncFinish

        void onFileSyncFinish​(FileOperationInfo fileOperationInfo)
        A callback function for RocksDB which will be called whenever a file sync operation finishes.
        Parameters:
        fileOperationInfo - file operation info, contains data copied from respective native structure.
      • onFileRangeSyncFinish

        void onFileRangeSyncFinish​(FileOperationInfo fileOperationInfo)
        A callback function for RocksDB which will be called whenever a file rangeSync operation finishes.
        Parameters:
        fileOperationInfo - file operation info, contains data copied from respective native structure.
      • onFileTruncateFinish

        void onFileTruncateFinish​(FileOperationInfo fileOperationInfo)
        A callback function for RocksDB which will be called whenever a file truncate operation finishes.
        Parameters:
        fileOperationInfo - file operation info, contains data copied from respective native structure.
      • onFileCloseFinish

        void onFileCloseFinish​(FileOperationInfo fileOperationInfo)
        A callback function for RocksDB which will be called whenever a file close operation finishes.
        Parameters:
        fileOperationInfo - file operation info, contains data copied from respective native structure.
      • onErrorRecoveryBegin

        boolean onErrorRecoveryBegin​(BackgroundErrorReason backgroundErrorReason,
                                     Status backgroundError)
        A callback function for RocksDB which will be called just before starting the automatic recovery process for recoverable background errors, such as NoSpace(). The callback can suppress the automatic recovery by setting returning false. The database will then have to be transitioned out of read-only mode by calling RocksDB#resume().
        Parameters:
        backgroundErrorReason - background error reason code
        backgroundError - background error codes
      • onErrorRecoveryCompleted

        void onErrorRecoveryCompleted​(Status oldBackgroundError)
        A callback function for RocksDB which will be called once the database is recovered from read-only mode after an error. When this is called, it means normal writes to the database can be issued and the user can initiate any further recovery actions needed
        Parameters:
        oldBackgroundError - old background error codes