[ 
https://issues.apache.org/jira/browse/HIVE-26711?focusedWorklogId=839478&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-839478
 ]

ASF GitHub Bot logged work on HIVE-26711:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 17/Jan/23 00:28
            Start Date: 17/Jan/23 00:28
    Worklog Time Spent: 10m 
      Work Description: pudidic commented on code in PR #3736:
URL: https://github.com/apache/hive/pull/3736#discussion_r1071645397


##########
itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplWithReadOnlyHook.java:
##########
@@ -0,0 +1,126 @@
+/*
+ * 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.ql.parse;
+
+import static 
org.apache.hadoop.hive.ql.hooks.EnforceReadOnlyDatabaseHook.READONLY;
+import static org.apache.hadoop.hive.common.repl.ReplConst.READ_ONLY_HOOK;
+import static org.junit.Assert.assertEquals;
+
+import org.apache.hadoop.hdfs.MiniDFSCluster;
+import org.apache.hadoop.hive.conf.HiveConf;
+import org.apache.hadoop.hive.metastore.conf.MetastoreConf;
+import 
org.apache.hadoop.hive.metastore.messaging.json.gzip.GzipJSONMessageEncoder;
+import org.apache.hadoop.hive.shims.Utils;
+import org.junit.After;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class TestReplWithReadOnlyHook extends 
BaseReplicationScenariosAcidTables {
+
+  @BeforeClass
+  public static void classLevelSetup() throws Exception {
+    Map<String, String> overrides = new HashMap<>();
+    overrides.put(MetastoreConf.ConfVars.EVENT_MESSAGE_FACTORY.getHiveName(),
+      GzipJSONMessageEncoder.class.getCanonicalName());
+
+    conf = new HiveConf(TestReplWithReadOnlyHook.class);
+    conf.set("hadoop.proxyuser." + Utils.getUGI().getShortUserName() + 
".hosts", "*");
+
+    MiniDFSCluster miniDFSCluster =
+      new MiniDFSCluster.Builder(conf).numDataNodes(2).format(true).build();
+
+    Map<String, String> acidEnableConf = new HashMap<String, String>() {{

Review Comment:
   It's my first time to see this double brace initialization in my Java 
experience. So I may be wrong about this. I did a small research, and some of 
references call it an anti-pattern. How about just repeating with HashMap calls 
or using ImmutableMap.Builder to chain the methods? Thanks.
   
   1. https://www.baeldung.com/java-double-brace-initialization
   2. https://blog.jooq.org/dont-be-clever-the-double-curly-braces-anti-pattern/





Issue Time Tracking
-------------------

    Worklog Id:     (was: 839478)
    Time Spent: 1h 10m  (was: 1h)

> The very first REPL Load should make the Target Database read-only
> ------------------------------------------------------------------
>
>                 Key: HIVE-26711
>                 URL: https://issues.apache.org/jira/browse/HIVE-26711
>             Project: Hive
>          Issue Type: Task
>            Reporter: Shreenidhi
>            Assignee: Shreenidhi
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> Use EnforceReadOnly hook to set TARGET database read only during BootStrap 
> load.
> Also ensure backward compatibility.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to