-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Db 11134 4 #5697
base: master
Are you sure you want to change the base?
Db 11134 4 #5697
Changes from 6 commits
04cc8a6
82a64dc
057563e
269d7fb
95dbd0d
d607b8a
fce3f9e
47e73d7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
/* | ||
* Copyright (c) 2012 - 2020 Splice Machine, Inc. | ||
* | ||
* This file is part of Splice Machine. | ||
* Splice Machine is free software: you can redistribute it and/or modify it under the terms of the | ||
* GNU Affero General Public License as published by the Free Software Foundation, either | ||
* version 3, or (at your option) any later version. | ||
* Splice Machine is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; | ||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
* See the GNU Affero General Public License for more details. | ||
* You should have received a copy of the GNU Affero General Public License along with Splice Machine. | ||
* If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package com.splicemachine.derby.impl.sql.execute.upgrade; | ||
|
||
import com.splicemachine.access.hbase.HBasePartitionAdmin; | ||
import com.splicemachine.db.impl.sql.catalog.SYSNATURALNUMBERSRowFactory; | ||
import com.splicemachine.derby.test.framework.SpliceSchemaWatcher; | ||
import com.splicemachine.derby.test.framework.SpliceUnitTest; | ||
import com.splicemachine.derby.test.framework.SpliceWatcher; | ||
import org.apache.hadoop.conf.Configuration; | ||
import org.apache.hadoop.hbase.client.Admin; | ||
import org.apache.hadoop.hbase.client.Connection; | ||
import org.apache.hadoop.hbase.client.ConnectionFactory; | ||
import org.junit.*; | ||
import org.junit.rules.RuleChain; | ||
import org.junit.rules.TestRule; | ||
|
||
/** | ||
* Note: These tests need to be excluded in platform_it/pom.xml, | ||
* as they are only mean to be run with the check_upgrade.sh script. | ||
* | ||
* e.g. | ||
* bash pipelines/upgrade-testing/check_upgrade.sh 3.1.0.2000 -T 4 | ||
* this downloads a tar.gz (here https://splice-snapshots.s3.amazonaws.com/upgrade_tests/platform_it_3.1.0.2000.tar.gz) | ||
* extracts that, then starts the cluster with that data (without clean), and then executes the UpgradeTestIT | ||
* | ||
* see also | ||
* pipelines/upgrade-testing/check_upgrade.sh | ||
* pipelines/upgrade-testing/create_upgrade_targz.sh | ||
* https://s3.console.aws.amazon.com/s3/buckets/splice-snapshots?region=us-east-1&prefix=upgrade_tests/&showversions=false | ||
*/ | ||
public class UpgradeTestIT extends SpliceUnitTest { | ||
|
||
private static final String SCHEMA_NAME = UpgradeTestIT.class.getSimpleName().toUpperCase(); | ||
private static final SpliceWatcher spliceClassWatcher = new SpliceWatcher(SCHEMA_NAME); | ||
private static final SpliceSchemaWatcher spliceSchemaWatcher = new SpliceSchemaWatcher(SCHEMA_NAME); | ||
@Rule | ||
public SpliceWatcher methodWatcher = new SpliceWatcher(SCHEMA_NAME); | ||
|
||
@ClassRule | ||
public static TestRule chain = RuleChain.outerRule(spliceClassWatcher) | ||
.around(spliceSchemaWatcher); | ||
|
||
@Test // 1983 | ||
public void testUpgradeScriptToAddBaseTableSchemaColumnsToSysTablesInSYSIBM() throws Exception { | ||
String expected = | ||
"NAME | CREATOR |TYPE |COLCOUNT |KEYCOLUMNS | KEYUNIQUE |CODEPAGE | BASE_NAME | BASE_SCHEMA |\n" + | ||
"-------------------------------------------------------------------------------------------------\n" + | ||
"SYSTABLES | SYSIBM | V | 9 | 0 | 0 | 1208 | NULL | NULL |"; | ||
SpliceUnitTest.sqlExpectToString(methodWatcher, | ||
"select * from sysibm.SYSTABLES WHERE NAME='SYSTABLES' AND CREATOR='SYSIBM'", | ||
expected, false); | ||
} | ||
|
||
@Test // 1985 | ||
public void testUpgradeScriptToAddSysNaturalNumbersTable() throws Exception { | ||
Assert.assertEquals(SYSNATURALNUMBERSRowFactory.MAX_NUMBER, | ||
methodWatcher.executeGetInt("select count(*) from SYS.SYSNATURALNUMBERS", 1) ); | ||
} | ||
|
||
@Test // 1989 | ||
public void testUpgradeScriptToAddIndexColUseViewInSYSCAT() throws Exception { | ||
SpliceUnitTest.sqlExpectToString(methodWatcher, | ||
"select TABLENAME from sysvw.systablesview WHERE TABLENAME='INDEXCOLUSE'", | ||
"TABLENAME |\n" + | ||
"-------------\n" + | ||
"INDEXCOLUSE |", | ||
false); | ||
} | ||
|
||
@Test // 1992 | ||
public void testUpgradeScriptForTablePriorities() throws Exception { | ||
try(Connection conn = ConnectionFactory.createConnection(new Configuration()); | ||
Admin admin= conn.getAdmin()) { | ||
Assert.assertEquals(0, HBasePartitionAdmin.getToUpgradeStream(admin.listTableDescriptors()).count()); | ||
} | ||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/bin/bash | ||
|
||
UPGRADE_URL=s3://splice-snapshots/upgrade_tests | ||
|
||
VERSION=${1} # e.g. 3.1.0.1971 | ||
shift 1 | ||
|
||
PREVIOUS_BRANCH=`git rev-parse --abbrev-ref HEAD` | ||
git stash | ||
|
||
# creates a file platform_it_${VERSION}.tar.gz | ||
git checkout tags/${VERSION} | ||
cd platform_it | ||
rm -rf target *.log snappy*.jnilib | ||
cd .. | ||
|
||
./start-splice-cluster $* | ||
./start-splice-cluster -k | ||
|
||
rm -rf upgrade_test_TMP | ||
mkdir -p upgrade_test_TMP/platform_it/target | ||
cd upgrade_test_TMP | ||
cp -r ../platform_it/target/hbase platform_it/target/. | ||
cp -r ../platform_it/target/zookeeper platform_it/target/. | ||
tar -czvf ../platform_it_${VERSION}.tar.gz platform_it | ||
cd .. | ||
rm -rf upgrade_test_TMP | ||
|
||
git checkout ${PREVIOUS_BRANCH} | ||
git stash pop | ||
|
||
# restart on that version | ||
./start-splice-cluster $* | ||
|
||
# clean up platform_it | ||
cd platform_it | ||
git clean -dfx | ||
cd .. | ||
|
||
# download the previous standalone data | ||
tar -xzvf platform_it_${VERSION}.tar.gz | ||
rm platform_it_${VERSION}.tar.gz | ||
|
||
# restart cluster | ||
./start-splice-cluster -l $* | ||
|
||
# test | ||
if mvn -B -e surefire:test -Pcore,cdh6.3.0 -Dtest='UpgradeTestIT#*' -DskipServerStart -DfailIfNoTests=false; then | ||
echo "UPGRADE SUCCEEDED" | ||
cat platform_it/splice.log | grep 'upgrade scripts' | ||
cat platform_it/splice.log | grep 'Running upgrade script' | ||
else | ||
echo "!!! UPGRADE FAILED !!!" | ||
fi | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sometimes an upgrade problem shows up after a restart. It would be nice if you can restart splice and run the test again. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. well i thought what i am doing IS a restart, no?
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/bin/bash | ||
UPGRADE_URL=s3://splice-snapshots/upgrade_tests | ||
|
||
if [ $# -lt 2 ] | ||
then | ||
echo "usage: bash create_upgrade_targz.sh {VERSION} {additional start-splice-cluster parameters}" | ||
echo "------------------------------------------------------------------------------------------" | ||
echo "uses a previously created tar.gz to test upgrade" | ||
echo "e.g. bash create_upgrade_targz.sh 3.2.2021 -T 16" | ||
echo "make sure you current branch has already been build" | ||
echo "don't use -b, since we are deleting some files in platform_it/target" | ||
|
||
exit 1 | ||
fi | ||
|
||
VERSION=${1} | ||
shift | ||
|
||
# stop current cluster | ||
./start-splice-cluster -k | ||
|
||
# clean up platform_it | ||
cd platform_it | ||
git clean -dfx | ||
cd .. | ||
|
||
# download the previous standalone data | ||
aws s3 cp ${UPGRADE_URL}/platform_it_${VERSION}.tar.gz . | ||
tar -xzvf platform_it_${VERSION}.tar.gz | ||
rm platform_it_${VERSION}.tar.gz | ||
|
||
# restart cluster | ||
./start-splice-cluster -l $* | ||
|
||
# test | ||
if mvn -B -e surefire:test -Pcore,cdh6.3.0 -Dtest='UpgradeTestIT#*' -DskipServerStart -DfailIfNoTests=false; then | ||
echo "UPGRADE SUCCEEDED" | ||
cat platform_it/splice.log | grep 'upgrade scripts' | ||
cat platform_it/splice.log | grep 'Running upgrade script' | ||
else | ||
echo "!!! UPGRADE FAILED !!!" | ||
fi |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/bin/bash | ||
|
||
UPGRADE_URL=s3://splice-snapshots/upgrade_tests | ||
|
||
|
||
if [ $# -lt 2 ] | ||
then | ||
echo "usage: bash platform_it/src/test/bin/create_upgrade_targz.sh {VERSION} {test/upload} {additional start-splice-cluster parameters}" | ||
echo "----------------------------------------------------------------------------------------------------------------------------------" | ||
echo "creates a tar.gz of a spliceengine standalone cluster that can be used to test upgrade" | ||
echo "e.g. bash create_upgrade_targz.sh 3.1.0.1971 test -T 16 -pcore,cdh6.3.0" | ||
exit 1 | ||
fi | ||
|
||
VERSION=${1} # e.g. 3.1.0.1971 | ||
MODE=${2} # test or upload | ||
shift 2 | ||
|
||
|
||
PREVIOUS_BRANCH=`git rev-parse --abbrev-ref HEAD` | ||
git stash | ||
|
||
# creates a file platform_it_${VERSION}.tar.gz | ||
git checkout tags/${VERSION} | ||
cd platform_it | ||
rm -rf target *.log snappy*.jnilib | ||
cd .. | ||
|
||
./start-splice-cluster $* | ||
./start-splice-cluster -k | ||
|
||
rm -rf upgrade_test_TMP | ||
mkdir -p upgrade_test_TMP/platform_it/target | ||
cd upgrade_test_TMP | ||
cp -r ../platform_it/target/hbase platform_it/target/. | ||
cp -r ../platform_it/target/zookeeper platform_it/target/. | ||
tar -czvf ../platform_it_${VERSION}.tar.gz platform_it | ||
cd .. | ||
rm -rf upgrade_test_TMP | ||
|
||
if [[ $MODE == "upload" ]]; then | ||
aws s3 cp platform_it_${VERSION}.tar.gz ${UPGRADE_URL}/platform_it_${VERSION}.tar.gz | ||
fi | ||
|
||
git checkout ${PREVIOUS_BRANCH} | ||
git stash pop |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -460,6 +460,8 @@ | |
<excludes> | ||
<exclude>com/splicemachine/derby/impl/sql/execute/operations/window/test/framework/** | ||
</exclude> | ||
<exclude>com/splicemachine/derby/impl/sql/execute/upgrade/UpgradeTestIT.java | ||
</exclude> | ||
</excludes> | ||
<runOrder>alphabetical</runOrder> | ||
<systemPropertyVariables> | ||
|
@@ -495,6 +497,10 @@ | |
<includes> | ||
<include>**/*IT.java</include> | ||
</includes> | ||
<excludes> | ||
<exclude>com/splicemachine/derby/impl/sql/execute/upgrade/UpgradeTestIT.java | ||
</exclude> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can rename UpgradeTestIT to a name not ending with IT or Test, to avoid excluding it from IT |
||
</excludes> | ||
<runOrder>alphabetical</runOrder> | ||
<systemPropertyVariables> | ||
<splice.schemaCleanup>async</splice.schemaCleanup> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ran this command, but -T option is not accepted by ./start-splice-cluster
./start-splice-cluster: illegal option -- T
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, -T was only introduced in 3.x.0.2001, so this doesn't work.