aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/lsm1/lsmInt.h2
-rw-r--r--ext/lsm1/lsm_file.c11
-rw-r--r--ext/lsm1/lsm_shared.c2
-rw-r--r--manifest16
-rw-r--r--manifest.uuid2
5 files changed, 24 insertions, 9 deletions
diff --git a/ext/lsm1/lsmInt.h b/ext/lsm1/lsmInt.h
index 8e956dbb4..b346d8dde 100644
--- a/ext/lsm1/lsmInt.h
+++ b/ext/lsm1/lsmInt.h
@@ -696,6 +696,8 @@ int lsmFsOpenLog(lsm_db *, int *);
void lsmFsCloseLog(lsm_db *);
void lsmFsClose(FileSystem *);
+int lsmFsUnmap(FileSystem *);
+
int lsmFsConfigure(lsm_db *db);
int lsmFsBlockSize(FileSystem *);
diff --git a/ext/lsm1/lsm_file.c b/ext/lsm1/lsm_file.c
index 7b2205106..3283c023d 100644
--- a/ext/lsm1/lsm_file.c
+++ b/ext/lsm1/lsm_file.c
@@ -1151,6 +1151,17 @@ static void fsGrowMapping(
}
/*
+** If it is mapped, unmap the database file.
+*/
+int lsmFsUnmap(FileSystem *pFS){
+ int rc = LSM_OK;
+ if( pFS ){
+ rc = lsmEnvRemap(pFS->pEnv, pFS->fdDb, -1, &pFS->pMap, &pFS->nMap);
+ }
+ return rc;
+}
+
+/*
** fsync() the database file.
*/
int lsmFsSyncDb(FileSystem *pFS, int nBlock){
diff --git a/ext/lsm1/lsm_shared.c b/ext/lsm1/lsm_shared.c
index 111b0ddbe..83e44b470 100644
--- a/ext/lsm1/lsm_shared.c
+++ b/ext/lsm1/lsm_shared.c
@@ -312,6 +312,7 @@ static void doDbDisconnect(lsm_db *pDb){
/* The database may only be truncated if there exist no read-only
** clients - either connected or running rotrans transactions. */
if( bReadonly==0 && bRotrans==0 ){
+ lsmFsUnmap(pDb->pFS);
dbTruncateFile(pDb);
if( p->pFile && p->bMultiProc ){
lsmEnvShmUnmap(pDb->pEnv, p->pFile, 1);
@@ -568,6 +569,7 @@ void lsmDbDatabaseRelease(lsm_db *pDb){
doDbDisconnect(pDb);
}
+ lsmFsUnmap(pDb->pFS);
lsmMutexEnter(pDb->pEnv, p->pClientMutex);
for(ppDb=&p->pConn; *ppDb!=pDb; ppDb=&((*ppDb)->pNext));
*ppDb = pDb->pNext;
diff --git a/manifest b/manifest
index da2b01d60..0ae649bd1 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Simplify\sthe\sway\sin\swhich\sthe\sdatabase\sfile\sis\struncated\swhen\sthe\slast\nconnection\sdisconnects.\sAlso\signore\sthe\serror\scode\sfrom\sthe\sxTruncate\scall\s-\nas\struncating\sa\sdatabase\sfile\sis\salways\soptional.
-D 2017-07-11T19:55:38.241
+C In\slsm,\sattempt\sto\sunmap\sthe\sdatabase\sfile\sbefore\struncating\sit\swhen\ndisconnecting.\sA\smapped\sfile\smay\snot\sbe\struncated\son\swin32.
+D 2017-07-11T20:36:35.268
F Makefile.in 081e48dfe7f995d57ce1a88ddf4d2917b4349158648a6cd45b42beae30de3a12
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
F Makefile.msc 20850e3e8d4d4791e0531955852d768eb06f24138214870d543abb1a47346fba
@@ -236,14 +236,14 @@ F ext/lsm1/lsm-test/lsmtest_tdb4.c 47e8bb5eba266472d690fb8264f1855ebdba0ae5a0e54
F ext/lsm1/lsm-test/lsmtest_util.c 241622db5a332a09c8e6e7606b617d288a37b557f7d3bce0bb97809f67cc2806
F ext/lsm1/lsm-test/lsmtest_win32.c 0e0a224674c4d3170631c41b026b56c7e1672b151f5261e1b4cc19068641da2d
F ext/lsm1/lsm.h 0f6f64ff071471cb87bf98beb8386566f30ea001
-F ext/lsm1/lsmInt.h bfa516dca9884de255c6adcb0fc07316770a724d4a52ea6fd54af82a416246b8
+F ext/lsm1/lsmInt.h e9e5c5f08e35a104086102b3def94ee69cbc0d39002f6596f5c80a640439628e
F ext/lsm1/lsm_ckpt.c ac6fb4581983291c2e0be6fbb68f12b26f0c08d606835c05417be1323d0fdd03
-F ext/lsm1/lsm_file.c d4aee18aeb97d2e91ce30a4b46fa4c7006bca1d5e9f9bb2b7897e30ba8bdf002
+F ext/lsm1/lsm_file.c e50f0e15427513dca4507110d0107268544bcaebb0ff0599a822da1f8d0da9eb
F ext/lsm1/lsm_log.c a8bf334532109bba05b09a504ee45fc393828b0d034ca61ab45e3940709d9a7c
F ext/lsm1/lsm_main.c 15e73ccdafdd44ddeefc29e332079d88ba8f00c12c797b3c2b63d3171b5afce8
F ext/lsm1/lsm_mem.c 4c51ea9fa285ee6e35301b33491642d071740a0a
F ext/lsm1/lsm_mutex.c 378edf0a2b142b4f7640ee982df06d50b98788ea
-F ext/lsm1/lsm_shared.c 341c3649575b94a6b1520d50acd540a3ff4036049ee73fbec4e33143ad37f990
+F ext/lsm1/lsm_shared.c 5bc37768e558492f60d7196735ddd54843cd239bd66c1af6eb205a6348ca5e46
F ext/lsm1/lsm_sorted.c a04518dfbfff0171fafb152a46e9fe9f45e1edbf3570e4533dd58ddb6567f0c9
F ext/lsm1/lsm_str.c 65e361b488c87b10bf3e5c0070b14ffc602cf84f094880bece77bbf6678bca82
F ext/lsm1/lsm_tree.c 682679d7ef2b8b6f2fe77aeb532c8d29695bca671c220b0abac77069de5fb9fb
@@ -1631,7 +1631,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 55e93f256018757e5e1cb3b10ef48abf5914e7687419eae58b00998a37061261
-R 7c3852771a4c807385128ef5313db6ce
+P b0a49d90fc91acca1306cf6145adc83acd368686768b7eb4a3b27515b3237396
+R 02e2bf78e78459dd3983b787a92c6553
U dan
-Z aa49b66b4f30401e0222268e506f5e2a
+Z 35b0c5fdca1937f85545a9243c607cf9
diff --git a/manifest.uuid b/manifest.uuid
index 542c6c086..6f618d90a 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-b0a49d90fc91acca1306cf6145adc83acd368686768b7eb4a3b27515b3237396 \ No newline at end of file
+39069941e98605bc8c7c736819781761760ee2b83363471ceb6f19e5eb06b13a \ No newline at end of file