Cloud Backed SQLite

Check-in [da6e6920a2]
Login

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

Overview
Comment:Remove some logging code added by [7f2286d66679a878] that is now causing a problem.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: da6e6920a29c3b41664174e44d947e9137e7f77b25f80f7b996fbcb8f16602d1
User & Date: dan 2022-11-08 17:04:42.715
Context
2022-12-14
21:02
Fix bug allowing thread-unsafe function bcvfsWriteBlock() to be called from multiple threads simultaneously. check-in: 0cc1c88a88 user: dan tags: trunk
2022-11-08
17:04
Remove some logging code added by [7f2286d66679a878] that is now causing a problem. check-in: da6e6920a2 user: dan tags: trunk
2022-10-21
16:33
Fix handling of network errors and timeouts that occur after the HTTP headers have been delivered to the client. check-in: 393da2dd95 user: dan tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/blockcachevfs.c.
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
){
  sqlite3_bcvfs *pFs = pFile->pFs;
  const static int nCopy = 32*1024;
  u8 *aBuf;
  int ii;
  int rc = SQLITE_OK;

  int nZero = 0;                  /* Trailing zeroes in copied block */

  assert( (szBlk % nCopy)==0 );
  aBuf = (u8*)sqlite3_malloc(nCopy);
  if( aBuf==0 ) rc = SQLITE_NOMEM;

  for(ii=0; rc==SQLITE_OK && ii<szBlk; ii+=nCopy){
    i64 i1 = (iTo*szBlk) + ii;
    i64 i2 = (iFrom*szBlk) + ii;
    rc = bcvReadfile(pFile->pCacheFile, aBuf, nCopy, i2);
    if( rc==SQLITE_OK ){
      rc = bcvWritefile(pFile->pCacheFile, aBuf, nCopy, i1);

      if( pFs->mLog & SQLITE_BCV_LOG_UPLOAD ){
        int ii;
        for(ii=szBlk; ii>0 && aBuf[ii-1]==0x00; ii--);
        if( ii==0 ){
          nZero += szBlk;
        }else{
          nZero = szBlk-ii;
        }
      }

    }
  }

  bcvfsUploadLog(pFs, 
      "copied block %d of cache file to block %d (%d trailing zeroes)",
      iFrom, iTo, nZero
  );

  sqlite3_free(aBuf);
  return rc;
}

static void bcvfsBlockidToName(const u8 *pBlk, int nBlk, char *aBuf){
  hex_encode(pBlk, nBlk, aBuf, 1);







<
<










|
<
<
<
<
<
<
<
|
<
<
<
<
<
<
<
<
<







1010
1011
1012
1013
1014
1015
1016


1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027







1028









1029
1030
1031
1032
1033
1034
1035
){
  sqlite3_bcvfs *pFs = pFile->pFs;
  const static int nCopy = 32*1024;
  u8 *aBuf;
  int ii;
  int rc = SQLITE_OK;



  assert( (szBlk % nCopy)==0 );
  aBuf = (u8*)sqlite3_malloc(nCopy);
  if( aBuf==0 ) rc = SQLITE_NOMEM;

  for(ii=0; rc==SQLITE_OK && ii<szBlk; ii+=nCopy){
    i64 i1 = (iTo*szBlk) + ii;
    i64 i2 = (iFrom*szBlk) + ii;
    rc = bcvReadfile(pFile->pCacheFile, aBuf, nCopy, i2);
    if( rc==SQLITE_OK ){
      rc = bcvWritefile(pFile->pCacheFile, aBuf, nCopy, i1);
    }







  }










  sqlite3_free(aBuf);
  return rc;
}

static void bcvfsBlockidToName(const u8 *pBlk, int nBlk, char *aBuf){
  hex_encode(pBlk, nBlk, aBuf, 1);