From 86223e8d65a6dc10ad19b5c8aa535baba86a7e5c Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 5 Apr 2019 15:44:55 +0000 Subject: [PATCH] In the xfer-optimization, do early detection of when the source and destination index share the same btree, to avoid a long delay prior to reporting the database corruption. FossilOrigin-Name: af1e5873d44d31466023ae145bdfc6b4191eb48b62e5752c6e683bcf571980e7 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/insert.c | 3 +++ 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index f79652db94..2d4e0eb2d6 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sfurther\stest\scases\sto\simprove\sVDBE\sbranch\scoverage. -D 2019-04-04T20:55:37.217 +C In\sthe\sxfer-optimization,\sdo\searly\sdetection\sof\swhen\sthe\ssource\sand\sdestination\nindex\sshare\sthe\ssame\sbtree,\sto\savoid\sa\slong\sdelay\sprior\sto\sreporting\sthe\ndatabase\scorruption. +D 2019-04-05T15:44:55.655 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -478,7 +478,7 @@ F src/hash.c a12580e143f10301ed5166ea4964ae2853d3905a511d4e0c44497245c7ce1f7a F src/hash.h ab34c5c54a9e9de2e790b24349ba5aab3dbb4fd4 F src/hwtime.h 747c1bbe9df21a92e9c50f3bbec1de841dc5e5da F src/in-operator.md 10cd8f4bcd225a32518407c2fb2484089112fd71 -F src/insert.c bf4f96aaf23511b8abd2d55bf2117687f3d7111d5860110963189e66cfc7bdac +F src/insert.c 512f3f9da6d5784121e63f300530c75f0eee504e4fb9ae1d9dbc1cbbe1aa098a F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa F src/loadext.c 22afc33c3a61b4fd80a60a54f1882688371e6bc64685df2696b008fce65a999c F src/main.c 11714c8cefd458970cb1fd005251d0ad02ad69598893833b5564ffaaef192a1f @@ -1815,7 +1815,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P bf3cd9364fdfc951feb04f78728eb8e0dae12b3dc5702a36bb6e69c0abab8864 -R 844ebba6c2187a1be3b2412d8e945ade -U dan -Z 5c8fb8091f9dc8e90ba082e00d6a8a31 +P 51a95e52fc58d8be2c9c51576dff7258c705735b66d203948f80db017b4c10d2 +R 73e8e342c28a7b239489fc7a6b7571ea +U drh +Z 5e4bc09f844d1f4233f16405f1cab4ab diff --git a/manifest.uuid b/manifest.uuid index e369864d4c..56c7137035 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -51a95e52fc58d8be2c9c51576dff7258c705735b66d203948f80db017b4c10d2 \ No newline at end of file +af1e5873d44d31466023ae145bdfc6b4191eb48b62e5752c6e683bcf571980e7 \ No newline at end of file diff --git a/src/insert.c b/src/insert.c index b3535b22af..575e3a7839 100644 --- a/src/insert.c +++ b/src/insert.c @@ -2275,6 +2275,9 @@ static int xferOptimization( if( pSrcIdx==0 ){ return 0; /* pDestIdx has no corresponding index in pSrc */ } + if( pSrcIdx->tnum==pDestIdx->tnum && pSrc->pSchema==pDest->pSchema ){ + return 0; /* Corrupt schema - two indexes on the same btree */ + } } #ifndef SQLITE_OMIT_CHECK if( pDest->pCheck && sqlite3ExprListCompare(pSrc->pCheck,pDest->pCheck,-1) ){