Fossil SCM

Add the --sqlstats command-line option for use in optimization work. Use a persistent prepared statement for a single query to reduce the number of calls to sqlite3_prepare() for the "update" command.

drh 2011-02-24 23:26 trunk
Commit b81112371c25058de6bf225c58cfec5ec22ee1d4
+16 -1
--- src/content.c
+++ src/content.c
@@ -127,10 +127,25 @@
127127
srcid = 0;
128128
}
129129
db_reset(&q);
130130
return srcid;
131131
}
132
+
133
+/*
134
+** Return the blob.size field given blob.rid
135
+*/
136
+int content_size(int rid, int dflt){
137
+ static Stmt q;
138
+ int sz = dflt;
139
+ db_static_prepare(&q, "SELECT size FROM blob WHERE rid=:r");
140
+ db_bind_int(&q, ":r", rid);
141
+ if( db_step(&q)==SQLITE_ROW ){
142
+ sz = db_column_int(&q, 0);
143
+ }
144
+ db_reset(&q);
145
+ return sz;
146
+}
132147
133148
/*
134149
** Check to see if content is available for artifact "rid". Return
135150
** true if it is. Return false if rid is a phantom or depends on
136151
** a phantom.
@@ -143,11 +158,11 @@
143158
return 0;
144159
}
145160
if( bag_find(&contentCache.available, rid) ){
146161
return 1;
147162
}
148
- if( db_int(-1, "SELECT size FROM blob WHERE rid=%d", rid)<0 ){
163
+ if( content_size(rid, -1)<0 ){
149164
bag_insert(&contentCache.missing, rid);
150165
return 0;
151166
}
152167
srcid = findSrcid(rid);
153168
if( srcid==0 ){
154169
--- src/content.c
+++ src/content.c
@@ -127,10 +127,25 @@
127 srcid = 0;
128 }
129 db_reset(&q);
130 return srcid;
131 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
132
133 /*
134 ** Check to see if content is available for artifact "rid". Return
135 ** true if it is. Return false if rid is a phantom or depends on
136 ** a phantom.
@@ -143,11 +158,11 @@
143 return 0;
144 }
145 if( bag_find(&contentCache.available, rid) ){
146 return 1;
147 }
148 if( db_int(-1, "SELECT size FROM blob WHERE rid=%d", rid)<0 ){
149 bag_insert(&contentCache.missing, rid);
150 return 0;
151 }
152 srcid = findSrcid(rid);
153 if( srcid==0 ){
154
--- src/content.c
+++ src/content.c
@@ -127,10 +127,25 @@
127 srcid = 0;
128 }
129 db_reset(&q);
130 return srcid;
131 }
132
133 /*
134 ** Return the blob.size field given blob.rid
135 */
136 int content_size(int rid, int dflt){
137 static Stmt q;
138 int sz = dflt;
139 db_static_prepare(&q, "SELECT size FROM blob WHERE rid=:r");
140 db_bind_int(&q, ":r", rid);
141 if( db_step(&q)==SQLITE_ROW ){
142 sz = db_column_int(&q, 0);
143 }
144 db_reset(&q);
145 return sz;
146 }
147
148 /*
149 ** Check to see if content is available for artifact "rid". Return
150 ** true if it is. Return false if rid is a phantom or depends on
151 ** a phantom.
@@ -143,11 +158,11 @@
158 return 0;
159 }
160 if( bag_find(&contentCache.available, rid) ){
161 return 1;
162 }
163 if( content_size(rid, -1)<0 ){
164 bag_insert(&contentCache.missing, rid);
165 return 0;
166 }
167 srcid = findSrcid(rid);
168 if( srcid==0 ){
169
+16 -12
--- src/db.c
+++ src/db.c
@@ -88,10 +88,11 @@
8888
static struct sCommitHook {
8989
int (*xHook)(void); /* Functions to call at db_end_transaction() */
9090
int sequence; /* Call functions in sequence order */
9191
} aHook[5];
9292
static Stmt *pAllStmt = 0; /* List of all unfinalized statements */
93
+static int nPrepare = 0; /* Number of calls to sqlite3_prepare() */
9394
9495
/*
9596
** This routine is called by the SQLite commit-hook mechanism
9697
** just prior to each commit. All this routine does is verify
9798
** that nBegin really is zero. That insures that transactions
@@ -199,10 +200,11 @@
199200
char *zSql;
200201
blob_zero(&pStmt->sql);
201202
blob_vappendf(&pStmt->sql, zFormat, ap);
202203
va_end(ap);
203204
zSql = blob_str(&pStmt->sql);
205
+ nPrepare++;
204206
rc = sqlite3_prepare_v2(g.db, zSql, -1, &pStmt->pStmt, 0);
205207
if( rc!=0 && !errOk ){
206208
db_err("%s\n%s", sqlite3_errmsg(g.db), zSql);
207209
}
208210
pStmt->pNext = pStmt->pPrev = 0;
@@ -736,10 +738,11 @@
736738
/* If the "isexe" column is missing from the vfile table, then
737739
** add it now. This code added on 2010-03-06. After all users have
738740
** upgraded, this code can be safely deleted.
739741
*/
740742
rc = sqlite3_prepare(g.db, "SELECT isexe FROM vfile", -1, &pStmt, 0);
743
+ nPrepare++;
741744
sqlite3_finalize(pStmt);
742745
if( rc==SQLITE_ERROR ){
743746
sqlite3_exec(g.db, "ALTER TABLE vfile ADD COLUMN isexe BOOLEAN", 0, 0, 0);
744747
}
745748
@@ -966,34 +969,35 @@
966969
** argument is true. Ignore unfinalized statements when false.
967970
*/
968971
void db_close(int reportErrors){
969972
sqlite3_stmt *pStmt;
970973
if( g.db==0 ) return;
971
- if( g.fSqlTrace ){
974
+ if( g.fSqlStats ){
972975
int cur, hiwtr;
973976
sqlite3_db_status(g.db, SQLITE_DBSTATUS_LOOKASIDE_USED, &cur, &hiwtr, 0);
974
- fprintf(stderr, "-- LOOKASIDE_USED %10d %10d\n", cur, hiwtr);
977
+ fprintf(stderr, "-- LOOKASIDE_USED %10d %10d\n", cur, hiwtr);
975978
sqlite3_db_status(g.db, SQLITE_DBSTATUS_LOOKASIDE_HIT, &cur, &hiwtr, 0);
976
- fprintf(stderr, "-- LOOKASIDE_HIT %10d\n", hiwtr);
979
+ fprintf(stderr, "-- LOOKASIDE_HIT %10d\n", hiwtr);
977980
sqlite3_db_status(g.db, SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE, &cur,&hiwtr,0);
978
- fprintf(stderr, "-- LOOKASIDE_MISS_SIZE %10d\n", hiwtr);
981
+ fprintf(stderr, "-- LOOKASIDE_MISS_SIZE %10d\n", hiwtr);
979982
sqlite3_db_status(g.db, SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL, &cur,&hiwtr,0);
980
- fprintf(stderr, "-- LOOKASIDE_MISS_FULL %10d\n", hiwtr);
983
+ fprintf(stderr, "-- LOOKASIDE_MISS_FULL %10d\n", hiwtr);
981984
sqlite3_db_status(g.db, SQLITE_DBSTATUS_CACHE_USED, &cur, &hiwtr, 0);
982
- fprintf(stderr, "-- CACHE_USED %10d\n", cur);
985
+ fprintf(stderr, "-- CACHE_USED %10d\n", cur);
983986
sqlite3_db_status(g.db, SQLITE_DBSTATUS_SCHEMA_USED, &cur, &hiwtr, 0);
984
- fprintf(stderr, "-- SCHEMA_USED %10d\n", cur);
987
+ fprintf(stderr, "-- SCHEMA_USED %10d\n", cur);
985988
sqlite3_db_status(g.db, SQLITE_DBSTATUS_STMT_USED, &cur, &hiwtr, 0);
986
- fprintf(stderr, "-- STMT_USED %10d\n", cur);
989
+ fprintf(stderr, "-- STMT_USED %10d\n", cur);
987990
sqlite3_status(SQLITE_STATUS_MEMORY_USED, &cur, &hiwtr, 0);
988
- fprintf(stderr, "-- MEMORY_USED %10d %10d\n", cur, hiwtr);
991
+ fprintf(stderr, "-- MEMORY_USED %10d %10d\n", cur, hiwtr);
989992
sqlite3_status(SQLITE_STATUS_MALLOC_SIZE, &cur, &hiwtr, 0);
990
- fprintf(stderr, "-- MALLOC_SIZE %10d\n", hiwtr);
993
+ fprintf(stderr, "-- MALLOC_SIZE %10d\n", hiwtr);
991994
sqlite3_status(SQLITE_STATUS_MALLOC_COUNT, &cur, &hiwtr, 0);
992
- fprintf(stderr, "-- MALLOC_COUNT %10d %10d\n", cur, hiwtr);
995
+ fprintf(stderr, "-- MALLOC_COUNT %10d %10d\n", cur, hiwtr);
993996
sqlite3_status(SQLITE_STATUS_PAGECACHE_OVERFLOW, &cur, &hiwtr, 0);
994
- fprintf(stderr, "-- PCACHE_OVFLOW %10d %10d\n", cur, hiwtr);
997
+ fprintf(stderr, "-- PCACHE_OVFLOW %10d %10d\n", cur, hiwtr);
998
+ fprintf(stderr, "-- prepared statements %10d\n", nPrepare);
995999
}
9961000
while( pAllStmt ){
9971001
db_finalize(pAllStmt);
9981002
}
9991003
db_end_transaction(1);
10001004
--- src/db.c
+++ src/db.c
@@ -88,10 +88,11 @@
88 static struct sCommitHook {
89 int (*xHook)(void); /* Functions to call at db_end_transaction() */
90 int sequence; /* Call functions in sequence order */
91 } aHook[5];
92 static Stmt *pAllStmt = 0; /* List of all unfinalized statements */
 
93
94 /*
95 ** This routine is called by the SQLite commit-hook mechanism
96 ** just prior to each commit. All this routine does is verify
97 ** that nBegin really is zero. That insures that transactions
@@ -199,10 +200,11 @@
199 char *zSql;
200 blob_zero(&pStmt->sql);
201 blob_vappendf(&pStmt->sql, zFormat, ap);
202 va_end(ap);
203 zSql = blob_str(&pStmt->sql);
 
204 rc = sqlite3_prepare_v2(g.db, zSql, -1, &pStmt->pStmt, 0);
205 if( rc!=0 && !errOk ){
206 db_err("%s\n%s", sqlite3_errmsg(g.db), zSql);
207 }
208 pStmt->pNext = pStmt->pPrev = 0;
@@ -736,10 +738,11 @@
736 /* If the "isexe" column is missing from the vfile table, then
737 ** add it now. This code added on 2010-03-06. After all users have
738 ** upgraded, this code can be safely deleted.
739 */
740 rc = sqlite3_prepare(g.db, "SELECT isexe FROM vfile", -1, &pStmt, 0);
 
741 sqlite3_finalize(pStmt);
742 if( rc==SQLITE_ERROR ){
743 sqlite3_exec(g.db, "ALTER TABLE vfile ADD COLUMN isexe BOOLEAN", 0, 0, 0);
744 }
745
@@ -966,34 +969,35 @@
966 ** argument is true. Ignore unfinalized statements when false.
967 */
968 void db_close(int reportErrors){
969 sqlite3_stmt *pStmt;
970 if( g.db==0 ) return;
971 if( g.fSqlTrace ){
972 int cur, hiwtr;
973 sqlite3_db_status(g.db, SQLITE_DBSTATUS_LOOKASIDE_USED, &cur, &hiwtr, 0);
974 fprintf(stderr, "-- LOOKASIDE_USED %10d %10d\n", cur, hiwtr);
975 sqlite3_db_status(g.db, SQLITE_DBSTATUS_LOOKASIDE_HIT, &cur, &hiwtr, 0);
976 fprintf(stderr, "-- LOOKASIDE_HIT %10d\n", hiwtr);
977 sqlite3_db_status(g.db, SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE, &cur,&hiwtr,0);
978 fprintf(stderr, "-- LOOKASIDE_MISS_SIZE %10d\n", hiwtr);
979 sqlite3_db_status(g.db, SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL, &cur,&hiwtr,0);
980 fprintf(stderr, "-- LOOKASIDE_MISS_FULL %10d\n", hiwtr);
981 sqlite3_db_status(g.db, SQLITE_DBSTATUS_CACHE_USED, &cur, &hiwtr, 0);
982 fprintf(stderr, "-- CACHE_USED %10d\n", cur);
983 sqlite3_db_status(g.db, SQLITE_DBSTATUS_SCHEMA_USED, &cur, &hiwtr, 0);
984 fprintf(stderr, "-- SCHEMA_USED %10d\n", cur);
985 sqlite3_db_status(g.db, SQLITE_DBSTATUS_STMT_USED, &cur, &hiwtr, 0);
986 fprintf(stderr, "-- STMT_USED %10d\n", cur);
987 sqlite3_status(SQLITE_STATUS_MEMORY_USED, &cur, &hiwtr, 0);
988 fprintf(stderr, "-- MEMORY_USED %10d %10d\n", cur, hiwtr);
989 sqlite3_status(SQLITE_STATUS_MALLOC_SIZE, &cur, &hiwtr, 0);
990 fprintf(stderr, "-- MALLOC_SIZE %10d\n", hiwtr);
991 sqlite3_status(SQLITE_STATUS_MALLOC_COUNT, &cur, &hiwtr, 0);
992 fprintf(stderr, "-- MALLOC_COUNT %10d %10d\n", cur, hiwtr);
993 sqlite3_status(SQLITE_STATUS_PAGECACHE_OVERFLOW, &cur, &hiwtr, 0);
994 fprintf(stderr, "-- PCACHE_OVFLOW %10d %10d\n", cur, hiwtr);
 
995 }
996 while( pAllStmt ){
997 db_finalize(pAllStmt);
998 }
999 db_end_transaction(1);
1000
--- src/db.c
+++ src/db.c
@@ -88,10 +88,11 @@
88 static struct sCommitHook {
89 int (*xHook)(void); /* Functions to call at db_end_transaction() */
90 int sequence; /* Call functions in sequence order */
91 } aHook[5];
92 static Stmt *pAllStmt = 0; /* List of all unfinalized statements */
93 static int nPrepare = 0; /* Number of calls to sqlite3_prepare() */
94
95 /*
96 ** This routine is called by the SQLite commit-hook mechanism
97 ** just prior to each commit. All this routine does is verify
98 ** that nBegin really is zero. That insures that transactions
@@ -199,10 +200,11 @@
200 char *zSql;
201 blob_zero(&pStmt->sql);
202 blob_vappendf(&pStmt->sql, zFormat, ap);
203 va_end(ap);
204 zSql = blob_str(&pStmt->sql);
205 nPrepare++;
206 rc = sqlite3_prepare_v2(g.db, zSql, -1, &pStmt->pStmt, 0);
207 if( rc!=0 && !errOk ){
208 db_err("%s\n%s", sqlite3_errmsg(g.db), zSql);
209 }
210 pStmt->pNext = pStmt->pPrev = 0;
@@ -736,10 +738,11 @@
738 /* If the "isexe" column is missing from the vfile table, then
739 ** add it now. This code added on 2010-03-06. After all users have
740 ** upgraded, this code can be safely deleted.
741 */
742 rc = sqlite3_prepare(g.db, "SELECT isexe FROM vfile", -1, &pStmt, 0);
743 nPrepare++;
744 sqlite3_finalize(pStmt);
745 if( rc==SQLITE_ERROR ){
746 sqlite3_exec(g.db, "ALTER TABLE vfile ADD COLUMN isexe BOOLEAN", 0, 0, 0);
747 }
748
@@ -966,34 +969,35 @@
969 ** argument is true. Ignore unfinalized statements when false.
970 */
971 void db_close(int reportErrors){
972 sqlite3_stmt *pStmt;
973 if( g.db==0 ) return;
974 if( g.fSqlStats ){
975 int cur, hiwtr;
976 sqlite3_db_status(g.db, SQLITE_DBSTATUS_LOOKASIDE_USED, &cur, &hiwtr, 0);
977 fprintf(stderr, "-- LOOKASIDE_USED %10d %10d\n", cur, hiwtr);
978 sqlite3_db_status(g.db, SQLITE_DBSTATUS_LOOKASIDE_HIT, &cur, &hiwtr, 0);
979 fprintf(stderr, "-- LOOKASIDE_HIT %10d\n", hiwtr);
980 sqlite3_db_status(g.db, SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE, &cur,&hiwtr,0);
981 fprintf(stderr, "-- LOOKASIDE_MISS_SIZE %10d\n", hiwtr);
982 sqlite3_db_status(g.db, SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL, &cur,&hiwtr,0);
983 fprintf(stderr, "-- LOOKASIDE_MISS_FULL %10d\n", hiwtr);
984 sqlite3_db_status(g.db, SQLITE_DBSTATUS_CACHE_USED, &cur, &hiwtr, 0);
985 fprintf(stderr, "-- CACHE_USED %10d\n", cur);
986 sqlite3_db_status(g.db, SQLITE_DBSTATUS_SCHEMA_USED, &cur, &hiwtr, 0);
987 fprintf(stderr, "-- SCHEMA_USED %10d\n", cur);
988 sqlite3_db_status(g.db, SQLITE_DBSTATUS_STMT_USED, &cur, &hiwtr, 0);
989 fprintf(stderr, "-- STMT_USED %10d\n", cur);
990 sqlite3_status(SQLITE_STATUS_MEMORY_USED, &cur, &hiwtr, 0);
991 fprintf(stderr, "-- MEMORY_USED %10d %10d\n", cur, hiwtr);
992 sqlite3_status(SQLITE_STATUS_MALLOC_SIZE, &cur, &hiwtr, 0);
993 fprintf(stderr, "-- MALLOC_SIZE %10d\n", hiwtr);
994 sqlite3_status(SQLITE_STATUS_MALLOC_COUNT, &cur, &hiwtr, 0);
995 fprintf(stderr, "-- MALLOC_COUNT %10d %10d\n", cur, hiwtr);
996 sqlite3_status(SQLITE_STATUS_PAGECACHE_OVERFLOW, &cur, &hiwtr, 0);
997 fprintf(stderr, "-- PCACHE_OVFLOW %10d %10d\n", cur, hiwtr);
998 fprintf(stderr, "-- prepared statements %10d\n", nPrepare);
999 }
1000 while( pAllStmt ){
1001 db_finalize(pAllStmt);
1002 }
1003 db_end_transaction(1);
1004
+4 -1
--- src/main.c
+++ src/main.c
@@ -60,11 +60,12 @@
6060
const char *zMainDbType;/* "configdb", "localdb", or "repository" */
6161
const char *zHome; /* Name of user home directory */
6262
int localOpen; /* True if the local database is open */
6363
char *zLocalRoot; /* The directory holding the local database */
6464
int minPrefix; /* Number of digits needed for a distinct UUID */
65
- int fSqlTrace; /* True if -sqltrace flag is present */
65
+ int fSqlTrace; /* True if --sqltrace flag is present */
66
+ int fSqlStats; /* True if --sqltrace or --sqlstats are present */
6667
int fSqlPrint; /* True if -sqlprint flag is present */
6768
int fQuiet; /* True if -quiet flag is present */
6869
int fHttpTrace; /* Trace outbound HTTP requests */
6970
int fNoSync; /* Do not do an autosync even. --nosync */
7071
char *zPath; /* Name of webpage being served */
@@ -240,10 +241,12 @@
240241
argv[0], argv[0], argv[0]);
241242
fossil_exit(1);
242243
}else{
243244
g.fQuiet = find_option("quiet", 0, 0)!=0;
244245
g.fSqlTrace = find_option("sqltrace", 0, 0)!=0;
246
+ g.fSqlStats = find_option("sqlstats", 0, 0)!=0;
247
+ if( g.fSqlTrace ) g.fSqlStats = 1;
245248
g.fSqlPrint = find_option("sqlprint", 0, 0)!=0;
246249
g.fHttpTrace = find_option("httptrace", 0, 0)!=0;
247250
g.zLogin = find_option("user", "U", 1);
248251
if( find_option("help",0,0)!=0 ){
249252
/* --help anywhere on the command line is translated into
250253
--- src/main.c
+++ src/main.c
@@ -60,11 +60,12 @@
60 const char *zMainDbType;/* "configdb", "localdb", or "repository" */
61 const char *zHome; /* Name of user home directory */
62 int localOpen; /* True if the local database is open */
63 char *zLocalRoot; /* The directory holding the local database */
64 int minPrefix; /* Number of digits needed for a distinct UUID */
65 int fSqlTrace; /* True if -sqltrace flag is present */
 
66 int fSqlPrint; /* True if -sqlprint flag is present */
67 int fQuiet; /* True if -quiet flag is present */
68 int fHttpTrace; /* Trace outbound HTTP requests */
69 int fNoSync; /* Do not do an autosync even. --nosync */
70 char *zPath; /* Name of webpage being served */
@@ -240,10 +241,12 @@
240 argv[0], argv[0], argv[0]);
241 fossil_exit(1);
242 }else{
243 g.fQuiet = find_option("quiet", 0, 0)!=0;
244 g.fSqlTrace = find_option("sqltrace", 0, 0)!=0;
 
 
245 g.fSqlPrint = find_option("sqlprint", 0, 0)!=0;
246 g.fHttpTrace = find_option("httptrace", 0, 0)!=0;
247 g.zLogin = find_option("user", "U", 1);
248 if( find_option("help",0,0)!=0 ){
249 /* --help anywhere on the command line is translated into
250
--- src/main.c
+++ src/main.c
@@ -60,11 +60,12 @@
60 const char *zMainDbType;/* "configdb", "localdb", or "repository" */
61 const char *zHome; /* Name of user home directory */
62 int localOpen; /* True if the local database is open */
63 char *zLocalRoot; /* The directory holding the local database */
64 int minPrefix; /* Number of digits needed for a distinct UUID */
65 int fSqlTrace; /* True if --sqltrace flag is present */
66 int fSqlStats; /* True if --sqltrace or --sqlstats are present */
67 int fSqlPrint; /* True if -sqlprint flag is present */
68 int fQuiet; /* True if -quiet flag is present */
69 int fHttpTrace; /* Trace outbound HTTP requests */
70 int fNoSync; /* Do not do an autosync even. --nosync */
71 char *zPath; /* Name of webpage being served */
@@ -240,10 +241,12 @@
241 argv[0], argv[0], argv[0]);
242 fossil_exit(1);
243 }else{
244 g.fQuiet = find_option("quiet", 0, 0)!=0;
245 g.fSqlTrace = find_option("sqltrace", 0, 0)!=0;
246 g.fSqlStats = find_option("sqlstats", 0, 0)!=0;
247 if( g.fSqlTrace ) g.fSqlStats = 1;
248 g.fSqlPrint = find_option("sqlprint", 0, 0)!=0;
249 g.fHttpTrace = find_option("httptrace", 0, 0)!=0;
250 g.zLogin = find_option("user", "U", 1);
251 if( find_option("help",0,0)!=0 ){
252 /* --help anywhere on the command line is translated into
253
+1 -1
--- src/verify.c
+++ src/verify.c
@@ -35,11 +35,11 @@
3535
** Panic if anything goes wrong. If this procedure returns it means
3636
** that everything is OK.
3737
*/
3838
static void verify_rid(int rid){
3939
Blob uuid, hash, content;
40
- if( db_int(0, "SELECT size FROM blob WHERE rid=%d", rid)<0 ){
40
+ if( content_size(rid, 0)<0 ){
4141
return; /* No way to verify phantoms */
4242
}
4343
blob_zero(&uuid);
4444
db_blob(&uuid, "SELECT uuid FROM blob WHERE rid=%d", rid);
4545
if( blob_size(&uuid)!=UUID_SIZE ){
4646
--- src/verify.c
+++ src/verify.c
@@ -35,11 +35,11 @@
35 ** Panic if anything goes wrong. If this procedure returns it means
36 ** that everything is OK.
37 */
38 static void verify_rid(int rid){
39 Blob uuid, hash, content;
40 if( db_int(0, "SELECT size FROM blob WHERE rid=%d", rid)<0 ){
41 return; /* No way to verify phantoms */
42 }
43 blob_zero(&uuid);
44 db_blob(&uuid, "SELECT uuid FROM blob WHERE rid=%d", rid);
45 if( blob_size(&uuid)!=UUID_SIZE ){
46
--- src/verify.c
+++ src/verify.c
@@ -35,11 +35,11 @@
35 ** Panic if anything goes wrong. If this procedure returns it means
36 ** that everything is OK.
37 */
38 static void verify_rid(int rid){
39 Blob uuid, hash, content;
40 if( content_size(rid, 0)<0 ){
41 return; /* No way to verify phantoms */
42 }
43 blob_zero(&uuid);
44 db_blob(&uuid, "SELECT uuid FROM blob WHERE rid=%d", rid);
45 if( blob_size(&uuid)!=UUID_SIZE ){
46
+1 -1
--- src/vfile.c
+++ src/vfile.c
@@ -92,11 +92,11 @@
9292
db_bind_int(&ins, ":vid", vid);
9393
manifest_file_rewind(p);
9494
while( (pFile = manifest_file_next(p,0))!=0 ){
9595
if( pFile->zUuid==0 || uuid_is_shunned(pFile->zUuid) ) continue;
9696
rid = uuid_to_rid(pFile->zUuid, 0);
97
- if( rid==0 || db_int(-1, "SELECT size FROM blob WHERE rid=%d", rid)<0 ){
97
+ if( rid==0 || content_size(rid, -1)<0 ){
9898
fossil_warning("content missing for %s", pFile->zName);
9999
continue;
100100
}
101101
db_bind_int(&ins, ":id", rid);
102102
db_bind_text(&ins, ":name", pFile->zName);
103103
--- src/vfile.c
+++ src/vfile.c
@@ -92,11 +92,11 @@
92 db_bind_int(&ins, ":vid", vid);
93 manifest_file_rewind(p);
94 while( (pFile = manifest_file_next(p,0))!=0 ){
95 if( pFile->zUuid==0 || uuid_is_shunned(pFile->zUuid) ) continue;
96 rid = uuid_to_rid(pFile->zUuid, 0);
97 if( rid==0 || db_int(-1, "SELECT size FROM blob WHERE rid=%d", rid)<0 ){
98 fossil_warning("content missing for %s", pFile->zName);
99 continue;
100 }
101 db_bind_int(&ins, ":id", rid);
102 db_bind_text(&ins, ":name", pFile->zName);
103
--- src/vfile.c
+++ src/vfile.c
@@ -92,11 +92,11 @@
92 db_bind_int(&ins, ":vid", vid);
93 manifest_file_rewind(p);
94 while( (pFile = manifest_file_next(p,0))!=0 ){
95 if( pFile->zUuid==0 || uuid_is_shunned(pFile->zUuid) ) continue;
96 rid = uuid_to_rid(pFile->zUuid, 0);
97 if( rid==0 || content_size(rid, -1)<0 ){
98 fossil_warning("content missing for %s", pFile->zName);
99 continue;
100 }
101 db_bind_int(&ins, ":id", rid);
102 db_bind_text(&ins, ":name", pFile->zName);
103

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button