/ Check-in [e9436d80]
Login

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

Overview
Comment:Enhance the fts3view tool with the big-segment command and fix a bug in the display of doclists.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | fts4-incr-merge
Files: files | file ages | folders
SHA1: e9436d8038e5a0d1ba992a77d1064d4a55595f57
User & Date: drh 2012-03-27 13:51:31
Context
2012-03-27
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
13:44
Merge the fts4-incr-merge-exp branch with fts4-incr-merge. check-in: eb00b958 user: dan tags: fts4-incr-merge
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

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

   678    678           i += getVarint(aData+i, &iCol);
   679    679           printf(" col%lld", iCol);
   680    680           iPrevPos = 0;
   681    681         }else if( iPos==0 ){
   682    682           printf("\n");
   683    683           break;
   684    684         }else{
   685         -        printf(" %lld", iPrevPos + iPos - 2);
   686         -        iPrevPos = iPos - 2;
          685  +        iPrevPos += iPos - 2;
          686  +        printf(" %lld", iPrevPos);
   687    687         }
   688    688       }
   689    689     }
   690    690   }
   691    691     
   692    692   
   693    693   /*
................................................................................
   721    721       printBlob(aData+offset, nData);
   722    722     }else{
   723    723       decodeDoclist(aData+offset, nData);
   724    724     }
   725    725     sqlite3_finalize(pStmt);
   726    726   }
   727    727   
          728  +/*
          729  +** Show the top N largest segments
          730  +*/
          731  +static void listBigSegments(sqlite3 *db, const char *zTab){
          732  +  int nTop, i;
          733  +  sqlite3_stmt *pStmt;
          734  +  sqlite3_int64 sz;
          735  +  sqlite3_int64 id;
          736  +
          737  +  nTop = atoi(findOption("top", 1, "25"));
          738  +  printf("The %d largest segments:\n", nTop);
          739  +  pStmt = prepare(db,
          740  +            "SELECT blockid, length(block) AS len FROM '%q_segments'"
          741  +            " ORDER BY 2 DESC, 1"
          742  +            " LIMIT %d", zTab, nTop);
          743  +  i = 0;
          744  +  while( sqlite3_step(pStmt)==SQLITE_ROW ){
          745  +    i++;
          746  +    id = sqlite3_column_int64(pStmt, 0);
          747  +    sz = sqlite3_column_int64(pStmt, 1);
          748  +    printf("  %2d. %9lld size %lld\n", i, id, sz);
          749  +  }
          750  +  sqlite3_finalize(pStmt);
          751  +}
          752  +
   728    753   
   729    754   
   730    755   static void usage(const char *argv0){
   731    756     fprintf(stderr, "Usage: %s DATABASE\n"
   732    757                     "   or: %s DATABASE FTS3TABLE ARGS...\n", argv0, argv0);
   733    758     fprintf(stderr,
   734    759       "ARGS:\n"
          760  +    "  big-segments [--top N]                    show the largest segments\n"
   735    761       "  doclist BLOCKID OFFSET SIZE [--raw]       Decode a doclist\n"
   736    762       "  schema                                    FTS table schema\n"
   737    763       "  segdir                                    directory of segments\n"
   738    764       "  segment BLOCKID [--raw]                   content of a segment\n"
   739    765       "  segment-stats                             info on segment sizes\n"
   740    766       "  stat                                      the %%_stat table\n"
   741    767       "  vocabulary [--top N]                      document vocabulary\n"
................................................................................
   773    799       return 0;
   774    800     }
   775    801     if( argc<4 ) usage(argv[0]);
   776    802     zTab = argv[2];
   777    803     zCmd = argv[3];
   778    804     nExtra = argc-4;
   779    805     azExtra = argv+4;
   780         -  if( strcmp(zCmd,"doclist")==0 ){
          806  +  if( strcmp(zCmd,"big-segments")==0 ){
          807  +    listBigSegments(db, zTab);
          808  +  }else if( strcmp(zCmd,"doclist")==0 ){
   781    809       if( argc<7 ) usage(argv[0]);
   782    810       showDoclist(db, zTab);
   783    811     }else if( strcmp(zCmd,"schema")==0 ){
   784    812       showSchema(db, zTab);
   785    813     }else if( strcmp(zCmd,"segdir")==0 ){
   786    814       showSegdirMap(db, zTab);
   787    815     }else if( strcmp(zCmd,"segment")==0 ){