Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 3.9k
[fix](load) fix load_to_single_tablet routing for auto partition#64356
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
Merged
Uh oh!
There was an error while loading. Please reload this page.
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
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
62 changes: 56 additions & 6 deletions
62 fe/fe-core/src/main/java/org/apache/doris/service/FrontendServiceImpl.java
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
32 changes: 28 additions & 4 deletions
32 fe/fe-core/src/main/java/org/apache/doris/transaction/AutoPartitionCacheManager.java
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
61 changes: 61 additions & 0 deletions
61 fe/fe-core/src/test/java/org/apache/doris/transaction/AutoPartitionCacheManagerTest.java
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,61 @@ | ||
| // 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. | ||
| package org.apache.doris.transaction; | ||
| import org.apache.doris.thrift.TTabletLocation; | ||
| import org.junit.Assert; | ||
| import org.junit.Test; | ||
| import java.util.ArrayList; | ||
| import java.util.Arrays; | ||
| import java.util.List; | ||
| import java.util.concurrent.atomic.AtomicLong; | ||
| public class AutoPartitionCacheManagerTest { | ||
| @Test | ||
| public void testGetOrSetAutoPartitionInfoReturnsCachedLoadTabletIdx() { | ||
| AutoPartitionCacheManager cacheManager = new AutoPartitionCacheManager(); | ||
| List<TTabletLocation> firstTablets = new ArrayList<>(); | ||
| firstTablets.add(new TTabletLocation(10001L, Arrays.asList(1L))); | ||
| List<TTabletLocation> firstSlaveTablets = new ArrayList<>(); | ||
| long storedLoadTabletIdx = cacheManager.getOrSetAutoPartitionInfo( | ||
| 10L, 20L, firstTablets, firstSlaveTablets, 3); | ||
| Assert.assertEquals(3, storedLoadTabletIdx); | ||
| List<TTabletLocation> secondTablets = new ArrayList<>(); | ||
| secondTablets.add(new TTabletLocation(20001L, Arrays.asList(2L))); | ||
| List<TTabletLocation> secondSlaveTablets = new ArrayList<>(); | ||
| long cachedLoadTabletIdx = cacheManager.getOrSetAutoPartitionInfo( | ||
| 10L, 20L, secondTablets, secondSlaveTablets, 5); | ||
| Assert.assertEquals(3, cachedLoadTabletIdx); | ||
| Assert.assertEquals(1, secondTablets.size()); | ||
| Assert.assertEquals(10001L, secondTablets.get(0).getTabletId()); | ||
| List<TTabletLocation> cachedTablets = new ArrayList<>(); | ||
| List<TTabletLocation> cachedSlaveTablets = new ArrayList<>(); | ||
| AtomicLong readLoadTabletIdx = new AtomicLong(-1); | ||
| Assert.assertTrue(cacheManager.getAutoPartitionInfo( | ||
| 10L, 20L, cachedTablets, cachedSlaveTablets, readLoadTabletIdx)); | ||
| Assert.assertEquals(3, readLoadTabletIdx.get()); | ||
| Assert.assertEquals(1, cachedTablets.size()); | ||
| Assert.assertEquals(10001L, cachedTablets.get(0).getTabletId()); | ||
| } | ||
| } |
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 |
|---|---|---|
| @@ -1405,6 +1405,8 @@ struct TCreatePartitionRequest { | ||
| 6: optional bool write_single_replica = false | ||
| // query_id to identify the coordinator, if coordinator exists, it means this is a multi-instance load | ||
| 7: optional Types.TUniqueId query_id | ||
| // Whether the caller's table sink is using load_to_single_tablet mode. | ||
| 8: optional bool load_to_single_tablet = false | ||
| } | ||
| struct TCreatePartitionResult { | ||
| @@ -1425,6 +1427,8 @@ struct TReplacePartitionRequest { | ||
| 5: optional string be_endpoint | ||
| 6: optional bool write_single_replica = false | ||
| 7: optional Types.TUniqueId query_id | ||
| // Whether the caller's table sink is using load_to_single_tablet mode. | ||
| 8: optional bool load_to_single_tablet = false | ||
zclllyybb marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| } | ||
| struct TReplacePartitionResult { | ||
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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.
Uh oh!
There was an error while loading. Please reload this page.