SQLite

Check-in [6818c6e42f]
Login

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

Overview
Comment:Changed multiplex shim's xFilesize to return an error on mismatched chunk size. Added test of same.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 6818c6e42faf233afa6b30799c5b425aa42d0783
User & Date: shaneh 2010-12-01 23:42:43.000
Context
2010-12-02
06:08
Update misc7.test to account for EQP changes. (check-in: 917af565ac user: dan tags: trunk)
2010-12-01
23:42
Changed multiplex shim's xFilesize to return an error on mismatched chunk size. Added test of same. (check-in: 6818c6e42f user: shaneh tags: trunk)
22:08
Make sure a test of multiplex shim doesn't fail if a file already exists. (check-in: 80de240a32 user: shaneh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/test_multiplex.c.
541
542
543
544
545
546
547



548
549
550
551
552
553
554
555
556
    }
    if( pSubOpen ){
      sqlite3_int64 sz;
      rc2 = pSubOpen->pMethods->xFileSize(pSubOpen, &sz);
      if( rc2!=SQLITE_OK ){
        rc = rc2;
      }else{



        *pSize += sz;
        assert(sz<=gMultiplex.nChunkSize);
      }
    }else{
      break;
    }
  }
  multiplexLeave();
  return rc;







>
>
>

<







541
542
543
544
545
546
547
548
549
550
551

552
553
554
555
556
557
558
    }
    if( pSubOpen ){
      sqlite3_int64 sz;
      rc2 = pSubOpen->pMethods->xFileSize(pSubOpen, &sz);
      if( rc2!=SQLITE_OK ){
        rc = rc2;
      }else{
        if( sz>gMultiplex.nChunkSize ){
          rc = SQLITE_IOERR_FSTAT;
        }
        *pSize += sz;

      }
    }else{
      break;
    }
  }
  multiplexLeave();
  return rc;
Changes to test/multiplex.test.
446
447
448
449
450
451
452





































453
454
455

do_faultsim_test multiplex-5.5 -prep {
  catch { sqlite3_multiplex_shutdown }
} -body {
  sqlite3_multiplex_initialize "" 1
  multiplex_set 32768 16
}






































catch { sqlite3_multiplex_shutdown }
finish_test







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>



446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492

do_faultsim_test multiplex-5.5 -prep {
  catch { sqlite3_multiplex_shutdown }
} -body {
  sqlite3_multiplex_initialize "" 1
  multiplex_set 32768 16
}

# test that mismatch filesize is detected
set all_journal_modes {delete persist truncate memory off}
foreach jmode $all_journal_modes {
  do_test multiplex-5.6.1.$jmode {
    sqlite3_multiplex_shutdown
    multiplex_delete test.db
    sqlite3 db test.db
    db eval {
      PRAGMA page_size = 1024;
      PRAGMA auto_vacuum = off;
    }
    db eval "PRAGMA journal_mode = $jmode;"
  } $jmode
  do_test multiplex-5.6.2.$jmode {
    execsql {
      CREATE TABLE t1(a, b);
      INSERT INTO t1 VALUES(1, randomblob(1100));
      INSERT INTO t1 VALUES(2, randomblob(1100));
      INSERT INTO t1 VALUES(3, randomblob(1100));
      INSERT INTO t1 VALUES(4, randomblob(1100));
      INSERT INTO t1 VALUES(5, randomblob(1100));
    }
    db close
    sqlite3_multiplex_initialize "" 1
    multiplex_set 4096 16
    sqlite3 db test.db
  } {}
  do_test multiplex-5.6.3.$jmode {
    catchsql {
      INSERT INTO t1 VALUES(6, randomblob(1100));
    }
  } {1 {disk I/O error}}
  do_test multiplex-5.6.4.$jmode {
    db close
  } {}
}

catch { sqlite3_multiplex_shutdown }
finish_test