You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by GitBox <gi...@apache.org> on 2021/06/01 19:37:16 UTC

[GitHub] [hive] kishendas commented on a change in pull request #2324: HIVE-25168: Add mutable validWriteIdList

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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org