-
Notifications
You must be signed in to change notification settings - Fork 747
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: add DatabaseMeta.gc_in_progress
If `gc_in_progress` is set, no un-drop can be done on this database. Because the related data may already have been deleted. This commit does not use this flag yet, and will be used in next commit. - Part of #16433
- Loading branch information
1 parent
56efa54
commit 50ece24
Showing
14 changed files
with
85 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
src/meta/proto-conv/tests/it/v110_database_meta_gc_in_progress.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// Copyright 2023 Datafuse Labs. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
use chrono::TimeZone; | ||
use chrono::Utc; | ||
use databend_common_meta_app::schema as mt; | ||
use fastrace::func_name; | ||
use maplit::btreemap; | ||
|
||
use crate::common; | ||
|
||
// These bytes are built when a new version in introduced, | ||
// and are kept for backward compatibility test. | ||
// | ||
// ************************************************************* | ||
// * These messages should never be updated, * | ||
// * only be added when a new version is added, * | ||
// * or be removed when an old version is no longer supported. * | ||
// ************************************************************* | ||
// | ||
// The message bytes are built from the output of `test_pb_from_to()` | ||
#[test] | ||
fn test_decode_v109_database_meta() -> anyhow::Result<()> { | ||
let database_meta_v109 = vec![ | ||
34, 10, 10, 3, 120, 121, 122, 18, 3, 102, 111, 111, 42, 2, 52, 52, 50, 10, 10, 3, 97, 98, | ||
99, 18, 3, 100, 101, 102, 162, 1, 23, 50, 48, 49, 52, 45, 49, 49, 45, 50, 56, 32, 49, 50, | ||
58, 48, 48, 58, 48, 57, 32, 85, 84, 67, 170, 1, 23, 50, 48, 49, 52, 45, 49, 49, 45, 50, 57, | ||
32, 49, 50, 58, 48, 48, 58, 48, 57, 32, 85, 84, 67, 178, 1, 7, 102, 111, 111, 32, 98, 97, | ||
114, 232, 1, 1, 160, 6, 109, 168, 6, 24, | ||
]; | ||
|
||
let want = || mt::DatabaseMeta { | ||
engine: "44".to_string(), | ||
engine_options: btreemap! {s("abc") => s("def")}, | ||
options: btreemap! {s("xyz") => s("foo")}, | ||
created_on: Utc.with_ymd_and_hms(2014, 11, 28, 12, 0, 9).unwrap(), | ||
updated_on: Utc.with_ymd_and_hms(2014, 11, 29, 12, 0, 9).unwrap(), | ||
comment: "foo bar".to_string(), | ||
drop_on: None, | ||
gc_in_progress: true, | ||
}; | ||
|
||
common::test_pb_from_to(func_name!(), want())?; | ||
common::test_load_old(func_name!(), database_meta_v109.as_slice(), 109, want()) | ||
} | ||
|
||
fn s(ss: impl ToString) -> String { | ||
ss.to_string() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters