/ Check-in [04aea024]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:In the fts3view utility, label the blank segments used to mark the end of a segment sequence for a level/idx as "null". Improve the alignment of root segment names.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | fts4-incr-merge
Files: files | file ages | folders
SHA1:04aea0245e4183fef3664609f5a6353b65d71a85
User & Date: drh 2012-03-27 14:54:44
Context
2012-03-27
15:00
Remove the fts3merge.test script in favour of changing the fts4merge.test script so that it runs tests using both fts4 and fts3. Fix some problems with incr-merge and FTS3 tables. check-in: 5c447e22 user: dan tags: fts4-incr-merge
14:54
In the fts3view utility, label the blank segments used to mark the end of a segment sequence for a level/idx as "null". Improve the alignment of root segment names. check-in: 04aea024 user: drh tags: fts4-incr-merge
13:51
Enhance the fts3view tool with the big-segment command and fix a bug in the display of doclists. check-in: e9436d80 user: drh tags: fts4-incr-merge
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to ext/fts3/tool/fts3view.c.

   413    413   static void printTreeLine(sqlite3_int64 iLower, sqlite3_int64 iUpper){
   414    414     printf("                 tree   %9lld", iLower);
   415    415     if( iUpper>iLower ){
   416    416       printf(" thru %9lld  (%lld blocks)", iUpper, iUpper-iLower+1);
   417    417     }
   418    418     printf("\n");
   419    419   }
          420  +
          421  +/*
          422  +** Check to see if the block of a %_segments entry is NULL.
          423  +*/
          424  +static int isNullSegment(sqlite3 *db, const char *zTab, sqlite3_int64 iBlockId){
          425  +  sqlite3_stmt *pStmt;
          426  +  int rc = 1;
          427  +
          428  +  pStmt = prepare(db, "SELECT block IS NULL FROM '%q_segments'"
          429  +                      " WHERE blockid=%lld", zTab, iBlockId);
          430  +  if( sqlite3_step(pStmt)==SQLITE_ROW ){
          431  +    rc = sqlite3_column_int(pStmt, 0);
          432  +  }
          433  +  sqlite3_finalize(pStmt);
          434  +  return rc;
          435  +}
   420    436   
   421    437   /*
   422    438   ** Show a map of segments derived from the %_segdir table.
   423    439   */
   424    440   static void showSegdirMap(sqlite3 *db, const char *zTab){
   425    441     int mxIndex, iIndex;
   426    442     sqlite3_stmt *pStmt = 0;
................................................................................
   455    471       prevLevel = -1;
   456    472       while( sqlite3_step(pStmt)==SQLITE_ROW ){
   457    473         int iLevel = sqlite3_column_int(pStmt, 0)%1024;
   458    474         int iIdx = sqlite3_column_int(pStmt, 1);
   459    475         sqlite3_int64 iStart = sqlite3_column_int64(pStmt, 2);
   460    476         sqlite3_int64 iLEnd = sqlite3_column_int64(pStmt, 3);
   461    477         sqlite3_int64 iEnd = sqlite3_column_int64(pStmt, 4);
          478  +      char rtag[20];
   462    479         if( iLevel!=prevLevel ){
   463    480           printf("level %2d idx %2d", iLevel, iIdx);
   464    481           prevLevel = iLevel;
   465    482         }else{
   466    483           printf("         idx %2d", iIdx);
   467    484         }
   468         -      printf("  root     r%lld\n", sqlite3_column_int64(pStmt, 5));
          485  +      sqlite3_snprintf(sizeof(rtag), rtag, "r%lld",
          486  +                       sqlite3_column_int64(pStmt,5));
          487  +      printf("  root   %9s\n", rtag);
   469    488         if( iLEnd>iStart ){
   470    489           sqlite3_int64 iLower, iPrev, iX;
   471    490           if( iLEnd+1<=iEnd ){
   472    491             sqlite3_bind_int64(pStmt2, 1, iLEnd+1);
   473    492             sqlite3_bind_int64(pStmt2, 2, iEnd);
   474    493             iLower = -1;        
   475    494             while( sqlite3_step(pStmt2)==SQLITE_ROW ){
................................................................................
   480    499                 iPrev = iX;
   481    500               }else{
   482    501                 printTreeLine(iLower, iPrev);
   483    502                 iLower = iPrev = iX;
   484    503               }
   485    504             }
   486    505             sqlite3_reset(pStmt2);
   487         -          if( iLower>=0 ) printTreeLine(iLower, iPrev);
          506  +          if( iLower>=0 ){
          507  +            if( iLower==iPrev && iLower==iEnd
          508  +             && isNullSegment(db,zTab,iLower)
          509  +            ){
          510  +              printf("                 null   %9lld\n", iLower);
          511  +            }else{
          512  +              printTreeLine(iLower, iPrev);
          513  +            }
          514  +          }
   488    515           }
   489    516           printf("                 leaves %9lld thru %9lld  (%lld blocks)\n",
   490    517                  iStart, iLEnd, iLEnd - iStart + 1);
   491    518         }
   492    519       }
   493    520       sqlite3_reset(pStmt);
   494    521     }