JingsongLi commented on code in PR #171:
URL: https://github.com/apache/flink-table-store/pull/171#discussion_r906958100


##########
flink-table-store-core/src/main/java/org/apache/flink/table/store/table/sink/MemoryTableWrite.java:
##########
@@ -0,0 +1,90 @@
+/*
+ * 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.flink.table.store.table.sink;
+
+import org.apache.flink.table.runtime.util.MemorySegmentPool;
+import org.apache.flink.table.store.file.FileStoreOptions;
+import org.apache.flink.table.store.file.mergetree.MergeTreeOptions;
+import org.apache.flink.table.store.file.operation.FileStoreWrite;
+import org.apache.flink.table.store.file.utils.HeapMemorySegmentPool;
+import org.apache.flink.table.store.file.utils.MemoryPoolFactory;
+import org.apache.flink.table.store.file.writer.MemoryRecordWriter;
+import org.apache.flink.table.store.file.writer.RecordWriter;
+
+import java.util.Map;
+
+/**
+ * A {@link TableWrite} which supports using shared memory and preempting 
memory from other writers.
+ */
+public abstract class MemoryTableWrite<T> extends AbstractTableWrite<T>
+        implements MemoryPoolFactory.PreemptRunner<MemoryRecordWriter<T>> {

Review Comment:
   You means `KeyValueFileStoreWrite`?
   I understand what you mean, but currently `KeyValueFileStoreWrite` is not 
responsible for writing data, it is just a factory that creates writers, so it 
does not accomplish memory management capabilities unless we move the logic of 
`AbstractTableWrite` to `FileStoreWrite`, such as `write` and `prepareCommit`.
   
   I refactored the code and will make `MemoryTableWrite` simple enough that it 
is now just a shell to call, the real logic is in the `MemoryPoolFactory`.
   
   Let's consider "move the logic of `AbstractTableWrite` to `FileStoreWrite`" 
in new JIRA.
   https://issues.apache.org/jira/browse/FLINK-28256



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to