Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(storage): remove enable_test_epoch and modify epochs used by all unit tests to be realistic #14557

Merged
merged 52 commits into from
Mar 11, 2024

Conversation

wcy-fdu
Copy link
Contributor

@wcy-fdu wcy-fdu commented Jan 14, 2024

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

What's changed and what's your intention?

As title

close #13884

Checklist

- [ ] I have written necessary rustdoc comments
- [ ] I have added necessary unit tests and integration tests
- [ ] I have added test labels as necessary. See details.
- [ ] I have added fuzzing tests or opened an issue to track them. (Optional, recommended for new SQL features #7934).
- [ ] My PR contains breaking changes. (If it deprecates some features, please create a tracking issue to remove them in the future).

  • All checks passed in ./risedev check (or alias, ./risedev c)
    - [ ] My PR changes performance-critical code. (Please run macro/micro-benchmarks and show the results.)

- [ ] My PR contains critical fixes that are necessary to be merged into the latest release. (Please check out the details)

Documentation

- [ ] My PR needs documentation updates. (Please use the Release note section below to summarize the impact on users)

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.

@wcy-fdu wcy-fdu marked this pull request as draft January 14, 2024 07:44
@wcy-fdu wcy-fdu marked this pull request as ready for review January 24, 2024 12:55
@wcy-fdu wcy-fdu changed the title refactor(storage): remove enable_test_epoch and modify epochs used by all unit tests to be realistic[WIP] refactor(storage): remove enable_test_epoch and modify epochs used by all unit tests to be realistic Jan 24, 2024
src/common/src/util/epoch.rs Outdated Show resolved Hide resolved
src/common/src/util/epoch.rs Outdated Show resolved Hide resolved
src/storage/src/hummock/iterator/forward_user.rs Outdated Show resolved Hide resolved
@wcy-fdu wcy-fdu requested a review from a team as a code owner January 31, 2024 09:05
Copy link
Member

@stdrc stdrc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please review all changes by yourself after changing some critical part, like introducing a constant or function to avoid magic numbers. IMO the magic numbers in this PR will be extremely hard to eliminate after got merged and will significantly decrease the maintainability of our tests.

src/common/src/util/epoch.rs Outdated Show resolved Hide resolved
src/common/src/util/epoch.rs Outdated Show resolved Hide resolved
src/storage/hummock_sdk/src/lib.rs Outdated Show resolved Hide resolved
src/storage/hummock_sdk/src/lib.rs Outdated Show resolved Hide resolved
src/storage/hummock_sdk/src/lib.rs Outdated Show resolved Hide resolved
src/stream/tests/integration_tests/eowc_over_window.rs Outdated Show resolved Hide resolved
src/stream/tests/integration_tests/eowc_over_window.rs Outdated Show resolved Hide resolved
src/stream/tests/integration_tests/snapshot.rs Outdated Show resolved Hide resolved
src/stream/tests/integration_tests/snapshot.rs Outdated Show resolved Hide resolved
src/tests/compaction_test/src/delete_range_runner.rs Outdated Show resolved Hide resolved
@stdrc stdrc requested a review from xxchan February 7, 2024 01:06
Copy link

gitguardian bot commented Mar 6, 2024

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secret in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
9425213 Triggered Generic Password 7e02709 ci/scripts/regress-test.sh View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

Our GitHub checks need improvements? Share your feedbacks!

Copy link
Contributor

@wenym1 wenym1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rest LGTM! Thanks for the great works to resolve the conflict!

The PR can be merged after all comments are resolved.

src/stream/src/common/log_store_impl/kv_log_store/mod.rs Outdated Show resolved Hide resolved
src/stream/src/executor/sink.rs Outdated Show resolved Hide resolved
src/storage/src/mem_table.rs Outdated Show resolved Hide resolved
src/storage/src/mem_table.rs Outdated Show resolved Hide resolved
src/storage/hummock_test/src/compactor_tests.rs Outdated Show resolved Hide resolved
@wcy-fdu
Copy link
Contributor Author

wcy-fdu commented Mar 6, 2024

I will go ahead to find out the reason of unit test timeout.

@hzxa21
Copy link
Collaborator

hzxa21 commented Mar 7, 2024

The unit test run time looks good in the recent commit: https://buildkite.com/risingwavelabs/pull-request/builds/43799#_

@wcy-fdu
Copy link
Contributor Author

wcy-fdu commented Mar 7, 2024

The unit test run time looks good in the recent commit: https://buildkite.com/risingwavelabs/pull-request/builds/43799#_

Yes, I have change the timeout to origin 22mins to see whether it can pass.

Copy link
Collaborator

@hzxa21 hzxa21 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is much cleaner. Thanks for the great efforts!

src/storage/hummock_test/src/hummock_read_version_tests.rs Outdated Show resolved Hide resolved
src/storage/hummock_test/src/hummock_read_version_tests.rs Outdated Show resolved Hide resolved
src/storage/hummock_test/src/state_store_tests.rs Outdated Show resolved Hide resolved
src/common/src/util/epoch.rs Show resolved Hide resolved
use risingwave_hummock_sdk::key::{FullKey, TableKey};

use super::{CompactionFilter, TtlCompactionFilter};

#[test]
fn test_ttl_u32() {
let mut ttl_filter = TtlCompactionFilter::new(HashMap::from_iter([(1, 4000000000)]), 1);
ttl_filter.should_delete(FullKey::new(TableId::new(1), TableKey(vec![]), 1).to_ref());
ttl_filter
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @Li0k PTAL

src/storage/src/hummock/event_handler/uploader.rs Outdated Show resolved Hide resolved
src/storage/src/hummock/iterator/test_utils.rs Outdated Show resolved Hide resolved
@@ -217,7 +218,7 @@ pub mod sled {
table_id,
table_key: TableKey(Bytes::from(table_key.to_vec())),
},
epoch_with_gap: EpochWithGap::new_from_epoch(epoch),
epoch_with_gap: EpochWithGap::new_from_epoch(epoch & !EPOCH_SPILL_TIME_MASK),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this change the test case? cc @Li0k

@wcy-fdu
Copy link
Contributor Author

wcy-fdu commented Mar 7, 2024

After a long period of work, most of the comments have been resolved, and the unit test will no longer time out. Thank you (@hzxa21 @wenym1 @stdrc )for your careful review.

@wcy-fdu wcy-fdu requested review from hzxa21 and wenym1 March 7, 2024 08:08
Copy link
Contributor

@wenym1 wenym1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rest LGTM!

Is the file risingwave-test/hummock_001/checkpoint/0 included accidentally?

src/storage/hummock_test/src/hummock_storage_tests.rs Outdated Show resolved Hide resolved
src/storage/src/hummock/event_handler/uploader.rs Outdated Show resolved Hide resolved
src/storage/src/hummock/iterator/backward_user.rs Outdated Show resolved Hide resolved
src/storage/src/hummock/iterator/forward_user.rs Outdated Show resolved Hide resolved
@@ -146,7 +147,7 @@ where
for mut event in inputs {
match &mut event {
SnapshotEvent::Barrier(epoch) => {
tx.push_barrier(*epoch, false);
tx.push_barrier(test_epoch(*epoch), false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is possible to change to epoch in SnapshotEvent::Barrier to a correctly shifted value?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bit hard, let's keep it like this for now.

@wcy-fdu wcy-fdu enabled auto-merge March 8, 2024 07:44
@wcy-fdu wcy-fdu disabled auto-merge March 8, 2024 07:44
@wcy-fdu wcy-fdu added this pull request to the merge queue Mar 11, 2024
Merged via the queue into main with commit cd28ff0 Mar 11, 2024
28 checks passed
@wcy-fdu wcy-fdu deleted the wcy/remove_enable_test_epoch branch March 11, 2024 06:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enable CI test for memtable spill and EpochWithGap
5 participants