Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Improved detection of potential read/write txn conflicts. Hold a write transaction on the server-side for the duration of an /xfer request, to avoid unexpected SQLITE_BUSY errors. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
d9543f4c2ca2f6ad356de58e8287d2c6 |
| User & Date: | drh 2020-08-12 12:56:32.738 |
Context
|
2020-08-12
| ||
| 14:07 | fossil.tabs.TabManager now experimentally (and optionally, defaulting to on) assigns 'accesskey' values to each tab button equal to their 1-based index in the tab list. check-in: 4cf3586431 user: stephan tags: trunk | |
| 12:56 | Improved detection of potential read/write txn conflicts. Hold a write transaction on the server-side for the duration of an /xfer request, to avoid unexpected SQLITE_BUSY errors. check-in: d9543f4c2c user: drh tags: trunk | |
| 12:07 | Added clear:both to HR elements, primarily to fix right-floating README.txt on the /dir page in some skins. check-in: a4c1b36ee6 user: stephan tags: trunk | |
Changes
Changes to src/db.c.
| ︙ | ︙ | |||
114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
** All static variable that a used by only this file are gathered into
** the following structure.
*/
static struct DbLocalData {
int nBegin; /* Nesting depth of BEGIN */
int doRollback; /* True to force a rollback */
int nCommitHook; /* Number of commit hooks */
Stmt *pAllStmt; /* List of all unfinalized statements */
int nPrepare; /* Number of calls to sqlite3_prepare_v2() */
int nDeleteOnFail; /* Number of entries in azDeleteOnFail[] */
struct sCommitHook {
int (*xHook)(void); /* Functions to call at db_end_transaction() */
int sequence; /* Call functions in sequence order */
} aHook[5];
| > | 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
** All static variable that a used by only this file are gathered into
** the following structure.
*/
static struct DbLocalData {
int nBegin; /* Nesting depth of BEGIN */
int doRollback; /* True to force a rollback */
int nCommitHook; /* Number of commit hooks */
int wrTxn; /* Outer-most TNX is a write */
Stmt *pAllStmt; /* List of all unfinalized statements */
int nPrepare; /* Number of calls to sqlite3_prepare_v2() */
int nDeleteOnFail; /* Number of entries in azDeleteOnFail[] */
struct sCommitHook {
int (*xHook)(void); /* Functions to call at db_end_transaction() */
int sequence; /* Call functions in sequence order */
} aHook[5];
|
| ︙ | ︙ | |||
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 |
if( db.nBegin==0 ){
db_multi_exec("BEGIN");
sqlite3_commit_hook(g.db, db_verify_at_commit, 0);
db.nPriorChanges = sqlite3_total_changes(g.db);
db.doRollback = 0;
db.zStartFile = zStartFile;
db.iStartLine = iStartLine;
}
db.nBegin++;
}
/*
** Begin a new transaction for writing.
*/
void db_begin_write_real(const char *zStartFile, int iStartLine){
if( db.nBegin==0 ){
db_multi_exec("BEGIN IMMEDIATE");
sqlite3_commit_hook(g.db, db_verify_at_commit, 0);
db.nPriorChanges = sqlite3_total_changes(g.db);
db.doRollback = 0;
db.zStartFile = zStartFile;
db.iStartLine = iStartLine;
| > > | | 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 |
if( db.nBegin==0 ){
db_multi_exec("BEGIN");
sqlite3_commit_hook(g.db, db_verify_at_commit, 0);
db.nPriorChanges = sqlite3_total_changes(g.db);
db.doRollback = 0;
db.zStartFile = zStartFile;
db.iStartLine = iStartLine;
db.wrTxn = 0;
}
db.nBegin++;
}
/*
** Begin a new transaction for writing.
*/
void db_begin_write_real(const char *zStartFile, int iStartLine){
if( db.nBegin==0 ){
db_multi_exec("BEGIN IMMEDIATE");
sqlite3_commit_hook(g.db, db_verify_at_commit, 0);
db.nPriorChanges = sqlite3_total_changes(g.db);
db.doRollback = 0;
db.zStartFile = zStartFile;
db.iStartLine = iStartLine;
db.wrTxn = 1;
}else if( !db.wrTxn ){
fossil_warning("read txn at %s:%d might cause SQLITE_BUSY "
"for the write txn at %s:%d",
db.zStartFile, db.iStartLine, zStartFile, iStartLine);
}
db.nBegin++;
}
|
| ︙ | ︙ | |||
1326 1327 1328 1329 1330 1331 1332 |
SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE,
g.zVfsName
);
if( rc!=SQLITE_OK ){
db_err("[%s]: %s", zDbName, sqlite3_errmsg(db));
}
db_maybe_set_encryption_key(db, zDbName);
| | | | 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 |
SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE,
g.zVfsName
);
if( rc!=SQLITE_OK ){
db_err("[%s]: %s", zDbName, sqlite3_errmsg(db));
}
db_maybe_set_encryption_key(db, zDbName);
sqlite3_busy_timeout(db, 15000);
sqlite3_wal_autocheckpoint(db, 1); /* Set to checkpoint frequently */
sqlite3_create_function(db, "user", 0, SQLITE_UTF8, 0, db_sql_user, 0, 0);
sqlite3_create_function(db, "cgi", 1, SQLITE_UTF8, 0, db_sql_cgi, 0, 0);
sqlite3_create_function(db, "cgi", 2, SQLITE_UTF8, 0, db_sql_cgi, 0, 0);
sqlite3_create_function(db, "print", -1, SQLITE_UTF8, 0,db_sql_print,0,0);
sqlite3_create_function(
db, "is_selected", 1, SQLITE_UTF8, 0, file_is_selected,0,0
);
sqlite3_create_function(
db, "if_selected", 3, SQLITE_UTF8, 0, file_is_selected,0,0
);
if( g.fSqlTrace ) sqlite3_trace_v2(db, SQLITE_TRACE_PROFILE, db_sql_trace, 0);
db_add_aux_functions(db);
re_add_sql_func(db); /* The REGEXP operator */
foci_register(db); /* The "files_of_checkin" virtual table */
sqlite3_db_config(db, SQLITE_DBCONFIG_ENABLE_FKEY, 0, &rc);
return db;
}
/*
** Detaches the zLabel database.
*/
|
| ︙ | ︙ |
Changes to src/xfer.c.
| ︙ | ︙ | |||
1211 1212 1213 1214 1215 1216 1217 |
xfer.pOut = cgi_output_blob();
xfer.mxSend = db_get_int("max-download", 5000000);
xfer.maxTime = db_get_int("max-download-time", 30);
if( xfer.maxTime<1 ) xfer.maxTime = 1;
xfer.maxTime += time(NULL);
g.xferPanic = 1;
| | | 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 |
xfer.pOut = cgi_output_blob();
xfer.mxSend = db_get_int("max-download", 5000000);
xfer.maxTime = db_get_int("max-download-time", 30);
if( xfer.maxTime<1 ) xfer.maxTime = 1;
xfer.maxTime += time(NULL);
g.xferPanic = 1;
db_begin_write();
db_multi_exec(
"CREATE TEMP TABLE onremote(rid INTEGER PRIMARY KEY);"
"CREATE TEMP TABLE unk(uuid TEXT PRIMARY KEY) WITHOUT ROWID;"
);
manifest_crosslink_begin();
rc = xfer_run_common_script();
if( rc==TH_ERROR ){
|
| ︙ | ︙ | |||
1751 1752 1753 1754 1755 1756 1757 |
/* Send the server timestamp last, in case prior processing happened
** to use up a significant fraction of our time window.
*/
zNow = db_text(0, "SELECT strftime('%%Y-%%m-%%dT%%H:%%M:%%S', 'now')");
@ # timestamp %s(zNow)
free(zNow);
| | | 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 |
/* Send the server timestamp last, in case prior processing happened
** to use up a significant fraction of our time window.
*/
zNow = db_text(0, "SELECT strftime('%%Y-%%m-%%dT%%H:%%M:%%S', 'now')");
@ # timestamp %s(zNow)
free(zNow);
db_commit_transaction();
configure_rebuild();
}
/*
** COMMAND: test-xfer
**
** This command is used for debugging the server. There is a single
|
| ︙ | ︙ |