Fossil

Check-in [195073fb]
Login

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

Overview
Comment:Fix the creation of orphan table entries when delta-manifests are received before their baselines. Ticket [fbea61caf0acfd0a].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:195073fb78f7c6a112104b330fd50887bf54475c
User & Date: drh 2011-02-10 21:28:16
Context
2011-02-11
15:11
Fix the check-in time fudger so that it will not move the date/time of a check-in by more than a few seconds. If the sequence of check-ins is further off than that chronologically, then they just show up out of order in the timeline. check-in: feaab7ba user: drh tags: trunk
2011-02-10
21:28
Fix the creation of orphan table entries when delta-manifests are received before their baselines. Ticket [fbea61caf0acfd0a]. check-in: 195073fb user: drh tags: trunk
2011-02-09
23:08
Try to make it clear that a ticket-id must be a 40-character lower-case hexadecimal number. check-in: 81ad6e2e user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/manifest.c.

861
862
863
864
865
866
867

868
869
870
871
872
873
874
...
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
/*
** Get a manifest given the rid for the control artifact.  Return
** a pointer to the manifest on success or NULL if there is a failure.
*/
Manifest *manifest_get(int rid, int cfType){
  Blob content;
  Manifest *p;

  p = manifest_cache_find(rid);
  if( p ){
    if( cfType!=CFTYPE_ANY && cfType!=p->type ){
      manifest_cache_insert(p);
      p = 0;
    }
    return p;
................................................................................
}

/*
** Fetch the baseline associated with the delta-manifest p.
** Return 0 on success.  If unable to parse the baseline,
** throw an error.  If the baseline is a manifest, throw an
** error if throwError is true, or record that p is an orphan
** and return 1 throwError is false.
*/
static int fetch_baseline(Manifest *p, int throwError){
  if( p->zBaseline!=0 && p->pBaseline==0 ){
    int rid = uuid_to_rid(p->zBaseline, 0);
    if( rid==0 && !throwError ){
      rid = content_new(p->zBaseline);
      db_multi_exec(
         "INSERT OR IGNORE INTO orphan(rid, baseline) VALUES(%d,%d)",
         rid, p->rid
      );
      return 1;
    }
    p->pBaseline = manifest_get(rid, CFTYPE_MANIFEST);
    if( p->pBaseline==0 ){
      if( !throwError ){
        db_multi_exec(
           "INSERT OR IGNORE INTO orphan(rid, baseline) VALUES(%d,%d)",
           rid, p->rid
        );
        return 1;
      }    
      fossil_fatal("cannot access baseline manifest %S", p->zBaseline);
    }
  }
  return 0;







>







 







|



|
<
<
<
<
<
<
<
<





|







861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
...
930
931
932
933
934
935
936
937
938
939
940
941








942
943
944
945
946
947
948
949
950
951
952
953
954
/*
** Get a manifest given the rid for the control artifact.  Return
** a pointer to the manifest on success or NULL if there is a failure.
*/
Manifest *manifest_get(int rid, int cfType){
  Blob content;
  Manifest *p;
  if( !rid ) return 0;
  p = manifest_cache_find(rid);
  if( p ){
    if( cfType!=CFTYPE_ANY && cfType!=p->type ){
      manifest_cache_insert(p);
      p = 0;
    }
    return p;
................................................................................
}

/*
** Fetch the baseline associated with the delta-manifest p.
** Return 0 on success.  If unable to parse the baseline,
** throw an error.  If the baseline is a manifest, throw an
** error if throwError is true, or record that p is an orphan
** and return 1 if throwError is false.
*/
static int fetch_baseline(Manifest *p, int throwError){
  if( p->zBaseline!=0 && p->pBaseline==0 ){
    int rid = uuid_to_rid(p->zBaseline, 1);








    p->pBaseline = manifest_get(rid, CFTYPE_MANIFEST);
    if( p->pBaseline==0 ){
      if( !throwError ){
        db_multi_exec(
           "INSERT OR IGNORE INTO orphan(rid, baseline) VALUES(%d,%d)",
           p->rid, rid
        );
        return 1;
      }    
      fossil_fatal("cannot access baseline manifest %S", p->zBaseline);
    }
  }
  return 0;