From e32a256acd23dcde4671a662426afa8a6d3a354b Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 4 Mar 2016 02:38:00 +0000 Subject: [PATCH 1/6] Update the configure script to detect pread/pwrite and update os_unix.c to use those routines if they are available. FossilOrigin-Name: 2cffb9e50bed77d1079603f5b4a71b7559de7294 --- config.h.in | 12 ++++++++++++ configure | 2 +- configure.ac | 2 +- manifest | 19 +++++++++---------- manifest.uuid | 2 +- src/os_unix.c | 37 +++++++++++++++++++++++++++---------- 6 files changed, 51 insertions(+), 23 deletions(-) diff --git a/config.h.in b/config.h.in index 36fd60781c..f2ba7d4fc4 100644 --- a/config.h.in +++ b/config.h.in @@ -45,6 +45,18 @@ /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H +/* Define to 1 if you have the pread() function. */ +#undef HAVE_PREAD + +/* Define to 1 if you have the pread64() function. */ +#undef HAVE_PREAD64 + +/* Define to 1 if you have the pwrite() function. */ +#undef HAVE_PWRITE + +/* Define to 1 if you have the pwrite64() function. */ +#undef HAVE_PWRITE64 + /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H diff --git a/configure b/configure index 09fba81eae..8363818c6f 100755 --- a/configure +++ b/configure @@ -10273,7 +10273,7 @@ done ######### # Figure out whether or not we have these functions # -for ac_func in fdatasync gmtime_r isnan localtime_r localtime_s malloc_usable_size strchrnul usleep utime +for ac_func in fdatasync gmtime_r isnan localtime_r localtime_s malloc_usable_size strchrnul usleep utime pread pread64 pwrite pwrite64 do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" diff --git a/configure.ac b/configure.ac index 19f85dc875..08c8867f06 100644 --- a/configure.ac +++ b/configure.ac @@ -108,7 +108,7 @@ AC_CHECK_HEADERS([sys/types.h stdlib.h stdint.h inttypes.h malloc.h]) ######### # Figure out whether or not we have these functions # -AC_CHECK_FUNCS([fdatasync gmtime_r isnan localtime_r localtime_s malloc_usable_size strchrnul usleep utime]) +AC_CHECK_FUNCS([fdatasync gmtime_r isnan localtime_r localtime_s malloc_usable_size strchrnul usleep utime pread pread64 pwrite pwrite64]) ######### # By default, we use the amalgamation (this may be changed below...) diff --git a/manifest b/manifest index 7f70989146..06e5c8c969 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Reduce\sthe\samount\sof\sheap\smemory\srequired\sto\sstore\smany\sschemas\sby\sstoring\s\nthe\scolumn\sdatatype\sappended\sto\sthe\scolumn\sname\s(with\sa\s\\000\sseparator),\s\nrather\sthan\sin\sseparate\smemory\sallocation. -D 2016-03-03T21:22:53.735 +C Update\sthe\sconfigure\sscript\sto\sdetect\spread/pwrite\sand\supdate\sos_unix.c\sto\nuse\sthose\sroutines\sif\sthey\sare\savailable. +D 2016-03-04T02:38:00.565 F Makefile.in e335453db0b16da00c884ad51bb56d1c091a74de F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc dbd4621ecc585c2ef0c2aa0874698c54675754f1 @@ -28,10 +28,10 @@ F autoconf/tea/win/makefile.vc f89d0184d0eee5f7e356ea407964dcd139939928 F autoconf/tea/win/nmakehlp.c 247538ad8e8c508f33c03ec1fbd67d3a07ef6291 F autoconf/tea/win/rules.vc c511f222b80064096b705dbeb97060ee1d6b6d63 F config.guess 226d9a188c6196f3033ffc651cbc9dcee1a42977 -F config.h.in 42b71ad3fe21c9e88fa59e8458ca1a6bc72eb0c0 +F config.h.in 6376abec766e9a0785178b1823b5a587e9f1ccbc F config.sub 9ebe4c3b3dab6431ece34f16828b594fb420da55 -F configure 0339a635cd2943a3b56000a10a11b4b2e6ed6d1b x -F configure.ac a2224b1162f79848982d3618ac1deffcd94e88ec +F configure c01a159fdf7ea0171ad01ce2937283f2c7972bde x +F configure.ac 89e4e02a83d8a1528011f8395621b8c3186b4089 F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad F doc/lemon.html c30255bea0fd87a81f082d17a72c9dffbc3f6dd9 F doc/pager-invariants.txt 27fed9a70ddad2088750c4a2b493b63853da2710 @@ -333,7 +333,7 @@ F src/os.c ca9a104b677328ee037cfdf1a54a16fd1805e8c9 F src/os.h 3e57a24e2794a94d3cf2342c6d9a884888cd96bf F src/os_common.h b2f4707a603e36811d9b1a13278bffd757857b85 F src/os_setup.h c9d4553b5aaa6f73391448b265b89bed0b890faa -F src/os_unix.c 3a6f20736dfb8a0949cdd66553fdf59f6604be35 +F src/os_unix.c a1aaf2d8d253138e63d2a8a972693f9f624f885d F src/os_win.c f0d7aa603eb6262143d7169a222aea07c4fca91d F src/os_win.h eb7a47aa17b26b77eb97e4823f20a00b8bda12ca F src/pager.c d034c69b958c01289eb8070cbf902e1a68cd7e0b @@ -1453,8 +1453,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 3eb74342740cd393e03aa38cd01690ccab173b76 842b21162713bb141b845b01c136457a31af4ab0 -R 8594cd13d54710bae620a17d4ba5114b -T +closed 842b21162713bb141b845b01c136457a31af4ab0 +P 16fbf2e19c22df9441aef5c8b7f5670adc38a6b6 +R 8390ec5e0d9e5eb3999e5eee0cb5ce81 U drh -Z 4f9819dace7a151b6043885dfe386959 +Z b764ac5f33b779f6bf5d09a763220c12 diff --git a/manifest.uuid b/manifest.uuid index 82610772e0..ec9225526f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -16fbf2e19c22df9441aef5c8b7f5670adc38a6b6 \ No newline at end of file +2cffb9e50bed77d1079603f5b4a71b7559de7294 \ No newline at end of file diff --git a/src/os_unix.c b/src/os_unix.c index ea07bd99f3..9bcefb1195 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -71,6 +71,20 @@ # endif #endif +/* Use pread() and pwrite() if they are available */ +#if defined(HAVE_PREAD64) && defined(HAVE_PWRITE64) +# undef USE_PREAD +# undef USE_PWRITE +# define USE_PREAD64 1 +# define USE_PWRITE64 1 +#elif defined(HAVE_PREAD) && defined(HAVE_PWRITE) +# undef USE_PREAD +# undef USE_PWRITE +# define USE_PREAD64 1 +# define USE_PWRITE64 1 +#endif + + /* ** standard include files. */ @@ -200,6 +214,9 @@ struct unixFile { const char *zPath; /* Name of the file */ unixShm *pShm; /* Shared memory segment information */ int szChunk; /* Configured by FCNTL_CHUNK_SIZE */ +#if !defined(USE_PREAD) && !defined(USE_PREAD64) + off64_t iOfst; /* Current offset */ +#endif #if SQLITE_MAX_MMAP_SIZE>0 int nFetchOut; /* Number of outstanding xFetch refs */ sqlite3_int64 mmapSize; /* Usable size of mapping at pMapRegion */ @@ -3097,9 +3114,6 @@ static int nfsUnlock(sqlite3_file *id, int eFileLock){ static int seekAndRead(unixFile *id, sqlite3_int64 offset, void *pBuf, int cnt){ int got; int prior = 0; -#if (!defined(USE_PREAD) && !defined(USE_PREAD64)) - i64 newOffset; -#endif TIMER_START; assert( cnt==(cnt&0x1ffff) ); assert( id->h>2 ); @@ -3111,13 +3125,15 @@ static int seekAndRead(unixFile *id, sqlite3_int64 offset, void *pBuf, int cnt){ got = osPread64(id->h, pBuf, cnt, offset); SimulateIOError( got = -1 ); #else - newOffset = lseek(id->h, offset, SEEK_SET); - SimulateIOError( newOffset = -1 ); - if( newOffset<0 ){ - storeLastErrno((unixFile*)id, errno); - return -1; - } - got = osRead(id->h, pBuf, cnt); + if( offset!=id->iOfst ){ + id->iOfst = lseek(id->h, offset, SEEK_SET); + SimulateIOError( id->iOfst = -1 ); + if( id->iOfst<0 ){ + storeLastErrno((unixFile*)id, errno); + return -1; + } + got = osRead(id->h, pBuf, cnt); + if( got>=0 ) id->iOfst += got; #endif if( got==cnt ) break; if( got<0 ){ @@ -3223,6 +3239,7 @@ static int seekAndWriteFd( do{ rc = (int)osPwrite64(fd, pBuf, nBuf, iOff);}while( rc<0 && errno==EINTR); #else do{ + if( iOff!=fd i64 iSeek = lseek(fd, iOff, SEEK_SET); SimulateIOError( iSeek = -1 ); if( iSeek<0 ){ From ddebf16f1f209dca695f813c6f87e4ad72c639ec Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 4 Mar 2016 02:59:35 +0000 Subject: [PATCH 2/6] Add the test_bestindex.c file to Makefile.in and Makefile.msc so that "make test" will work again. FossilOrigin-Name: 6ec6b6a97e62be1abe1e349b5bc04c6f5ae88968 --- Makefile.in | 1 + Makefile.msc | 1 + manifest | 15 +++++++-------- manifest.uuid | 2 +- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Makefile.in b/Makefile.in index 891329719a..93d4181e8d 100644 --- a/Makefile.in +++ b/Makefile.in @@ -376,6 +376,7 @@ TESTSRC = \ $(TOP)/src/test_autoext.c \ $(TOP)/src/test_async.c \ $(TOP)/src/test_backup.c \ + $(TOP)/src/test_bestindex.c \ $(TOP)/src/test_blob.c \ $(TOP)/src/test_btree.c \ $(TOP)/src/test_config.c \ diff --git a/Makefile.msc b/Makefile.msc index d9af285c06..c5130beb1e 100644 --- a/Makefile.msc +++ b/Makefile.msc @@ -1236,6 +1236,7 @@ TESTSRC = \ $(TOP)\src\test_autoext.c \ $(TOP)\src\test_async.c \ $(TOP)\src\test_backup.c \ + $(TOP)\src\test_bestindex.c \ $(TOP)\src\test_blob.c \ $(TOP)\src\test_btree.c \ $(TOP)\src\test_config.c \ diff --git a/manifest b/manifest index 7f70989146..d5a273c8df 100644 --- a/manifest +++ b/manifest @@ -1,8 +1,8 @@ -C Reduce\sthe\samount\sof\sheap\smemory\srequired\sto\sstore\smany\sschemas\sby\sstoring\s\nthe\scolumn\sdatatype\sappended\sto\sthe\scolumn\sname\s(with\sa\s\\000\sseparator),\s\nrather\sthan\sin\sseparate\smemory\sallocation. -D 2016-03-03T21:22:53.735 -F Makefile.in e335453db0b16da00c884ad51bb56d1c091a74de +C Add\sthe\stest_bestindex.c\sfile\sto\sMakefile.in\sand\sMakefile.msc\sso\sthat\n"make\stest"\swill\swork\sagain. +D 2016-03-04T02:59:35.823 +F Makefile.in 4c3d3d1b98454bf60e8977223b26ef30777a2bf2 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 -F Makefile.msc dbd4621ecc585c2ef0c2aa0874698c54675754f1 +F Makefile.msc 0dc13352b84b257d81736076d8101a584940c409 F README.md 8ecc12493ff9f820cdea6520a9016001cb2e59b7 F VERSION c6b1f51809551d60ad001e6d87cf3ab2c7f54b6f F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50 @@ -1453,8 +1453,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 3eb74342740cd393e03aa38cd01690ccab173b76 842b21162713bb141b845b01c136457a31af4ab0 -R 8594cd13d54710bae620a17d4ba5114b -T +closed 842b21162713bb141b845b01c136457a31af4ab0 +P 16fbf2e19c22df9441aef5c8b7f5670adc38a6b6 +R 7c159ecc947e100f72a0b55ddd229f42 U drh -Z 4f9819dace7a151b6043885dfe386959 +Z bb6e56d7a0bd406da0bf812970d93fdb diff --git a/manifest.uuid b/manifest.uuid index 82610772e0..d8612046f6 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -16fbf2e19c22df9441aef5c8b7f5670adc38a6b6 \ No newline at end of file +6ec6b6a97e62be1abe1e349b5bc04c6f5ae88968 \ No newline at end of file From a46cadc42e5cc1da7ea8a739b50a7b4c9a7d9e84 Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 4 Mar 2016 03:02:06 +0000 Subject: [PATCH 3/6] Fix the build for cases when pread()/pwrite() are not available. FossilOrigin-Name: 7d67d876b70c7a4199697c5b112d809c600e140e --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/os_unix.c | 24 ++++++++++-------------- 3 files changed, 17 insertions(+), 21 deletions(-) diff --git a/manifest b/manifest index 06e5c8c969..1d5201bf29 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Update\sthe\sconfigure\sscript\sto\sdetect\spread/pwrite\sand\supdate\sos_unix.c\sto\nuse\sthose\sroutines\sif\sthey\sare\savailable. -D 2016-03-04T02:38:00.565 +C Fix\sthe\sbuild\sfor\scases\swhen\spread()/pwrite()\sare\snot\savailable. +D 2016-03-04T03:02:06.930 F Makefile.in e335453db0b16da00c884ad51bb56d1c091a74de F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc dbd4621ecc585c2ef0c2aa0874698c54675754f1 @@ -333,7 +333,7 @@ F src/os.c ca9a104b677328ee037cfdf1a54a16fd1805e8c9 F src/os.h 3e57a24e2794a94d3cf2342c6d9a884888cd96bf F src/os_common.h b2f4707a603e36811d9b1a13278bffd757857b85 F src/os_setup.h c9d4553b5aaa6f73391448b265b89bed0b890faa -F src/os_unix.c a1aaf2d8d253138e63d2a8a972693f9f624f885d +F src/os_unix.c 14a28aeb3b77102a90ed645534a8d319b8ac6082 F src/os_win.c f0d7aa603eb6262143d7169a222aea07c4fca91d F src/os_win.h eb7a47aa17b26b77eb97e4823f20a00b8bda12ca F src/pager.c d034c69b958c01289eb8070cbf902e1a68cd7e0b @@ -1453,7 +1453,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 16fbf2e19c22df9441aef5c8b7f5670adc38a6b6 -R 8390ec5e0d9e5eb3999e5eee0cb5ce81 +P 2cffb9e50bed77d1079603f5b4a71b7559de7294 +R 340d2ced6d6364f0299bbd36b34b2f41 U drh -Z b764ac5f33b779f6bf5d09a763220c12 +Z a704f390d3e95dbf657db754d417ef5a diff --git a/manifest.uuid b/manifest.uuid index ec9225526f..6b0c506b3d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -2cffb9e50bed77d1079603f5b4a71b7559de7294 \ No newline at end of file +7d67d876b70c7a4199697c5b112d809c600e140e \ No newline at end of file diff --git a/src/os_unix.c b/src/os_unix.c index 9bcefb1195..844a1c46e1 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -84,7 +84,6 @@ # define USE_PWRITE64 1 #endif - /* ** standard include files. */ @@ -214,9 +213,6 @@ struct unixFile { const char *zPath; /* Name of the file */ unixShm *pShm; /* Shared memory segment information */ int szChunk; /* Configured by FCNTL_CHUNK_SIZE */ -#if !defined(USE_PREAD) && !defined(USE_PREAD64) - off64_t iOfst; /* Current offset */ -#endif #if SQLITE_MAX_MMAP_SIZE>0 int nFetchOut; /* Number of outstanding xFetch refs */ sqlite3_int64 mmapSize; /* Usable size of mapping at pMapRegion */ @@ -3114,6 +3110,9 @@ static int nfsUnlock(sqlite3_file *id, int eFileLock){ static int seekAndRead(unixFile *id, sqlite3_int64 offset, void *pBuf, int cnt){ int got; int prior = 0; +#if (!defined(USE_PREAD) && !defined(USE_PREAD64)) + i64 newOffset; +#endif TIMER_START; assert( cnt==(cnt&0x1ffff) ); assert( id->h>2 ); @@ -3125,15 +3124,13 @@ static int seekAndRead(unixFile *id, sqlite3_int64 offset, void *pBuf, int cnt){ got = osPread64(id->h, pBuf, cnt, offset); SimulateIOError( got = -1 ); #else - if( offset!=id->iOfst ){ - id->iOfst = lseek(id->h, offset, SEEK_SET); - SimulateIOError( id->iOfst = -1 ); - if( id->iOfst<0 ){ - storeLastErrno((unixFile*)id, errno); - return -1; - } - got = osRead(id->h, pBuf, cnt); - if( got>=0 ) id->iOfst += got; + newOffset = lseek(id->h, offset, SEEK_SET); + SimulateIOError( newOffset = -1 ); + if( newOffset<0 ){ + storeLastErrno((unixFile*)id, errno); + return -1; + } + got = osRead(id->h, pBuf, cnt); #endif if( got==cnt ) break; if( got<0 ){ @@ -3239,7 +3236,6 @@ static int seekAndWriteFd( do{ rc = (int)osPwrite64(fd, pBuf, nBuf, iOff);}while( rc<0 && errno==EINTR); #else do{ - if( iOff!=fd i64 iSeek = lseek(fd, iOff, SEEK_SET); SimulateIOError( iSeek = -1 ); if( iSeek<0 ){ From 79a2ca394467bdddb4ac5f607b1d0c54d176bc42 Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 4 Mar 2016 03:14:39 +0000 Subject: [PATCH 4/6] Further fixes to the pread()/pwrite() enabling logic. FossilOrigin-Name: 38fb54e7854ac0500a88585ff9dd7487b4b2e586 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/os_unix.c | 12 ++++++------ 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/manifest b/manifest index 1d5201bf29..be929a8bc7 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sthe\sbuild\sfor\scases\swhen\spread()/pwrite()\sare\snot\savailable. -D 2016-03-04T03:02:06.930 +C Further\sfixes\sto\sthe\spread()/pwrite()\senabling\slogic. +D 2016-03-04T03:14:39.390 F Makefile.in e335453db0b16da00c884ad51bb56d1c091a74de F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc dbd4621ecc585c2ef0c2aa0874698c54675754f1 @@ -333,7 +333,7 @@ F src/os.c ca9a104b677328ee037cfdf1a54a16fd1805e8c9 F src/os.h 3e57a24e2794a94d3cf2342c6d9a884888cd96bf F src/os_common.h b2f4707a603e36811d9b1a13278bffd757857b85 F src/os_setup.h c9d4553b5aaa6f73391448b265b89bed0b890faa -F src/os_unix.c 14a28aeb3b77102a90ed645534a8d319b8ac6082 +F src/os_unix.c f5bac8e74aaefc4ea520e43b4540793c3b8a9e8f F src/os_win.c f0d7aa603eb6262143d7169a222aea07c4fca91d F src/os_win.h eb7a47aa17b26b77eb97e4823f20a00b8bda12ca F src/pager.c d034c69b958c01289eb8070cbf902e1a68cd7e0b @@ -1453,7 +1453,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 2cffb9e50bed77d1079603f5b4a71b7559de7294 -R 340d2ced6d6364f0299bbd36b34b2f41 +P 7d67d876b70c7a4199697c5b112d809c600e140e +R ce4934ea34542df91b05d44a6acdf078 U drh -Z a704f390d3e95dbf657db754d417ef5a +Z 4e6c0c7126b5fe5706a071d24d8aba5f diff --git a/manifest.uuid b/manifest.uuid index 6b0c506b3d..0966145f3c 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -7d67d876b70c7a4199697c5b112d809c600e140e \ No newline at end of file +38fb54e7854ac0500a88585ff9dd7487b4b2e586 \ No newline at end of file diff --git a/src/os_unix.c b/src/os_unix.c index 844a1c46e1..d6fbd80588 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -72,16 +72,16 @@ #endif /* Use pread() and pwrite() if they are available */ +#if defined(__APPLE__) +# define HAVE_PREAD 1 +# define HAVE_PWRITE 1 +#endif #if defined(HAVE_PREAD64) && defined(HAVE_PWRITE64) # undef USE_PREAD -# undef USE_PWRITE # define USE_PREAD64 1 -# define USE_PWRITE64 1 #elif defined(HAVE_PREAD) && defined(HAVE_PWRITE) -# undef USE_PREAD -# undef USE_PWRITE -# define USE_PREAD64 1 -# define USE_PWRITE64 1 +# undef USE_PREAD64 +# define USE_PREAD 1 #endif /* From 9878fefd6fcc28dbe4a40a2dfa8659c1dcce14bc Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 4 Mar 2016 03:43:10 +0000 Subject: [PATCH 5/6] Change the default page size for new database files to 4096 (from 1024). Except, when building the testfixture, preserve the legacy page size. Also fix a comment on SQLITE_MAX_ATTACHED. FossilOrigin-Name: 2e8a9ca9d3d6efddc31f01074d14acae56568c37 --- Makefile.in | 1 + Makefile.msc | 1 + main.mk | 1 + manifest | 19 +++++++++---------- manifest.uuid | 2 +- src/sqliteLimit.h | 7 ++++--- 6 files changed, 17 insertions(+), 14 deletions(-) diff --git a/Makefile.in b/Makefile.in index 93d4181e8d..61d4d671ce 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1052,6 +1052,7 @@ TESTFIXTURE_FLAGS = -DTCLSH=1 -DSQLITE_TEST=1 -DSQLITE_CRASH_TEST=1 TESTFIXTURE_FLAGS += -DSQLITE_SERVER=1 -DSQLITE_PRIVATE="" -DSQLITE_CORE TESTFIXTURE_FLAGS += -DBUILD_sqlite TESTFIXTURE_FLAGS += -DSQLITE_SERIES_CONSTRAINT_VERIFY=1 +TESTFIXTURE_FLAGS += -DSQLITE_DEFAULT_PAGE_SIZE=1024 TESTFIXTURE_SRC0 = $(TESTSRC2) libsqlite3.la TESTFIXTURE_SRC1 = sqlite3.c diff --git a/Makefile.msc b/Makefile.msc index c5130beb1e..59ce3c2ec2 100644 --- a/Makefile.msc +++ b/Makefile.msc @@ -1927,6 +1927,7 @@ TESTFIXTURE_FLAGS = -DTCLSH=1 -DSQLITE_TEST=1 -DSQLITE_CRASH_TEST=1 TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_SERVER=1 -DSQLITE_PRIVATE="" TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_CORE $(NO_WARN) TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_SERIES_CONSTRAINT_VERIFY=1 +TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_DEFAULT_PAGE_SIZE=1024 TESTFIXTURE_SRC0 = $(TESTEXT) $(TESTSRC2) TESTFIXTURE_SRC1 = $(TESTEXT) $(SQLITE3C) diff --git a/main.mk b/main.mk index 97dc254378..2ea493d111 100644 --- a/main.mk +++ b/main.mk @@ -728,6 +728,7 @@ sqlite3_analyzer$(EXE): sqlite3_analyzer.c TESTFIXTURE_FLAGS = -DSQLITE_TEST=1 -DSQLITE_CRASH_TEST=1 TESTFIXTURE_FLAGS += -DSQLITE_SERVER=1 -DSQLITE_PRIVATE="" -DSQLITE_CORE TESTFIXTURE_FLAGS += -DSQLITE_SERIES_CONSTRAINT_VERIFY=1 +TESTFIXTURE_FLAGS += -DSQLITE_DEFAULT_PAGE_SIZE=1024 testfixture$(EXE): $(TESTSRC2) libsqlite3.a $(TESTSRC) $(TOP)/src/tclsqlite.c $(TCCX) $(TCL_FLAGS) -DTCLSH=1 $(TESTFIXTURE_FLAGS) \ diff --git a/manifest b/manifest index 5f2a222724..6ef4154770 100644 --- a/manifest +++ b/manifest @@ -1,8 +1,8 @@ -C Detect\sthe\spresence\sof\spread()/pwrite()\ssystem\scalls\son\sunix\ssystems\sand\nuse\sthem\sif\savailable. -D 2016-03-04T03:20:05.475 -F Makefile.in 4c3d3d1b98454bf60e8977223b26ef30777a2bf2 +C Change\sthe\sdefault\spage\ssize\sfor\snew\sdatabase\sfiles\sto\s4096\s(from\s1024).\nExcept,\swhen\sbuilding\sthe\stestfixture,\spreserve\sthe\slegacy\spage\ssize.\nAlso\sfix\sa\scomment\son\sSQLITE_MAX_ATTACHED. +D 2016-03-04T03:43:10.844 +F Makefile.in ead489fe5d3313b8a2a8d5f3710173a4b50dd2e0 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 -F Makefile.msc 0dc13352b84b257d81736076d8101a584940c409 +F Makefile.msc d68db8ddac21ea2576ea5b446f12cf9ebe897a03 F README.md 8ecc12493ff9f820cdea6520a9016001cb2e59b7 F VERSION c6b1f51809551d60ad001e6d87cf3ab2c7f54b6f F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50 @@ -273,7 +273,7 @@ F ext/userauth/userauth.c 5fa3bdb492f481bbc1709fc83c91ebd13460c69e F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8 F magic.txt 8273bf49ba3b0c8559cb2774495390c31fd61c60 -F main.mk 518d93f9f606d515628f99ce03f9e909f4f8a2e3 +F main.mk d9982cb6a42b1c9da7d61cebae973cd6b034de61 F mkso.sh fd21c06b063bb16a5d25deea1752c2da6ac3ed83 F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271 F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504 @@ -355,7 +355,7 @@ F src/sqlite.h.in 57d2a02b14c9ec4f7cb294153eaf62294dc5aa68 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h dfbe62ffd95b99afe2140d8c35b180d11924072d F src/sqliteInt.h 8aa9992cb35289ede0946f7ba8e993070e040fc4 -F src/sqliteLimit.h 216557999cb45f2e3578ed53ebefe228d779cb46 +F src/sqliteLimit.h 7c17293db62f238ccdec1498dd855fc126fa07a9 F src/status.c 70912d7be68e9e2dbc4010c93d344af61d4c59ba F src/table.c 5226df15ab9179b9ed558d89575ea0ce37b03fc9 F src/tclsqlite.c 54dca4eaf3a9cb0a4b845ef54ffa99225c30a52e @@ -1453,8 +1453,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 6ec6b6a97e62be1abe1e349b5bc04c6f5ae88968 38fb54e7854ac0500a88585ff9dd7487b4b2e586 -R 2f3feca250b12264f442f8836aa34529 -T +closed 38fb54e7854ac0500a88585ff9dd7487b4b2e586 +P 82cbf5ad2ed988a006106e188e98096a52e6779d +R 0406775a6be9491c81a210a63da6c171 U drh -Z 6deed976f37e6ab4c44908da24567cb0 +Z 4f7c554d47a12cc14f56cbfb2a874afa diff --git a/manifest.uuid b/manifest.uuid index a3b88f39bd..5cef88240a 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -82cbf5ad2ed988a006106e188e98096a52e6779d \ No newline at end of file +2e8a9ca9d3d6efddc31f01074d14acae56568c37 \ No newline at end of file diff --git a/src/sqliteLimit.h b/src/sqliteLimit.h index 75cad1274b..ac06881953 100644 --- a/src/sqliteLimit.h +++ b/src/sqliteLimit.h @@ -120,8 +120,9 @@ /* ** The maximum number of attached databases. This must be between 0 -** and 62. The upper bound on 62 is because a 64-bit integer bitmap -** is used internally to track attached databases. +** and 125. The upper bound of 125 is because the attached databases are +** counted using a signed 8-bit integer which has a maximum value of 127 +** and we have to allow 2 extra counts for the "main" and "temp" databases. */ #ifndef SQLITE_MAX_ATTACHED # define SQLITE_MAX_ATTACHED 10 @@ -156,7 +157,7 @@ ** The default size of a database page. */ #ifndef SQLITE_DEFAULT_PAGE_SIZE -# define SQLITE_DEFAULT_PAGE_SIZE 1024 +# define SQLITE_DEFAULT_PAGE_SIZE 4096 #endif #if SQLITE_DEFAULT_PAGE_SIZE>SQLITE_MAX_PAGE_SIZE # undef SQLITE_DEFAULT_PAGE_SIZE From 94580868f5b9eea4b52710b7304a423006a44f98 Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 4 Mar 2016 04:01:43 +0000 Subject: [PATCH 6/6] Change the default cache_size to -2000 (which means 2000*1024 bytes independent of page_size). FossilOrigin-Name: 2682e8e413fadbca0673f242769af17bfd291559 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/sqliteLimit.h | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 6ef4154770..d39a07ce5c 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Change\sthe\sdefault\spage\ssize\sfor\snew\sdatabase\sfiles\sto\s4096\s(from\s1024).\nExcept,\swhen\sbuilding\sthe\stestfixture,\spreserve\sthe\slegacy\spage\ssize.\nAlso\sfix\sa\scomment\son\sSQLITE_MAX_ATTACHED. -D 2016-03-04T03:43:10.844 +C Change\sthe\sdefault\scache_size\sto\s-2000\s(which\smeans\s2000*1024\sbytes\nindependent\sof\spage_size). +D 2016-03-04T04:01:43.190 F Makefile.in ead489fe5d3313b8a2a8d5f3710173a4b50dd2e0 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc d68db8ddac21ea2576ea5b446f12cf9ebe897a03 @@ -355,7 +355,7 @@ F src/sqlite.h.in 57d2a02b14c9ec4f7cb294153eaf62294dc5aa68 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h dfbe62ffd95b99afe2140d8c35b180d11924072d F src/sqliteInt.h 8aa9992cb35289ede0946f7ba8e993070e040fc4 -F src/sqliteLimit.h 7c17293db62f238ccdec1498dd855fc126fa07a9 +F src/sqliteLimit.h 7b28cf72cbd52f178bfc97ea266445e351f2cd24 F src/status.c 70912d7be68e9e2dbc4010c93d344af61d4c59ba F src/table.c 5226df15ab9179b9ed558d89575ea0ce37b03fc9 F src/tclsqlite.c 54dca4eaf3a9cb0a4b845ef54ffa99225c30a52e @@ -1453,7 +1453,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 82cbf5ad2ed988a006106e188e98096a52e6779d -R 0406775a6be9491c81a210a63da6c171 +P 2e8a9ca9d3d6efddc31f01074d14acae56568c37 +R bce4d7ea1e35eefbc9f3bc83f2294e5c U drh -Z 4f7c554d47a12cc14f56cbfb2a874afa +Z 8be75f8161fe6fe960ec420b19540c0b diff --git a/manifest.uuid b/manifest.uuid index 5cef88240a..0d4fa9e4a9 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -2e8a9ca9d3d6efddc31f01074d14acae56568c37 \ No newline at end of file +2682e8e413fadbca0673f242769af17bfd291559 \ No newline at end of file diff --git a/src/sqliteLimit.h b/src/sqliteLimit.h index ac06881953..4b5ddaadec 100644 --- a/src/sqliteLimit.h +++ b/src/sqliteLimit.h @@ -102,12 +102,12 @@ ** the main database table and for temporary tables. ** ** IMPLEMENTATION-OF: R-31093-59126 The default suggested cache size -** is 2000 pages. +** is 2000*1024 bytes. ** IMPLEMENTATION-OF: R-48205-43578 The default suggested cache size can be ** altered using the SQLITE_DEFAULT_CACHE_SIZE compile-time options. */ #ifndef SQLITE_DEFAULT_CACHE_SIZE -# define SQLITE_DEFAULT_CACHE_SIZE 2000 +# define SQLITE_DEFAULT_CACHE_SIZE -2000 #endif /*