[ https://issues.apache.org/jira/browse/HIVE-25168?focusedWorklogId=604732&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-604732 ]
ASF GitHub Bot logged work on HIVE-25168: ----------------------------------------- Author: ASF GitHub Bot Created on: 01/Jun/21 19:37 Start Date: 01/Jun/21 19:37 Worklog Time Spent: 10m Work Description: kishendas commented on a change in pull request #2324: URL: https://github.com/apache/hive/pull/2324#discussion_r643423954 ########## File path: storage-api/src/java/org/apache/hadoop/hive/common/MutableValidReaderWriteIdList.java ########## @@ -0,0 +1,125 @@ +/* + * 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.hadoop.hive.common; + +import com.google.common.base.Preconditions; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.ArrayList; +import java.util.BitSet; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +/** + * This class is a mutable version of {@link ValidReaderWriteIdList} for use by an external cache layer. + * To use this class, we need to always mark the writeId as open before to mark it as aborted/committed. + * This class is not thread safe. + */ +public class MutableValidReaderWriteIdList extends ValidReaderWriteIdList implements MutableValidWriteIdList { + private static final Logger LOG = LoggerFactory.getLogger(MutableValidReaderWriteIdList.class.getName()); + + public MutableValidReaderWriteIdList(ValidReaderWriteIdList writeIdList) { + super(writeIdList.writeToString()); + exceptions = new ArrayList<>(exceptions); + } + + @Override + public void addOpenWriteId(long writeId) { + if (writeId <= highWatermark) { + LOG.debug("Won't add any open write id because {} is less than or equal to high watermark: {}", Review comment: Please keep the log messages shorter, as they can occupy lot of storage space. More like ("not adding openWriteId: {} {}", writeId, highWatermark) ########## File path: storage-api/src/java/org/apache/hadoop/hive/common/MutableValidReaderWriteIdList.java ########## @@ -0,0 +1,125 @@ +/* + * 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.hadoop.hive.common; + +import com.google.common.base.Preconditions; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.ArrayList; +import java.util.BitSet; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +/** + * This class is a mutable version of {@link ValidReaderWriteIdList} for use by an external cache layer. + * To use this class, we need to always mark the writeId as open before to mark it as aborted/committed. + * This class is not thread safe. Review comment: What is the implication of this class not being thread safe ? ########## File path: storage-api/src/java/org/apache/hadoop/hive/common/MutableValidReaderWriteIdList.java ########## @@ -0,0 +1,125 @@ +/* + * 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.hadoop.hive.common; + +import com.google.common.base.Preconditions; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.ArrayList; +import java.util.BitSet; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +/** + * This class is a mutable version of {@link ValidReaderWriteIdList} for use by an external cache layer. + * To use this class, we need to always mark the writeId as open before to mark it as aborted/committed. + * This class is not thread safe. + */ +public class MutableValidReaderWriteIdList extends ValidReaderWriteIdList implements MutableValidWriteIdList { Review comment: Can you add a comment on why we need this class ? More like why an external cache layer wants to use this class. -- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 604732) Time Spent: 0.5h (was: 20m) > Add mutable validWriteIdList > ---------------------------- > > Key: HIVE-25168 > URL: https://issues.apache.org/jira/browse/HIVE-25168 > Project: Hive > Issue Type: New Feature > Components: storage-api > Reporter: Yu-Wen Lai > Assignee: Yu-Wen Lai > Priority: Major > Labels: pull-request-available > Time Spent: 0.5h > Remaining Estimate: 0h > > Although the current implementation for validWriteIdList is not strictly > immutable, it is in some sense to provide a read-only view snapshot. This > change is to add another class to provide functionalities for manipulating > the writeIdList. We could use this to keep writeIdList up-to-date in an > external cache layer for event-based metadata refreshing. -- This message was sent by Atlassian Jira (v8.3.4#803005)