| From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 |
| From: Conrad Irwin <conrad.irwin@gmail.com> |
| Date: Fri, 4 Oct 2019 09:30:44 -0700 |
| Subject: [PATCH 8/8] Fix a long-standing problem in fts4 incrmental merge. |
| MIME-Version: 1.0 |
| Content-Type: text/plain; charset=UTF-8 |
| Content-Transfer-Encoding: 8bit |
| |
| Backport https://sqlite.org/src/info/67da31e24ebb49c4 |
| |
| Bug: 998494 |
| --- |
| .../sqlite/patched/ext/fts3/fts3_write.c | 4 +- |
| .../sqlite/patched/test/fts4merge5.test | 58 +++++++++++++++++++ |
| .../sqlite/patched/test/permutations.test | 1 + |
| 3 files changed, 61 insertions(+), 2 deletions(-) |
| create mode 100644 third_party/sqlite/patched/test/fts4merge5.test |
| |
| diff --git a/third_party/sqlite/patched/ext/fts3/fts3_write.c b/third_party/sqlite/patched/ext/fts3/fts3_write.c |
| index 6152c82871cf..c22711dad8c7 100644 |
| --- a/third_party/sqlite/patched/ext/fts3/fts3_write.c |
| +++ b/third_party/sqlite/patched/ext/fts3/fts3_write.c |
| @@ -4295,8 +4295,8 @@ static int fts3IncrmergeLoad( |
| NodeReader reader; |
| pNode = &pWriter->aNodeWriter[i]; |
| |
| - rc = nodeReaderInit(&reader, pNode->block.a, pNode->block.n); |
| - if( reader.aNode ){ |
| + if ( pNode->block.a){ |
| + rc = nodeReaderInit(&reader, pNode->block.a, pNode->block.n); |
| while( reader.aNode && rc==SQLITE_OK ) rc = nodeReaderNext(&reader); |
| blobGrowBuffer(&pNode->key, reader.term.n, &rc); |
| if( rc==SQLITE_OK ){ |
| diff --git a/third_party/sqlite/patched/test/fts4merge5.test b/third_party/sqlite/patched/test/fts4merge5.test |
| new file mode 100644 |
| index 000000000000..1fad778b95e7 |
| --- /dev/null |
| +++ b/third_party/sqlite/patched/test/fts4merge5.test |
| @@ -0,0 +1,58 @@ |
| +# 2019 October 02 |
| +# |
| +# The author disclaims copyright to this source code. In place of |
| +# a legal notice, here is a blessing: |
| +# |
| +# May you do good and not evil. |
| +# May you find forgiveness for yourself and forgive others. |
| +# May you share freely, never taking more than you give. |
| +# |
| +#************************************************************************* |
| +# This file implements regression tests for SQLite library. The |
| +# focus of this script is testing the FTS4 module. |
| +# |
| + |
| +set testdir [file dirname $argv0] |
| +source $testdir/tester.tcl |
| +set testprefix fts4merge5 |
| + |
| +# If SQLITE_ENABLE_FTS3 is defined, omit this file. |
| +ifcapable !fts3 { |
| + finish_test |
| + return |
| +} |
| + |
| +source $testdir/genesis.tcl |
| + |
| +do_execsql_test 1.1 { |
| + CREATE TABLE t1(docid, words); |
| +} |
| +fts_kjv_genesis |
| + |
| +do_execsql_test 1.2 { |
| + CREATE VIRTUAL TABLE x1 USING fts3; |
| + INSERT INTO x1(x1) VALUES('nodesize=64'); |
| + INSERT INTO x1(x1) VALUES('maxpending=64'); |
| +} |
| + |
| +do_execsql_test 1.3 { |
| + INSERT INTO x1(docid, content) SELECT * FROM t1; |
| +} |
| + |
| +for {set tn 1} {1} {incr tn} { |
| + set tc1 [db total_changes] |
| + do_execsql_test 1.4.$tn.1 { |
| + INSERT INTO x1(x1) VALUES('merge=1,2'); |
| + } |
| + set tc2 [db total_changes] |
| + |
| + if {($tc2 - $tc1)<2} break |
| + |
| + do_execsql_test 1.4.$tn.1 { |
| + INSERT INTO x1(x1) VALUES('integrity-check'); |
| + } |
| +} |
| + |
| + |
| + |
| +finish_test |
| diff --git a/third_party/sqlite/patched/test/permutations.test b/third_party/sqlite/patched/test/permutations.test |
| index ac2125c73b12..717998ef3e5d 100644 |
| --- a/third_party/sqlite/patched/test/permutations.test |
| +++ b/third_party/sqlite/patched/test/permutations.test |
| @@ -126,6 +126,7 @@ set allquicktests [test_set $alltests -exclude { |
| walcrash2.test e_fkey.test backup.test |
| |
| fts4merge.test fts4merge2.test fts4merge4.test fts4check.test |
| + fts4merge5.test |
| fts3cov.test fts3snippet.test fts3corrupt2.test fts3an.test |
| fts3defer.test fts4langid.test fts3sort.test fts5unicode.test |
| |
| -- |
| 2.20.1 (Apple Git-117) |
| |