I started with the place where iGeneration was being changed and found
nothing out of the ordinary.  I started an examination and noticed the
following.  My "huh?" surrounds the question, why is sqlite3SchemaClear
being called if pBt is assigned?

SQLITE_PRIVATE Schema *sqlite3SchemaGet(sqlite3 *db, Btree *pBt){
  Schema * p;
  if( pBt ){
    p = (Schema *)sqlite3BtreeSchema(pBt, sizeof(Schema),
sqlite3SchemaClear);
  }else{
    p = (Schema *)sqlite3DbMallocZero(0, sizeof(Schema));
  }
  if( !p ){
    db->mallocFailed = 1;
  }else if ( 0==p->file_format ){
    sqlite3HashInit(&p->tblHash);
    sqlite3HashInit(&p->idxHash);
    sqlite3HashInit(&p->trigHash);
    sqlite3HashInit(&p->fkeyHash);
    p->enc = SQLITE_UTF8;
  }
  return p;
}


On Tue, Jan 24, 2012 at 7:46 PM, Richard Hipp <d...@sqlite.org> wrote:

> On Tue, Jan 24, 2012 at 7:37 PM, John Elrick <john.elr...@fenestra.com
> >wrote:
>
> >
> > It appears that the value is set here:
> >
> >  u.av.pBt = db->aDb[pOp->p1].pBt;
> >  if( u.av.pBt ){
> >    sqlite3BtreeGetMeta(u.av.pBt, BTREE_SCHEMA_VERSION, (u32
> *)&u.av.iMeta);
> >    u.av.iGen = db->aDb[pOp->p1].pSchema->iGeneration;
> >  }else{
> >    u.av.iGen = u.av.iMeta = 0;
> >  }
> >
> >
> > I added a log trace to the else condition and it never fired off, so
> > something is causing db->aDb[pOp->p1].pSchema->iGeneration to change
> > relative to pOp->p3.  Give me some guidance as to where to dig and I'll
> be
> > glad to do so
> >
>
> iGeneration changes in only one place in the code:
> http://www.sqlite.org/src/artifact/5069f2248?ln=431
>
> May I recommend that you put a printf() before this line
>
>   http://www.sqlite.org/src/artifact/fc1b97fa6816?ln=3022
>
> And have that printf display the following values:
>
>   db  (rendered using %p)
>   pOp->p1  (using %d)
>   db->aDb[pOp->p1].pSchema  (using %p)
>   db->aDb[pOp->p1].pSchema->schema_cookie  (using %d)
>   db->aDb[pOp->p1].pSchema->iGeneration (using %d)
>   iMeta  (using %d)
>   pOp->p2  (using %d)
>   pOp->p3  (using %d)
>   p->zSql  (using %s)
>
> And then also add a printf on the line above where iGeneration changes and
> display its new value every time it changes.
>
>
>
>
> --
> D. Richard Hipp
> d...@sqlite.org
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



-- 
John Elrick
Fenestra Technologies
540-868-1377
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to