-
Notifications
You must be signed in to change notification settings - Fork 2.5k
[HUDI-1557] Make Flink write pipeline write task scalable #2506
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,7 +25,6 @@ | |
| import org.apache.hudi.common.model.HoodieRecord; | ||
| import org.apache.hudi.common.model.HoodieRecordLocation; | ||
| import org.apache.hudi.common.model.HoodieRecordPayload; | ||
| import org.apache.hudi.common.util.Option; | ||
| import org.apache.hudi.config.HoodieWriteConfig; | ||
| import org.apache.hudi.exception.HoodieIndexException; | ||
| import org.apache.hudi.index.FlinkHoodieIndex; | ||
|
|
@@ -62,47 +61,14 @@ public FlinkInMemoryStateIndex(HoodieFlinkEngineContext context, HoodieWriteConf | |
| public List<HoodieRecord<T>> tagLocation(List<HoodieRecord<T>> records, | ||
| HoodieEngineContext context, | ||
| HoodieTable<T, List<HoodieRecord<T>>, List<HoodieKey>, List<WriteStatus>> hoodieTable) throws HoodieIndexException { | ||
| return context.map(records, record -> { | ||
| try { | ||
| if (mapState.contains(record.getKey())) { | ||
| record.unseal(); | ||
| record.setCurrentLocation(mapState.get(record.getKey())); | ||
| record.seal(); | ||
| } | ||
| } catch (Exception e) { | ||
| LOG.error(String.format("Tag record location failed, key = %s, %s", record.getRecordKey(), e.getMessage())); | ||
| } | ||
| return record; | ||
| }, 0); | ||
| throw new UnsupportedOperationException("No need to tag location for FlinkInMemoryStateIndex"); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @wangxianghu Do you agree this?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @danny0405 if we do not query the location, how to identify the operation per record is insert or update
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See the document of
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: Can we add some comments about the indexing here and pointing to |
||
| } | ||
|
|
||
| @Override | ||
| public List<WriteStatus> updateLocation(List<WriteStatus> writeStatuses, | ||
| HoodieEngineContext context, | ||
| HoodieTable<T, List<HoodieRecord<T>>, List<HoodieKey>, List<WriteStatus>> hoodieTable) throws HoodieIndexException { | ||
| return context.map(writeStatuses, writeStatus -> { | ||
| for (HoodieRecord record : writeStatus.getWrittenRecords()) { | ||
| if (!writeStatus.isErrored(record.getKey())) { | ||
| HoodieKey key = record.getKey(); | ||
| Option<HoodieRecordLocation> newLocation = record.getNewLocation(); | ||
| if (newLocation.isPresent()) { | ||
| try { | ||
| mapState.put(key, newLocation.get()); | ||
| } catch (Exception e) { | ||
| LOG.error(String.format("Update record location failed, key = %s, %s", record.getRecordKey(), e.getMessage())); | ||
| } | ||
| } else { | ||
| // Delete existing index for a deleted record | ||
| try { | ||
| mapState.remove(key); | ||
| } catch (Exception e) { | ||
| LOG.error(String.format("Remove record location failed, key = %s, %s", record.getRecordKey(), e.getMessage())); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| return writeStatus; | ||
| }, 0); | ||
| throw new UnsupportedOperationException("No need to update location for FlinkInMemoryStateIndex"); | ||
| } | ||
|
|
||
| @Override | ||
|
|
@@ -128,6 +94,6 @@ public boolean canIndexLogFiles() { | |
| */ | ||
| @Override | ||
| public boolean isImplicitWithStorage() { | ||
| return false; | ||
| return true; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| /* | ||
| * 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.hudi.io; | ||
|
|
||
| import org.apache.hudi.common.engine.TaskContextSupplier; | ||
| import org.apache.hudi.common.model.HoodieRecordPayload; | ||
| import org.apache.hudi.config.HoodieWriteConfig; | ||
| import org.apache.hudi.table.HoodieTable; | ||
|
|
||
| /** | ||
| * Create handle factory for Flink writer, use the specified fileID directly | ||
| * because it is unique anyway. | ||
| */ | ||
| public class FlinkCreateHandleFactory<T extends HoodieRecordPayload, I, K, O> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the difference between
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I said the reason in the document, they are different in rolling over new files, |
||
| extends CreateHandleFactory<T, I, K, O> { | ||
|
|
||
| @Override | ||
| public HoodieWriteHandle<T, I, K, O> create( | ||
| HoodieWriteConfig hoodieConfig, String commitTime, | ||
| HoodieTable<T, I, K, O> hoodieTable, String partitionPath, | ||
| String fileIdPrefix, TaskContextSupplier taskContextSupplier) { | ||
| return new HoodieCreateHandle(hoodieConfig, commitTime, hoodieTable, partitionPath, | ||
| fileIdPrefix, taskContextSupplier); | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.