-
Notifications
You must be signed in to change notification settings - Fork 221
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Mark Hannum <[email protected]>
- Loading branch information
1 parent
c3585fb
commit 309b303
Showing
8 changed files
with
170 additions
and
45 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
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
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,8 @@ | ||
ifeq ($(TESTSROOTDIR),) | ||
include ../testcase.mk | ||
else | ||
include $(TESTSROOTDIR)/testcase.mk | ||
endif | ||
ifeq ($(TEST_TIMEOUT),) | ||
export TEST_TIMEOUT=10m | ||
endif |
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 @@ | ||
Simple test for basic features of cdb2_printlog |
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,101 @@ | ||
#!/usr/bin/env bash | ||
bash -n "$0" | exit 1 | ||
|
||
export debug=1 | ||
export firstnode="" | ||
|
||
[[ "$debug" == "1" ]] && set -x | ||
|
||
. ${TESTSROOTDIR}/tools/cluster_utils.sh | ||
. ${TESTSROOTDIR}/tools/ddl.sh | ||
. ${TESTSROOTDIR}/tools/runit_common.sh | ||
|
||
function flush_db | ||
{ | ||
if [[ -n "$CLUSTER" ]]; then | ||
for node in $CLUSTER ; do | ||
$CDB2SQL_EXE $CDB2_OPTIONS $DBNAME --host $node "exec procedure sys.cmd.send('flush')" | ||
done | ||
else | ||
$CDB2SQL_EXE $CDB2_OPTIONS $DBNAME default "exec procedure sys.cmd.send('flush')" | ||
fi | ||
} | ||
|
||
function create_lots_of_btrees | ||
{ | ||
j=0 | ||
while [[ "$j" -lt "100" ]]; do | ||
$CDB2SQL_EXE $CDB2_OPTIONS $DBNAME default "create table if not exists x${j}(a int, b blob, c blob, d blob, e blob)" | ||
let j=j+1 | ||
done | ||
} | ||
|
||
function printlog_multiple_files() | ||
{ | ||
output=./multiple.txt | ||
if [[ -z "$CLUSTER" ]]; then | ||
$COMDB2_EXE --tool cdb2_printlog -h $DBDIR/logs -l 2-3 > $output | ||
else | ||
ssh -n -o StrictHostKeyChecking=no -tt $firstnode "$COMDB2_EXE --tool cdb2_printlog -h $DBDIR/logs -l 2-3" < /dev/null 2>/dev/null > $output | ||
fi | ||
|
||
cnt=$(egrep "^\[1" $output | wc -l) | ||
[[ "$cnt" == "0" ]] || failexit "printlog_one_file has records from logfile 1" | ||
cnt=$(egrep "^\[4" $output | wc -l) | ||
[[ "$cnt" == "0" ]] || failexit "printlog_one_file has records from logfile 4" | ||
cnt=$(egrep "^\[2" $output | wc -l) | ||
[[ "$cnt" > "1000" ]] || failexit "printlog_one_file has less than 1000 records from logfile 2" | ||
cnt=$(egrep "^\[3" $output | wc -l) | ||
[[ "$cnt" > "1000" ]] || failexit "printlog_one_file has less than 1000 records from logfile 3" | ||
} | ||
|
||
function printlog_one_file() | ||
{ | ||
output=./onefile.txt | ||
if [[ -z "$CLUSTER" ]]; then | ||
$COMDB2_EXE --tool cdb2_printlog -h $DBDIR/logs -l 2 > $output | ||
else | ||
ssh -n -o StrictHostKeyChecking=no -tt $firstnode "$COMDB2_EXE --tool cdb2_printlog -h $DBDIR/logs -l 2" < /dev/null 2>/dev/null > $output | ||
fi | ||
|
||
# Verify output file has no records from logfile 1 or 3 | ||
cnt=$(egrep "^\[1" $output | wc -l) | ||
[[ "$cnt" == "0" ]] || failexit "printlog_one_file has records from logfile 1" | ||
cnt=$(egrep "^\[3" $output | wc -l) | ||
[[ "$cnt" == "0" ]] || failexit "printlog_one_file has records from logfile 3" | ||
|
||
# Verify output flie has multiple records from logfile 2 | ||
cnt=$(egrep "^\[2" $output | wc -l) | ||
[[ "$cnt" < "1000" ]] && failexit "printlog_one_file has less than 1000 records from logfile 2" | ||
|
||
# Specify non-existent log | ||
noexist=./nonexist.txt | ||
if [[ -z "$CLUSTER" ]]; then | ||
$COMDB2_EXE --tool cdb2_printlog -h $DBDIR/logs -l 100 > $noexist | ||
else | ||
ssh -n -o StrictHostKeyChecking=no -tt $firstnode "$COMDB2_EXE --tool cdb2_printlog -h $DBDIR/logs -l 100" < /dev/null 2>/dev/null > $noexist | ||
fi | ||
|
||
# Just verify an empty file | ||
cnt=$(cat $noexist | wc -l) | ||
[[ "$cnt" == 0 ]] || failexit "printlog_one_file has records from non-existent logfile" | ||
} | ||
|
||
if [[ -n "$CLUSTER" ]]; then | ||
for node in $CLUSTER ; do | ||
export firstnode=$node | ||
break | ||
done | ||
fi | ||
|
||
function printlog_test() | ||
{ | ||
printlog_one_file | ||
printlog_multiple_files | ||
# TODO: emit every record-type (but dont commit) | ||
} | ||
|
||
create_lots_of_btrees | ||
printlog_test | ||
flush_db | ||
|
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