From: drh <> Date: Wed, 15 Jan 2025 12:38:48 +0000 (+0000) Subject: Fix issues with the prior check-ins on this branch. The code seems to work now, X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a454c61ab26296640bd23e47ae69370d2e7cb17a;p=thirdparty%2Fsqlite.git Fix issues with the prior check-ins on this branch. The code seems to work now, though many tests fail because of the new sqlite_stat1.stat text. FossilOrigin-Name: be26698a5ea6b1bfa248c66d8337b73ed64f532aed3201504d4c48107e188479 --- diff --git a/manifest b/manifest index 9815116e85..d8d975c764 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Some\sbug\sfixes\sto\sthe\sprevious.\s\sStill\slots\sof\sbugs\sremaining. -D 2025-01-15T00:46:11.511 +C Fix\sissues\swith\sthe\sprior\scheck-ins\son\sthis\sbranch.\sThe\scode\sseems\sto\swork\snow,\nthough\smany\stests\sfail\sbecause\sof\sthe\snew\ssqlite_stat1.stat\stext. +D 2025-01-15T12:38:48.739 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -711,7 +711,7 @@ F sqlite.pc.in 42b7bf0d02e08b9e77734a47798d1a55a9e0716b F sqlite3.1 acdff36db796e2d00225b911d3047d580cd136547298435426ce9d40347973cc F sqlite3.pc.in 0977c03a4da7c4204bd60e784a0efb8d51a190448aba78a4e973fe7192bdaf03 F src/alter.c aa93e37e4a36a0525bbb2a2aeda20d2018f0aa995542c7dc658e031375e3f532 -F src/analyze.c 161007676092b5c276f7c2572b5822637e3f00110d7f2524ae47c6bd9eeac926 +F src/analyze.c bd5201b9b1414d0bb9a97dbceb0bad9fecacd8ec421081892c62f758c6ef1717 F src/attach.c f35bb8cc1fcdde8f6815a7ef09ae413bcac71821d530796800ba24b3c7da1e80 F src/auth.c 54ab9c6c5803b47c0d45b76ce27eff22a03b4b1f767c5945a3a4eb13aa4c78dc F src/backup.c 5c97e8023aab1ce14a42387eb3ae00ba5a0644569e3476f38661fa6f824c3523 @@ -2205,8 +2205,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 9c0d6f29df8169efef0909ec53c09624128b429c5a03fabdb067aceb1a99f45b -R 362db0023f6c569ef8c4c4857ca06d3a +P 76f2beded05803add0f55f6baff7fce79c08a65099782da9bfac7d5b33091ad2 +R 388bdf897b0c876017d10d958b965580 U drh -Z 3bfc67211703c1993b3aba9692342fcb +Z 67aad46a800a3f6a133673155dfbc26b # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 79c2faa35b..342b48ef3c 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -76f2beded05803add0f55f6baff7fce79c08a65099782da9bfac7d5b33091ad2 +be26698a5ea6b1bfa248c66d8337b73ed64f532aed3201504d4c48107e188479 diff --git a/src/analyze.c b/src/analyze.c index 92c9ddb936..deb3bb2af0 100644 --- a/src/analyze.c +++ b/src/analyze.c @@ -748,11 +748,11 @@ static void statPush( #ifdef SQLITE_ENABLE_STAT4 if( p->mxSample ){ tRowcnt nLt; - if( sqlite3_value_type(argv[2])==SQLITE_INTEGER ){ - sampleSetRowidInt64(p->db, &p->current, sqlite3_value_int64(argv[2])); + if( sqlite3_value_type(argv[3])==SQLITE_INTEGER ){ + sampleSetRowidInt64(p->db, &p->current, sqlite3_value_int64(argv[3])); }else{ - sampleSetRowid(p->db, &p->current, sqlite3_value_bytes(argv[2]), - sqlite3_value_blob(argv[2])); + sampleSetRowid(p->db, &p->current, sqlite3_value_bytes(argv[3]), + sqlite3_value_blob(argv[3])); } p->current.iHash = p->iPrn = p->iPrn*1103515245 + 12345; @@ -781,7 +781,7 @@ static void statPush( } static const FuncDef statPushFuncdef = { - 2+IsStat4, /* nArg */ + 3+IsStat4, /* nArg */ SQLITE_UTF8, /* funcFlags */ 0, /* pUserData */ 0, /* pNext */ @@ -1001,8 +1001,10 @@ static void analyzeOneTable( int regChng = iMem++; /* Index of changed index field */ int regRowSz = iMem++; /* Register holding the row size */ int regRowid = iMem++; /* Rowid argument passed to stat_push() */ + /* ^^^^^^^^---------------- Names for these four registers correspond + ** to their usage with stat_push(). However, regChng through regRowid + ** push regTemp below also used by stat_init(). */ int regTemp = iMem++; /* Temporary use register */ - int regTemp2 = iMem++; /* Second temporary use register */ int regTabname = iMem++; /* Register containing table name */ int regIdxname = iMem++; /* Register containing index name */ int regStat1 = iMem++; /* Value for the stat column of sqlite_stat1 */ @@ -1153,11 +1155,15 @@ static void analyzeOneTable( ** (3) estimated number of rows in the index. ** (4) Analysis limit */ - sqlite3VdbeAddOp2(v, OP_Integer, nCol, regStat+1); - sqlite3VdbeAddOp2(v, OP_Integer, pIdx->nKeyCol, regStat+2); - sqlite3VdbeAddOp3(v, OP_Count, iIdxCur, regStat+3, + assert( regChng==regStat+1 ); /* Reuse four registers regChng..regTemp */ + assert( regRowSz==regStat+2 ); /* as the arguments to stat_init() */ + assert( regRowid==regStat+3 ); + assert( regTemp==regStat+4 ); + sqlite3VdbeAddOp2(v, OP_Integer, nCol, regChng); + sqlite3VdbeAddOp2(v, OP_Integer, pIdx->nKeyCol, regRowSz); + sqlite3VdbeAddOp3(v, OP_Count, iIdxCur, regRowid, OptimizationDisabled(db, SQLITE_Stat4)); - sqlite3VdbeAddOp2(v, OP_Integer, db->nAnalysisLimit, regStat+4); + sqlite3VdbeAddOp2(v, OP_Integer, db->nAnalysisLimit, regTemp); sqlite3VdbeAddFunctionCall(pParse, 0, regStat+1, regStat, 4, &statInitFuncdef, 0); addrGotoEnd = sqlite3VdbeAddOp1(v, OP_Rewind, iIdxCur); @@ -1226,8 +1232,8 @@ static void analyzeOneTable( /* ** chng_addr_N: - ** regRowid = idx(rowid) // STAT4 only - ** stat_push(P, regChng, regRowid) // 3rd parameter STAT4 only + ** regRowid = idx(rowid) // STAT4 only + ** stat_push(P, regChng, regRowSz, regRowid) // 4th parameter STAT4 only ** Next csr ** if !eof(csr) goto next_row; */