/ Check-in [89296a46]
Login

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

Overview
Comment:Rearrange code so that tests pass whether SQLITE_DEBUG is defined or not.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | fts5-data-version
Files: files | file ages | folders
SHA1:89296a46c3b891ee0b637ff6f89d828d6e46e7b5
User & Date: dan 2016-03-21 15:18:13
Context
2016-03-21
15:30
Have fts5 cache the structure of its index in main memory. Use "PRAGMA data_version" to figure out when this cache should be invalidated. check-in: 902f2217 user: dan tags: trunk
15:18
Rearrange code so that tests pass whether SQLITE_DEBUG is defined or not. Closed-Leaf check-in: 89296a46 user: dan tags: fts5-data-version
2016-03-19
14:47
Add test file fts5multiclient.test. check-in: 7832466f user: dan tags: fts5-data-version
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ext/fts5/fts5_index.c.

1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032

1033
1034
1035
1036
1037
1038
1039
....
1049
1050
1051
1052
1053
1054
1055


1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
** above.
**
** If an error occurs, NULL is returned and an error code left in the
** Fts5Index handle. If an error has already occurred when this function
** is called, it is a no-op.
*/
static Fts5Structure *fts5StructureRead(Fts5Index *p){
  Fts5Structure *pRet;            /* Object to return */

  if( p->pStruct==0 ){
    p->iStructVersion = fts5IndexDataVersion(p);
    if( p->rc==SQLITE_OK ){
      p->pStruct = pRet = fts5StructureReadUncached(p);
    }
    if( p->rc!=SQLITE_OK ) return 0;
    assert( p->iStructVersion!=0 );
    assert( p->pStruct!=0 );
  }

#ifdef SQLITE_DEBUG
  else{
    Fts5Structure *pTest = fts5StructureReadUncached(p);
    if( pTest ){
      int i, j;
      assert_nc( p->pStruct->nSegment==pTest->nSegment );
      assert_nc( p->pStruct->nLevel==pTest->nLevel );
................................................................................
        }
      }
      fts5StructureRelease(pTest);
    }
  }
#endif



  pRet = p->pStruct;
  fts5StructureRef(pRet);
  return pRet;
}

static void fts5StructureInvalidate(Fts5Index *p){
  if( p->pStruct ){
    fts5StructureRelease(p->pStruct);
    p->pStruct = 0;
  }







<




|

<
<
<

>







 







>
>
|
|
|







1015
1016
1017
1018
1019
1020
1021

1022
1023
1024
1025
1026
1027



1028
1029
1030
1031
1032
1033
1034
1035
1036
....
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
** above.
**
** If an error occurs, NULL is returned and an error code left in the
** Fts5Index handle. If an error has already occurred when this function
** is called, it is a no-op.
*/
static Fts5Structure *fts5StructureRead(Fts5Index *p){


  if( p->pStruct==0 ){
    p->iStructVersion = fts5IndexDataVersion(p);
    if( p->rc==SQLITE_OK ){
      p->pStruct = fts5StructureReadUncached(p);
    }



  }

#ifdef SQLITE_DEBUG
  else{
    Fts5Structure *pTest = fts5StructureReadUncached(p);
    if( pTest ){
      int i, j;
      assert_nc( p->pStruct->nSegment==pTest->nSegment );
      assert_nc( p->pStruct->nLevel==pTest->nLevel );
................................................................................
        }
      }
      fts5StructureRelease(pTest);
    }
  }
#endif

  if( p->rc!=SQLITE_OK ) return 0;
  assert( p->iStructVersion!=0 );
  assert( p->pStruct!=0 );
  fts5StructureRef(p->pStruct);
  return p->pStruct;
}

static void fts5StructureInvalidate(Fts5Index *p){
  if( p->pStruct ){
    fts5StructureRelease(p->pStruct);
    p->pStruct = 0;
  }