gjacoby126 commented on a change in pull request #692: PHOENIX-5689:
TableNotFoundException in IndexUpgradeTool in case of v…
URL: https://github.com/apache/phoenix/pull/692#discussion_r372064755
##########
File path:
phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexUpgradeToolIT.java
##########
@@ -19,76 +19,121 @@
import org.apache.phoenix.mapreduce.index.IndexUpgradeTool;
import org.apache.phoenix.query.BaseTest;
+import org.apache.phoenix.util.PhoenixRuntime;
+import org.apache.phoenix.util.PropertiesUtil;
import org.apache.phoenix.util.ReadOnlyProps;
import org.apache.phoenix.util.SchemaUtil;
import org.junit.Assert;
+import org.junit.Before;
+import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Properties;
+import static org.apache.phoenix.util.TestUtil.TEST_PROPERTIES;
+
+@RunWith(Parameterized.class)
public class IndexUpgradeToolIT extends BaseTest {
public static final String
VERIFY_COUNT_ASSERT_MESSAGE = "view-index count in system table
doesn't match";
+ private final boolean multiTenant;
+ private String tenantId = null;
+
+ public IndexUpgradeToolIT(boolean multiTenant) {
+ this.multiTenant = multiTenant;
+ }
+
+ @Parameters(name="isMultiTenant = {0}")
+ public static synchronized Collection<Boolean[]> data() {
+ return Arrays.asList(new Boolean[][] {
+ { true },{ false }
+ });
+ }
+
+ @BeforeClass
+ public static void setup() throws Exception {
+ Map<String, String> props = Collections.emptyMap();
+ setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator()));
+ }
@Test
public void verifyViewAndViewIndexes() throws Exception {
String tableName = generateUniqueName();
String schemaName = generateUniqueName();
- Map<String, String> props = Collections.emptyMap();
- setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator()));
-
- try (Connection conn = DriverManager.getConnection(getUrl(), new
Properties())) {
+ Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+ if (multiTenant) {
+ tenantId = generateUniqueName();
+ props.setProperty(PhoenixRuntime.TENANT_ID_ATTRIB, tenantId);
+ }
+ try (Connection conn = DriverManager.getConnection(getUrl(), props)) {
prepareForTest(conn, schemaName, tableName);
- IndexUpgradeTool iut = new IndexUpgradeTool();
- String viewQuery = iut.getViewSql(tableName, schemaName);
+ String viewQuery = IndexUpgradeTool.getViewSql(tableName,
schemaName);
ResultSet rs = conn.createStatement().executeQuery(viewQuery);
int countViews = 0;
List<String> views = new ArrayList<>();
- List<Integer> indexCount = new ArrayList<>();
+ List<String> tenants = new ArrayList<>();
while (rs.next()) {
views.add(rs.getString(1));
+ if(multiTenant) {
Review comment:
Comment would be useful to remind that the first column is the view and the
second column is the tenant id
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services