-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#2665: [YSQL] one of Masters crashed when we tried to delete YSQL dat…
…abase Summary: Removed invalid check in the yb::master::CatalogManager::DeleteYsqlDatabase method. Test Plan: ybd --java-test org.yb.multiapi.TestMultiAPI Reviewers: alex, neha Reviewed By: neha Subscribers: dmitry, yql, bogdan Differential Revision: https://phabricator.dev.yugabyte.com/D7464
- Loading branch information
1 parent
cd648fe
commit 6158182
Showing
5 changed files
with
230 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
<?xml version="1.0"?> | ||
<!-- Copyright (c) YugaByte, Inc. --> | ||
<project | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" | ||
xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.yb</groupId> | ||
<artifactId>yb-parent</artifactId> | ||
<version>0.8.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>yb-multiapi</artifactId> | ||
<name>YB Multi API</name> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.yb</groupId> | ||
<artifactId>yb-client</artifactId> | ||
<type>test-jar</type> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.yb</groupId> | ||
<artifactId>yb-client</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.yb</groupId> | ||
<artifactId>yb-cql</artifactId> | ||
<type>test-jar</type> | ||
<scope>test</scope> | ||
<!-- Exclude Cassandra driver because it is already included by Spark --> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>com.yugabyte</groupId> | ||
<artifactId>cassandra-driver-core</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.yb</groupId> | ||
<artifactId>yb-pgsql</artifactId> | ||
<type>test-jar</type> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>${junit.groupId}</groupId> | ||
<artifactId>junit</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>commons-cli</groupId> | ||
<artifactId>commons-cli</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>commons-codec</groupId> | ||
<artifactId>commons-codec</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.spark</groupId> | ||
<artifactId>spark-core_2.10</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.spark</groupId> | ||
<artifactId>spark-sql_2.10</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.commons</groupId> | ||
<artifactId>commons-math3</artifactId> | ||
<version>3.5</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.google.code.gson</groupId> | ||
<artifactId>gson</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.postgresql</groupId> | ||
<artifactId>postgresql</artifactId> | ||
<version>42.2.2</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-dependency-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>copy-dependencies</id> | ||
<phase>${maven-dependency-plugin.phase}</phase> | ||
<goals> | ||
<goal>copy-dependencies</goal> | ||
</goals> | ||
<configuration> | ||
<outputDirectory>${project.build.directory}/lib</outputDirectory> | ||
<overWriteReleases>true</overWriteReleases> | ||
<overWriteSnapshots>true</overWriteSnapshots> | ||
<overWriteIfNewer>true</overWriteIfNewer> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<!-- make the jar executable by adding a Main-Class and Class-Path to the manifest --> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-jar-plugin</artifactId> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
45 changes: 45 additions & 0 deletions
45
java/yb-multiapi/src/test/java/org/yb/multiapi/TestMultiAPI.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// Copyright (c) YugaByte, Inc. | ||
// | ||
// Licensed 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.yb.multiapi; | ||
|
||
import java.sql.Statement; | ||
import org.junit.Test; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
public class TestMultiAPI extends TestMultiAPIBase { | ||
private static final Logger LOG = LoggerFactory.getLogger(TestMultiAPI.class); | ||
|
||
// This tests the fix for issue https://github.com/YugaByte/yugabyte-db/issues/2665. | ||
// Testing the case when there is CQL keyspace with the same name as a SQL DB. | ||
@Test | ||
public void testDropDB() throws Exception { | ||
String dbName = "dtest"; | ||
LOG.info("Start test: " + getCurrentTestMethodName()); | ||
|
||
try (Statement statement = connection.createStatement()) { | ||
LOG.info("Create SQL DB"); | ||
statement.execute(String.format("CREATE DATABASE %s", dbName)); | ||
|
||
LOG.info("Create CQL keyspace with used DB name"); | ||
cqlSession.execute(String.format("CREATE KEYSPACE %s", dbName)); | ||
|
||
LOG.info("Drop SQL DB"); | ||
statement.execute(String.format("DROP DATABASE %s", dbName)); | ||
|
||
LOG.info("Drop CQL keyspace"); | ||
cqlSession.execute(String.format("DROP KEYSPACE %s", dbName)); | ||
} | ||
LOG.info("End test: " + getCurrentTestMethodName()); | ||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
java/yb-multiapi/src/test/java/org/yb/multiapi/TestMultiAPIBase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// Copyright (c) YugaByte, Inc. | ||
// | ||
// Licensed 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.yb.multiapi; | ||
|
||
import java.util.Map; | ||
import com.datastax.driver.core.Session; | ||
import org.junit.BeforeClass; | ||
import org.junit.Before; | ||
import org.junit.After; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import org.yb.pgsql.BasePgSQLTest; | ||
import org.yb.cql.BaseCQLTest; | ||
|
||
public class TestMultiAPIBase extends BasePgSQLTest { | ||
private static final Logger LOG = LoggerFactory.getLogger(TestMultiAPIBase.class); | ||
|
||
public class CQLApi extends BaseCQLTest { | ||
Session getSession() { return super.session; } | ||
}; | ||
|
||
protected CQLApi cqlApi; | ||
protected Session cqlSession; | ||
|
||
@Override | ||
protected Map<String, String> getTServerFlags() { | ||
Map<String, String> flagMap = super.getTServerFlags(); | ||
flagMap.put("start_cql_proxy", Boolean.toString(true)); | ||
return flagMap; | ||
} | ||
|
||
@BeforeClass | ||
public static void setUpBeforeClass() throws Exception { | ||
BaseCQLTest.setUpBeforeClass(); | ||
} | ||
|
||
@Before | ||
public void setUpCql() throws Exception { | ||
cqlApi = new CQLApi(); | ||
cqlApi.setUpCqlClient(); | ||
cqlSession = cqlApi.getSession(); | ||
} | ||
|
||
@After | ||
public void tearDownCql() throws Exception { | ||
cqlApi.tearDownAfter(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters