risingwavelabs / risingwave

Best-in-class stream processing, analytics, and management. Perform continuous analytics, or build event-driven applications, real-time ETL pipelines, and feature stores in minutes. Unified streaming and batch. PostgreSQL compatible.
https://go.risingwave.com/slack
Apache License 2.0
7.06k stars 581 forks source link

refactor(meta): use correct type for the pb counterpart #19500

Closed zwang28 closed 23 hours ago

zwang28 commented 1 day ago

I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.

What's changed and what's your intention?

Both IncompleteHummockVersion and HummockVersion use PbHummockVersion as the meta store type for persistence.

In time_travel.rs, whenever reading PbHummockVersion from the meta store, the counterpart in-mem structs should be IncompleteHummockVersion. Because in time_travel metadata, only sst_id and object_id of a SstableInfo are stored in PbHummockVersion, while other fields are left to default.

However, currently in time_travel.rs, HummockVersion is incorrectly used instead of IncompleteHummockVersion. This generates an SstableInfo with correct sst_id and object_id fields, but other fields are incorrect. It doesn't cause a correctness issue because other fields are not utilized in time_travel.rs, for now.

To prevent potential future bugs, this PR ensures that time_travel.rs uses the IncompleteHummockVersion and IncompleteHummockVersionDelta correctly. Methods required by time_travel.rs are moved from HummockVersion to HummockVersionCommon<T>.

Since there's no correctness issue for now, this PR won't be cherry-picked to release 2.1.

Checklist

Documentation

Release note

If this PR includes changes that directly affect users or other significant modifications relevant to the community, kindly draft a release note to provide a concise summary of these changes. Please prioritize highlighting the impact these changes will have on users.