flink icon indicating copy to clipboard operation
flink copied to clipboard

[FLINK-36149][state] Make the RocksdbCompactFilter parameters take effect directly at the statebackend level

Open lexluo09 opened this issue 1 year ago • 7 comments

What is the purpose of the change

In Rank operators, add the cleanupInRocksdbCompactFilter(queryTimeAfterNumEntries) parameter setting, allowing adjustment based on the size of user state to enhance performance.

Brief change log

  • Add a configuration parameter, TABLE_EXEC_RANK_ROCKSDB_CLEANUP_QUERY_TIME_AFTER_NUM_ENTRIES, in StreamExecRank.
  • Update StateConfigUtil to support creating StateTtlConfig using retentionTime and queryTimeAfterNumEntries.
  • Support configuration of cleanupFullSnapshot and cleanupInRocksdbCompactFilter.

Verifying this change

This change is already covered by existing tests, such as AppendOnlyFirstNFunctionTest、TopNFunctionTestBase.

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): (no)
  • The public API, i.e., is any changed class annotated with @Public(Evolving): (no)
  • The serializers: (no)
  • The runtime per-record code paths (performance sensitive): (no)
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: (no)
  • The S3 file system connector: (no)

Documentation

  • Does this pull request introduce a new feature? (no)
  • If yes, how is the feature documented? (not documented)

lexluo09 avatar Aug 26 '24 08:08 lexluo09

CI report:

  • 8cc36d1e1d2fe8add0ccee910efd573abd2221db Azure: SUCCESS
Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run azure re-run the last Azure build

flinkbot avatar Aug 26 '24 08:08 flinkbot

@flinkbot run azure

lexluo09 avatar Aug 26 '24 09:08 lexluo09

@flinkbot run azure

lexluo09 avatar Aug 26 '24 10:08 lexluo09

cc @Zakelly @masteryhx since you're the expert in this area, would one of you help the review if you have time?

lincoln-lil avatar Aug 28 '24 13:08 lincoln-lil

@lexluo09 thanks for contributing this! Since the scope of the pr changes, the module name in the commit msg should be updated as well(table -> state).

Thank you for helping with the review. I have made the necessary changes based on your feedback.

lexluo09 avatar Aug 28 '24 14:08 lexluo09

And BTW, you should run mvn package -Dgenerate-config-docs -pl flink-docs -am -nsu -DskipTests -Pskip-webui-build if you add/change the configurations. Please check the instructions in flink-docs/README.md.

Zakelly avatar Aug 29 '24 03:08 Zakelly

And BTW, you should run mvn package -Dgenerate-config-docs -pl flink-docs -am -nsu -DskipTests -Pskip-webui-build if you add/change the configurations. Please check the instructions in flink-docs/README.md.

@Zakelly Thank you for your suggestion. I have executed the command to generate the documentation for the configuration as per your recommendation.

lexluo09 avatar Aug 29 '24 12:08 lexluo09

The CI failed. Would you mind fixing this?

Zakelly avatar Aug 30 '24 02:08 Zakelly

The CI failed. Would you mind fixing this?

ok

lexluo09 avatar Aug 30 '24 03:08 lexluo09

@flinkbot run azure

lexluo09 avatar Aug 30 '24 03:08 lexluo09

@flinkbot run azure

lexluo09 avatar Aug 30 '24 03:08 lexluo09

The CI failed. Would you mind fixing this? @Zakelly Thank you for your suggestion. The CI has been successfully fixed.

lexluo09 avatar Aug 30 '24 09:08 lexluo09

@Zakelly Can you please take another look and help me out? Thank you!

lexluo09 avatar Sep 02 '24 07:09 lexluo09

@lexluo09 Sorry for the late reply, overall looks good. Only one minor thing:

Thank you for taking the time to help review the code. It has been fixed now.

lexluo09 avatar Sep 02 '24 09:09 lexluo09

@flinkbot run azure

lexluo09 avatar Sep 02 '24 09:09 lexluo09

@flinkbot run azure

lexluo09 avatar Sep 02 '24 09:09 lexluo09

How about this?

Very professional, thank you for your suggestions.

lexluo09 avatar Sep 02 '24 09:09 lexluo09

image image I need help confirming a question: In ProtoUtils, the builder.cleanupInRocksdbCompactFilter only sets queryTimeAfterNumEntries and does not set periodicCompactionTime. Should we handle this situation for compatibility?

@Zakelly

lexluo09 avatar Sep 02 '24 10:09 lexluo09

I need help confirming a question: In ProtoUtils, the builder.cleanupInRocksdbCompactFilter only sets queryTimeAfterNumEntries and does not set periodicCompactionTime. Should we handle this situation for compatibility? @Zakelly

@lexluo09 Yes, we should keep compatibility for that. I think in current PR, if it does builder.cleanupInRocksdbCompactFilter(rocksdbCompactFilterCleanupStrategyProto.getQueryTimeAfterNumEntries());, the DEFAULT_PERIODIC_COMPACTION_TIME still takes effect, aka 30 days set. So no compatibility issues, right?

Zakelly avatar Sep 02 '24 10:09 Zakelly

Yes, we should keep compatibility for that. I think in current PR, if it does builder.cleanupInRocksdbCompactFilter(rocksdbCompactFilterCleanupStrategyProto.getQueryTimeAfterNumEntries());, the DEFAULT_PERIODIC_COMPACTION_TIME still takes effect, aka 30 days set. So no compatibility issues, right?

Yes, I also think this is reasonable. The DEFAULT_PERIODIC_COMPACTION_TIME will still be retained.

lexluo09 avatar Sep 02 '24 11:09 lexluo09

@flinkbot run azure

lexluo09 avatar Sep 02 '24 12:09 lexluo09

@Zakelly Thank you for taking the time to review. I have made all the necessary changes. When you have the time, please kindly take another look. Thank you for your assistance.

lexluo09 avatar Sep 02 '24 12:09 lexluo09

@flinkbot run azure

lexluo09 avatar Sep 02 '24 12:09 lexluo09

@Zakelly The CI tests have passed. When you have time, could you please take a look? Thank you for your assistance.

lexluo09 avatar Sep 03 '24 05:09 lexluo09

@flinkbot run azure

lexluo09 avatar Sep 03 '24 13:09 lexluo09

@flinkbot run azure

Zakelly avatar Sep 04 '24 03:09 Zakelly

LGTM

Thank you for helping with the review.

lexluo09 avatar Sep 04 '24 04:09 lexluo09

@flinkbot run azure

lexluo09 avatar Sep 04 '24 06:09 lexluo09