Changes On Branch experimental
Not logged in

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

Changes In Branch experimental Excluding Merge-Ins

This is equivalent to a diff from 80bf94e0f7 to 970cc4f16f

2013-01-23
13:24
Add the max-download-time server option that limits the amount of real-time that the server will spend preparing an xfer protocol reply. check-in: 769c90a230 user: drh tags: trunk
12:31
Only check time, if it is set. Closed-Leaf check-in: 970cc4f16f user: joerg tags: experimental
2013-01-20
10:57
Fix the SQL for the command-line timeline so that it works for timeline items that are not associated with a particular branch. check-in: 1d462a683f user: drh tags: trunk
2013-01-18
22:05
Add new option max-download-time to limit the processing time of pull/sync /clone requests. This helps to significantly cut down the number of time outs clients receive on busy server with reverse proxy configuration. It generally provides better response times. check-in: ee6ae580ee user: joerg tags: experimental
21:34
Run "analyze" after a rebuild. For small repositories, the time doesn't matter and for large repositories, the effect on the query plans are huge. Push/pull for example will otherwise do a sequential scan of the blob table and joining that with the unclustered table afterwards, when the other way around is several order of magnitudes more efficient... check-in: 80bf94e0f7 user: joerg tags: trunk
12:36
Bring the regexp.c module into alignment with the similar code in the SQLite test suite. check-in: 2f10a050c6 user: drh tags: trunk

Changes to src/setup.c.

   915    915                     "5000000");
   916    916     @ <p>Fossil tries to limit out-bound sync, clone, and pull packets
   917    917     @ to this many bytes, uncompressed.  If the client requires more data
   918    918     @ than this, then the client will issue multiple HTTP requests.
   919    919     @ Values below 1 million are not recommended.  5 million is a
   920    920     @ reasonable number.</p>
   921    921   
          922  +  @ <hr />
          923  +  entry_attribute("Download time limit", 11, "max-download-time", "mxdwnt",
          924  +                  "30");
          925  +
          926  +  @ <p>Fossil tries to spend less than this many seconds gathering
          927  +  @ the out-bound data of sync, clone, and pull packets.
          928  +  @ If the client request takes longer, a partial reply is given similar
          929  +  @ to the download packet limit. 30s is a reasonable default.</p>
          930  +
   922    931     @ <hr />
   923    932     onoff_attribute(
   924    933         "Enable hyperlinks for \"nobody\" based on User-Agent and Javascript",
   925    934         "auto-hyperlink", "autohyperlink", 1);
   926    935     @ <p>Enable hyperlinks (the equivalent of the "h" permission) for all users
   927    936     @ including user "nobody", as long as (1) the User-Agent string in the
   928    937     @ HTTP header indicates that the request is coming from an actual human

Changes to src/xfer.c.

    16     16   *******************************************************************************
    17     17   **
    18     18   ** This file contains code to implement the file transfer protocol.
    19     19   */
    20     20   #include "config.h"
    21     21   #include "xfer.h"
    22     22   
           23  +#include <time.h>
           24  +
    23     25   /*
    24     26   ** This structure holds information about the current state of either
    25     27   ** a client or a server that is participating in xfer.
    26     28   */
    27     29   typedef struct Xfer Xfer;
    28     30   struct Xfer {
    29     31     Blob *pIn;          /* Input text from the other side */
................................................................................
    38     40     int nDeltaSent;     /* Number of deltas sent */
    39     41     int nFileRcvd;      /* Number of files received */
    40     42     int nDeltaRcvd;     /* Number of deltas received */
    41     43     int nDanglingFile;  /* Number of dangling deltas received */
    42     44     int mxSend;         /* Stop sending "file" with pOut reaches this size */
    43     45     u8 syncPrivate;     /* True to enable syncing private content */
    44     46     u8 nextIsPrivate;   /* If true, next "file" received is a private */
           47  +  time_t maxTime;     /* Time when this transfer should be finished */
    45     48   };
    46     49   
    47     50   
    48     51   /*
    49     52   ** The input blob contains a UUID.  Convert it into a record ID.
    50     53   ** Create a phantom record if no prior record exists and
    51     54   ** phantomize is true.
................................................................................
   391    394     }else{
   392    395       pUuid = &uuid;
   393    396     }
   394    397     if( uuid_is_shunned(blob_str(pUuid)) ){
   395    398       blob_reset(&uuid);
   396    399       return;
   397    400     }
   398         -  if( pXfer->mxSend<=blob_size(pXfer->pOut) ){
          401  +  if( (pXfer->maxTime != -1 && time(NULL) >= pXfer->maxTime) || 
          402  +       pXfer->mxSend<=blob_size(pXfer->pOut) ){
   399    403       const char *zFormat = isPriv ? "igot %b 1\n" : "igot %b\n";
   400    404       blob_appendf(pXfer->pOut, zFormat, pUuid);
   401    405       pXfer->nIGotSent++;
   402    406       blob_reset(&uuid);
   403    407       return;
   404    408     }
   405    409     if( nativeDelta ){
................................................................................
   865    869       @ error database\sschema\sis\sout-of-date\son\sthe\sserver.
   866    870       return;
   867    871     }
   868    872     blob_zero(&xfer.err);
   869    873     xfer.pIn = &g.cgiIn;
   870    874     xfer.pOut = cgi_output_blob();
   871    875     xfer.mxSend = db_get_int("max-download", 5000000);
          876  +  xfer.maxTime = time(NULL) + db_get_int("max-download-time", 30);
   872    877     g.xferPanic = 1;
   873    878   
   874    879     db_begin_transaction();
   875    880     db_multi_exec(
   876    881        "CREATE TEMP TABLE onremote(rid INTEGER PRIMARY KEY);"
   877    882     );
   878    883     manifest_crosslink_begin();
................................................................................
  1032   1037         ){
  1033   1038           int seqno, max;
  1034   1039           if( iVers>=3 ){
  1035   1040             cgi_set_content_type("application/x-fossil-uncompressed");
  1036   1041           }
  1037   1042           blob_is_int(&xfer.aToken[2], &seqno);
  1038   1043           max = db_int(0, "SELECT max(rid) FROM blob");
  1039         -        while( xfer.mxSend>blob_size(xfer.pOut) && seqno<=max ){
         1044  +        while( xfer.mxSend>blob_size(xfer.pOut) && seqno<=max){
         1045  +          if( time(NULL) >= xfer.maxTime ) break;
  1040   1046             if( iVers>=3 ){
  1041   1047               send_compressed_file(&xfer, seqno);
  1042   1048             }else{
  1043   1049               send_file(&xfer, seqno, 0, 1);
  1044   1050             }
  1045   1051             seqno++;
  1046   1052           }
................................................................................
  1326   1332   
  1327   1333     transport_stats(0, 0, 1);
  1328   1334     socket_global_init();
  1329   1335     memset(&xfer, 0, sizeof(xfer));
  1330   1336     xfer.pIn = &recv;
  1331   1337     xfer.pOut = &send;
  1332   1338     xfer.mxSend = db_get_int("max-upload", 250000);
         1339  +  xfer.maxTime = -1;
  1333   1340     if( syncFlags & SYNC_PRIVATE ){
  1334   1341       g.perm.Private = 1;
  1335   1342       xfer.syncPrivate = 1;
  1336   1343     }
  1337   1344   
  1338   1345     db_begin_transaction();
  1339   1346     db_record_repository_filename(0);