You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@phoenix.apache.org by GitBox <gi...@apache.org> on 2019/06/19 21:15:01 UTC

[GitHub] [phoenix] gjacoby126 commented on a change in pull request #520: PHOENIX-5333: A tool to upgrade existing tables/indexes to use self-c…

gjacoby126 commented on a change in pull request #520: PHOENIX-5333: A tool to upgrade existing tables/indexes to use self-c…
URL: https://github.com/apache/phoenix/pull/520#discussion_r295514182
 
 

 ##########
 File path: phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexUpgradeToolIT.java
 ##########
 @@ -0,0 +1,506 @@
+package org.apache.phoenix.end2end;
+
+import com.google.common.collect.Maps;
+import org.apache.hadoop.hbase.HConstants;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.TableNotFoundException;
+import org.apache.hadoop.hbase.client.Admin;
+import org.apache.hadoop.hbase.client.Table;
+import org.apache.phoenix.hbase.index.IndexRegionObserver;
+import org.apache.phoenix.hbase.index.Indexer;
+import org.apache.phoenix.index.GlobalIndexChecker;
+import org.apache.phoenix.jdbc.PhoenixConnection;
+import org.apache.phoenix.mapreduce.index.IndexUpgradeTool;
+import org.apache.phoenix.query.BaseTest;
+import org.apache.phoenix.query.ConnectionQueryServices;
+import org.apache.phoenix.query.QueryServices;
+import org.apache.phoenix.query.QueryServicesOptions;
+import org.apache.phoenix.util.PropertiesUtil;
+import org.apache.phoenix.util.ReadOnlyProps;
+import org.apache.phoenix.util.SchemaUtil;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized.Parameters;
+import org.junit.runners.Parameterized;
+
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Map;
+import java.util.Properties;
+import java.util.UUID;
+
+@RunWith(Parameterized.class)
+@Category(NeedsOwnMiniClusterTest.class)
+public class IndexUpgradeToolIT extends BaseTest {
+
+    private final boolean mutable;
+    private final boolean upgrade;
+    private StringBuilder optionsBuilder;
+    private String tableDDLOptions;
+
+    private static Map<String, String> serverProps = Maps.newHashMapWithExpectedSize(1), clientProps = Maps.newHashMapWithExpectedSize(1);
+
+    private String [] indexesList = {"TEST.INDEX1", "TEST.INDEX2", "TEST1.INDEX3","TEST1.INDEX2","TEST1.INDEX1","TEST.INDEX3"};
+    private String [] tableList = {"TEST.MOCK1","TEST1.MOCK2","TEST.MOCK3"};
+
+    private String inputList = "TEST.MOCK1:INDEX1,INDEX2;TEST1.MOCK2:INDEX3,INDEX2,INDEX1;TEST.MOCK3:INDEX3";
+
+
+    @Before
+    public void setup () throws Exception {
+        optionsBuilder = new StringBuilder();
+
+        if (upgrade) {
+            if ((Boolean.TRUE.toString()).equals(clientProps.get(QueryServices.INDEX_REGION_OBSERVER_ENABLED_ATTRIB))) {
+                tearDownMiniClusterAsync(1);
+            }
+            clientProps.put(QueryServices.INDEX_REGION_OBSERVER_ENABLED_ATTRIB, Boolean.FALSE.toString());
+        } else {
+            if ((Boolean.FALSE.toString()).equals(clientProps.get(QueryServices.INDEX_REGION_OBSERVER_ENABLED_ATTRIB))) {
+                tearDownMiniClusterAsync(1);
 
 Review comment:
   Tearing down miniclusters and building them back up again is costly (takes a minute or two each time). You'd only need to do that if you're varying server properties, which it doesn't look like you are.
   
   If you _do_ need to vary server properties, consider splitting into two test suites, one of which uses one set of props and the other the other, so there are only 2 startups and shutdowns instead of a cross product. 

----------------------------------------------------------------
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


With regards,
Apache Git Services