-
Notifications
You must be signed in to change notification settings - Fork 217
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DRQS 177610804: Enable record truncation for index verify
Signed-off-by: lzhu286 <[email protected]>
- Loading branch information
lzhu286
committed
Jan 31, 2025
1 parent
2dc04c8
commit 0fcb916
Showing
7 changed files
with
91 additions
and
6 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,8 @@ | ||
ifeq ($(TESTSROOTDIR),) | ||
include ../testcase.mk | ||
else | ||
include $(TESTSROOTDIR)/testcase.mk | ||
endif | ||
ifeq ($(TEST_TIMEOUT),) | ||
export TEST_TIMEOUT=3m | ||
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,2 @@ | ||
table names names.csc2 | ||
legacy_schema off |
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,12 @@ | ||
tag ondisk | ||
{ | ||
cstring name[5] | ||
int id | ||
vutf8 desc[25] | ||
} | ||
|
||
keys | ||
{ | ||
"P_KEY" = name + id | ||
dup "SHORT_DESC" = (cstring[17])"desc" { where id < 2 } | ||
} |
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,22 @@ | ||
#!/usr/bin/env bash | ||
bash -n "$0" | exit 1 | ||
|
||
DBNAME=$1 | ||
TESTNAME="verify_index_expressions" | ||
SQL="$TESTNAME.sql" | ||
OUTPUT="$TESTNAME.out" | ||
EXPECTED="$TESTNAME.expected" | ||
|
||
rm -f $OUTPUT | ||
|
||
cdb2sql ${CDB2_OPTIONS} -f $SQL $DBNAME default > $OUTPUT | ||
cdb2sql ${CDB2_OPTIONS} $DBNAME default "explain select * from names where id < 2" >> $OUTPUT | ||
cdb2sql ${CDB2_OPTIONS} $DBNAME default "exec procedure sys.cmd.verify('names')" >> $OUTPUT | ||
diff $OUTPUT $EXPECTED > /dev/null | ||
rc=$? | ||
if [[ $rc -ne 0 ]]; then | ||
echo "Failed $TESTNAME test" | ||
echo diff $(pwd)/$OUTPUT $(pwd)/$EXPECTED | ||
fi | ||
|
||
exit $rc |
25 changes: 25 additions & 0 deletions
25
tests/verify_index_expressions.test/verify_index_expressions.expected
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,25 @@ | ||
[BEGIN] rc 0 | ||
[INSERT INTO names VALUES("nick", 0, "nicholas")] rc 0 | ||
[INSERT INTO names VALUES("nick", 1, "nicholas the 1st")] rc 0 | ||
[INSERT INTO names VALUES("nick", 2, "nicholas the 2nd.")] rc 0 | ||
[INSERT INTO names VALUES("nick", 3, "nicholas the 3rd & final")] rc 0 | ||
[COMMIT] rc 0 | ||
(addr=0, opcode='Init', p1=0, p2=16, p3=0, p4='', p5='00', comment='Start at 16') | ||
(addr=1, opcode='OpenRead', p1=0, p2=8, p3=0, p4='3', p5='02', comment='root=8 iDb=0; names') | ||
(addr=2, opcode='ColumnsUsed', p1=0, p2=0, p3=0, p4='7', p5='00', comment='') | ||
(addr=3, opcode='OpenRead', p1=1, p2=10, p3=0, p4='k(2,,)', p5='00', comment='root=10 iDb=0; $SHORT_DESC_C53B9974') | ||
(addr=4, opcode='ColumnsUsed', p1=1, p2=0, p3=0, p4='1', p5='00', comment='') | ||
(addr=5, opcode='Explain', p1=5, p2=0, p3=0, p4='SCAN TABLE names USING INDEX $SHORT_DESC_C53B9974 (~491520 rows)', p5='00', comment='') | ||
(addr=6, opcode='Rewind', p1=1, p2=13, p3=1, p4='0', p5='00', comment='') | ||
(addr=7, opcode='DeferredSeek', p1=1, p2=0, p3=0, p4='', p5='00', comment='Move 0 to 1.rowid if needed') | ||
(addr=8, opcode='Column', p1=0, p2=0, p3=1, p4='', p5='00', comment='r[1]=names.name') | ||
(addr=9, opcode='Column', p1=0, p2=1, p3=2, p4='', p5='00', comment='r[2]=names.id') | ||
(addr=10, opcode='Column', p1=1, p2=0, p3=3, p4='', p5='00', comment='r[3]=names.desc') | ||
(addr=11, opcode='ResultRow', p1=1, p2=3, p3=0, p4='', p5='00', comment='output=r[1..3]') | ||
(addr=12, opcode='Next', p1=1, p2=7, p3=0, p4='', p5='01', comment='') | ||
(addr=13, opcode='Close', p1=0, p2=0, p3=0, p4='', p5='00', comment='') | ||
(addr=14, opcode='Close', p1=1, p2=0, p3=0, p4='', p5='00', comment='') | ||
(addr=15, opcode='Halt', p1=0, p2=0, p3=0, p4='', p5='00', comment='') | ||
(addr=16, opcode='Transaction', p1=0, p2=0, p3=0, p4='0', p5='01', comment='usesStmtJournal=0') | ||
(addr=17, opcode='Goto', p1=0, p2=1, p3=0, p4='', p5='00', comment='') | ||
(out='Verify succeeded.') |
7 changes: 7 additions & 0 deletions
7
tests/verify_index_expressions.test/verify_index_expressions.sql
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,7 @@ | ||
|
||
BEGIN | ||
INSERT INTO names VALUES("nick", 0, "nicholas") | ||
INSERT INTO names VALUES("nick", 1, "nicholas the 1st") | ||
INSERT INTO names VALUES("nick", 2, "nicholas the 2nd.") | ||
INSERT INTO names VALUES("nick", 3, "nicholas the 3rd & final") | ||
COMMIT |