JackieTien97 commented on code in PR #12775: URL: https://github.com/apache/iotdb/pull/12775#discussion_r1648502423
########## iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/memory/SynchronizedMemoryReservationManagerWrapper.java: ########## @@ -0,0 +1,72 @@ +/* + * 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.iotdb.db.queryengine.plan.planner.memory; + +/** + * SynchronizedMemoryReservationManager synchronizes the memory reservation and release operations. + * However, synchronization is not necessary every time for the memory reservation and release + * operations in single thread context. For example, each SeriesScanUtil itself reserves and + * releases memory in a single thread context, but SeriesScanUtils in the same FI may share the same + * SynchronizedMemoryReservationManager. So we can use this wrapper to batch the reserve and release + * operations to reduce the overhead of synchronization. The actual reserve and release operations + * are delegated to the wrapped MemoryReservationManager. + */ +public class SynchronizedMemoryReservationManagerWrapper implements MemoryReservationManager { Review Comment: do we really need this? ########## iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/memory/SynchronizedMemoryReservationManager.java: ########## @@ -0,0 +1,48 @@ +/* + * 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.iotdb.db.queryengine.plan.planner.memory; + +import org.apache.iotdb.db.queryengine.common.QueryId; + +public class SynchronizedMemoryReservationManager extends NotSynchronizedMemoryReservationManager { Review Comment: ```suggestion public class ThreadSafeMemoryReservationManager extends NotThreadSafeMemoryReservationManager { ``` ########## iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/memory/NotSynchronizedMemoryReservationManager.java: ########## @@ -0,0 +1,92 @@ +/* + * 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.iotdb.db.queryengine.plan.planner.memory; + +import org.apache.iotdb.db.queryengine.common.QueryId; +import org.apache.iotdb.db.queryengine.plan.planner.LocalExecutionPlanner; + +public class NotSynchronizedMemoryReservationManager implements MemoryReservationManager { Review Comment: ```suggestion public class NotThreadSafeMemoryReservationManager implements MemoryReservationManager { ``` -- 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]
