In Pegasus, sometimes we should add user specified compaction policy to reduce disk usage. This RFC proposes a user specified compaction design.
Add two classes named with compaction_operation
and compaction_rule
.
compaction_filter_rule
represents the compaction rule to filter the keys which are stored in rocksdb. There are three types of compaction operation:
compaction_operation
represents the compaction operation. A compaction operation will be executed when all the corresponding compaction rules are matched. There are two types of compaction filter rule:
Finally, we should save the information about user specified compaction in app env. In order to make these information can still be retrieved after the machine is restarted.
Here is the class diagram for user specified compaction.
+---------------+ +-----------------+ | compaction op +------------------------------+ compaction rule | +------^--------+ +--------^--------+ | | _________|_________ ______________________|______________________ | | | | | | | | | | | | | | | +------------+ +------------+ +--------------+ +--------------+ +--------------+ | update ttl | | delete | | hashkey rule | | sortkey rule | | ttl rule | +------------+ +------------+ +--------------+ +--------------+ +--------------+