-
Notifications
You must be signed in to change notification settings - Fork 52
feat: add LSM timeline support with timeline layout management for old and new table versions #395
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
Open
codope
wants to merge
13
commits into
apache:main
Choose a base branch
from
codope:lsm-timeline-p1
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
dbb89ef
feat: add LSM timeline support with timeline layout management for ol…
codope 82030a9
undo cpp cargo change
codope 82da83a
feat(timeline): add LSM timeline support and layout management
codope 555d9b0
feat(timeline): add multi-loader orchestration for archived instants
codope 988fa21
feat(timeline): LSM tree implementation
codope 3fadc99
fix: license header
codope f7ef1af
test: integrate with existing v8 test table
codope ad2062a
Merge remote-tracking branch 'origin/main' into lsm-timeline-p1
codope 46cf94a
undo table mod.rs comment changes
codope c4494fd
- TimelineLoader::LayoutTwoCompacted --> LayoutTwoArchived
codope 0a3eefe
new configs for archived behavior
codope ab41315
stub impl for archived v1
codope 4f2eded
chore(ci): update rust toolchain to 1.85
codope File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,101 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you 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 crate::config::table::HudiTableConfig::{TableVersion, TimelineLayoutVersion}; | ||
use crate::config::HudiConfigs; | ||
use crate::error::CoreError; | ||
use crate::storage::Storage; | ||
use crate::timeline::loader::TimelineLoader; | ||
use crate::timeline::Timeline; | ||
use crate::Result; | ||
use std::sync::Arc; | ||
|
||
pub struct TimelineBuilder { | ||
hudi_configs: Arc<HudiConfigs>, | ||
storage: Arc<Storage>, | ||
} | ||
|
||
impl TimelineBuilder { | ||
pub fn new(hudi_configs: Arc<HudiConfigs>, storage: Arc<Storage>) -> Self { | ||
Self { | ||
hudi_configs, | ||
storage, | ||
} | ||
} | ||
|
||
pub async fn build(self) -> Result<Timeline> { | ||
let (active_loader, archived_loader) = self.resolve_loader_config()?; | ||
let timeline = Timeline::new( | ||
self.hudi_configs, | ||
self.storage, | ||
active_loader, | ||
archived_loader, | ||
); | ||
Ok(timeline) | ||
} | ||
|
||
fn resolve_loader_config(&self) -> Result<(TimelineLoader, Option<TimelineLoader>)> { | ||
let table_version = match self.hudi_configs.get(TableVersion) { | ||
Ok(v) => v.to::<isize>(), | ||
Err(_) => { | ||
return Ok(( | ||
TimelineLoader::LayoutOneActive(self.storage.clone()), | ||
Some(TimelineLoader::LayoutOneArchived(self.storage.clone())), | ||
)) | ||
} | ||
}; | ||
|
||
let layout_version = self | ||
.hudi_configs | ||
.try_get(TimelineLayoutVersion) | ||
.map(|v| v.to::<isize>()) | ||
.unwrap_or_else(|| if table_version == 8 { 2 } else { 1 }); | ||
|
||
match layout_version { | ||
1 => { | ||
if !(6..=8).contains(&table_version) { | ||
return Err(CoreError::Unsupported(format!( | ||
"Unsupported table version {} with timeline layout version {}", | ||
table_version, layout_version | ||
))); | ||
} | ||
Ok(( | ||
TimelineLoader::LayoutOneActive(self.storage.clone()), | ||
Some(TimelineLoader::LayoutOneArchived(self.storage.clone())), | ||
)) | ||
} | ||
2 => { | ||
if table_version != 8 { | ||
return Err(CoreError::Unsupported(format!( | ||
"Unsupported table version {} with timeline layout version {}", | ||
table_version, layout_version | ||
))); | ||
} | ||
Ok(( | ||
TimelineLoader::LayoutTwoActive(self.storage.clone()), | ||
Some(TimelineLoader::LayoutTwoArchived(self.storage.clone())), | ||
)) | ||
} | ||
_ => Err(CoreError::Unsupported(format!( | ||
"Unsupported timeline layout version: {}", | ||
layout_version | ||
))), | ||
} | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these 2 do have default values right? why not provide them through this API?