Skip to content

CompactRange with change_level = true will move all the files of the level #7441

Closed

Description

@Connor1996

As comment of change_level said, compacted files will be moved to the minimum level capable of holding the data or given level.
https://github.com/facebook/rocksdb/blob/8f8264032dbf8667b0792f683b1221a74cf8e4bf/include/rocksdb/options.h#L1531-L1533
Whereas in RefitLevel, it moves all the files of the level to target but not compacted files https://github.com/facebook/rocksdb/blob/8f8264032dbf8667b0792f683b1221a74cf8e4bf/db/db_impl/db_impl_compaction_flush.cc#L1377-L1385

I'm not sure whether it is in purpose?

Activity

  1. ajkr commented on Sep 29, 2020

    @ajkr
    Contributor

    The goal of change_level is to support compaction migrations (e.g., changing num_levels, changing level_compaction_dynamic_level_bytes, etc.). Such migrations are only possible if we migrate all the files in the level. I agree it is pretty confusing because we allow CompactRange() to specify non-nullptr endpoints together with change_level = true, which almost guarantees the level change (RefitLevel()) step will fail.

    Is there a use case for moving only some of a level's files to another level?

  2. Connor1996 commented on Oct 9, 2020

    @Connor1996
    ContributorAuthor

    The goal of change_level is to support compaction migrations (e.g., changing num_levels, changing level_compaction_dynamic_level_bytes, etc.). Such migrations are only possible if we migrate all the files in the level. I agree it is pretty confusing because we allow CompactRange() to specify non-nullptr endpoints together with change_level = true, which almost guarantees the level change (RefitLevel()) step will fail.

    Thanks for explanation. No use case, just want to leverage it for unit test to reproduce some cases.

  3. ajkr commented on Mar 23, 2021

    @ajkr
    Contributor

    Tested it just now - it returned a reasonably good error without doing any damage (maybe the partial compaction work is wasted, idk).

    NotSupported: Not implemented: Levels between source and target are not empty for a move.
    

    I think it is fine to support this if someone wants, but we don't have a use case either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions