diff options
author | Luke Chen <luke.chen@mongodb.com> | 2019-04-01 14:44:54 +1100 |
---|---|---|
committer | Luke Chen <luke.chen@mongodb.com> | 2019-04-01 14:44:54 +1100 |
commit | d1beb371c96a7ad961eb8bb6e81d8c4fc0617f17 (patch) | |
tree | aead1c88928db8282ed83b39ece5b37d034d7a13 | |
parent | 78a00318d39bc35c2091775e74bf0dde780d950f (diff) | |
download | mongo-d1beb371c96a7ad961eb8bb6e81d8c4fc0617f17.tar.gz |
Import wiredtiger: bb8086c4ed645854f19554198f391ea8c821f603 from branch mongodb-4.2
ref: 67066a329d..bb8086c4ed
for: 4.1.10
WT-4614 Trigger sweep immediately to reclaim space after a table drop
WT-4631 Always clear the read timestamp for transactions
WT-4636 Fix strace in syscall test
WT-4650 Coverity complaint: Constant expression result (CONSTANT_EXPRESSION_RESULT)
WT-4668 lint
-rw-r--r-- | src/third_party/wiredtiger/dist/s_define.list | 1 | ||||
-rw-r--r-- | src/third_party/wiredtiger/dist/s_string.ok | 3 | ||||
-rw-r--r-- | src/third_party/wiredtiger/import.data | 2 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/btree/bt_vrfy_dsk.c | 2 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/cache/cache_las.c | 16 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/conn/conn_sweep.c | 12 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/include/wt_internal.h | 10 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/meta/meta_track.c | 18 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/txn/txn_timestamp.c | 86 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/suite/test_timestamp16.py | 73 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/syscall/syscall.py | 2 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/syscall/wt2336_base/base.run | 38 |
12 files changed, 199 insertions, 64 deletions
diff --git a/src/third_party/wiredtiger/dist/s_define.list b/src/third_party/wiredtiger/dist/s_define.list index f199900e860..d585c1e268d 100644 --- a/src/third_party/wiredtiger/dist/s_define.list +++ b/src/third_party/wiredtiger/dist/s_define.list @@ -72,6 +72,7 @@ WT_TRACK_OP_END WT_TRACK_OP_INIT WT_TRET_ERROR_OK WT_UPDATE_SIZE +WT_USE_OPENAT WT_WITH_LOCK_NOWAIT WT_WITH_LOCK_WAIT __F diff --git a/src/third_party/wiredtiger/dist/s_string.ok b/src/third_party/wiredtiger/dist/s_string.ok index c2e70ba2646..bc265efb34f 100644 --- a/src/third_party/wiredtiger/dist/s_string.ok +++ b/src/third_party/wiredtiger/dist/s_string.ok @@ -156,6 +156,7 @@ Fsync Fuerst GCC GIDs +GLIBC Gcc Geoff GetEnvironmentVariableA @@ -1052,6 +1053,7 @@ online onpage oo opcode +openat opendir openfile oplist @@ -1214,6 +1216,7 @@ stdin stdout stepp str +strace strcmp strdup strerror diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data index c9b3aed9f2d..340e9ea128f 100644 --- a/src/third_party/wiredtiger/import.data +++ b/src/third_party/wiredtiger/import.data @@ -1,5 +1,5 @@ { - "commit": "67066a329d365cb1de6e198184016d4a9d280679", + "commit": "bb8086c4ed645854f19554198f391ea8c821f603", "github": "wiredtiger/wiredtiger.git", "vendor": "wiredtiger", "branch": "mongodb-4.2" diff --git a/src/third_party/wiredtiger/src/btree/bt_vrfy_dsk.c b/src/third_party/wiredtiger/src/btree/bt_vrfy_dsk.c index 844da3f041b..ee6cd904aec 100644 --- a/src/third_party/wiredtiger/src/btree/bt_vrfy_dsk.c +++ b/src/third_party/wiredtiger/src/btree/bt_vrfy_dsk.c @@ -43,7 +43,7 @@ static int __verify_dsk_row( } while (0) #define WT_RET_VRFY(session, ...) \ - WT_RET_VRFY_RETVAL(session, 0, __VA_ARGS__); + WT_RET_VRFY_RETVAL(session, 0, __VA_ARGS__) /* * WT_CELL_FOREACH_VRFY -- diff --git a/src/third_party/wiredtiger/src/cache/cache_las.c b/src/third_party/wiredtiger/src/cache/cache_las.c index d7175c32275..905c24dceae 100644 --- a/src/third_party/wiredtiger/src/cache/cache_las.c +++ b/src/third_party/wiredtiger/src/cache/cache_las.c @@ -1142,15 +1142,17 @@ __wt_las_sweep(WT_SESSION_IMPL *session) session, saved_key, las_key.data, las_key.size)); /* - * Never expect an entry with prepare locked state or - * with durable timestamp as max timestamp or with - * in-progress prepare state and non-zero durable - * timestamp. In all other cases the durable timestamp - * is higher or same as the las timestamp. + * Expect an update entry with: + * 1. not in a prepare locked state + * 2. durable timestamp as not max timestamp. + * 3. for an in-progress prepared update, durable + * timestamp should be zero. + * 4. no restriction on durable timestamp value + * for other updates. */ WT_ASSERT(session, - prepare_state != WT_PREPARE_LOCKED || - durable_timestamp != WT_TS_MAX || + prepare_state != WT_PREPARE_LOCKED && + durable_timestamp != WT_TS_MAX && (prepare_state != WT_PREPARE_INPROGRESS || durable_timestamp == 0)); diff --git a/src/third_party/wiredtiger/src/conn/conn_sweep.c b/src/third_party/wiredtiger/src/conn/conn_sweep.c index d07d32c41c9..7b755c28854 100644 --- a/src/third_party/wiredtiger/src/conn/conn_sweep.c +++ b/src/third_party/wiredtiger/src/conn/conn_sweep.c @@ -279,6 +279,7 @@ __sweep_server(void *arg) uint64_t last, now; uint64_t last_las_sweep_id, min_sleep, oldest_id, sweep_interval; u_int dead_handles; + bool cv_signalled; session = arg; conn = S2C(session); @@ -298,12 +299,13 @@ __sweep_server(void *arg) /* Wait until the next event. */ if (FLD_ISSET(conn->timing_stress_flags, WT_TIMING_STRESS_AGGRESSIVE_SWEEP)) - __wt_cond_wait(session, conn->sweep_cond, + __wt_cond_wait_signal(session, conn->sweep_cond, min_sleep * 100 * WT_THOUSAND, - __sweep_server_run_chk); + __sweep_server_run_chk, &cv_signalled); else - __wt_cond_wait(session, conn->sweep_cond, - min_sleep * WT_MILLION, __sweep_server_run_chk); + __wt_cond_wait_signal(session, + conn->sweep_cond, min_sleep * WT_MILLION, + __sweep_server_run_chk, &cv_signalled); /* Check if we're quitting or being reconfigured. */ if (!__sweep_server_run_chk(session)) @@ -339,7 +341,7 @@ __sweep_server(void *arg) * less frequently than the lookaside table by default and the * frequency is controlled by a user setting. */ - if (now - last < sweep_interval) + if (!cv_signalled && (now - last < sweep_interval)) continue; WT_STAT_CONN_INCR(session, dh_sweeps); /* diff --git a/src/third_party/wiredtiger/src/include/wt_internal.h b/src/third_party/wiredtiger/src/include/wt_internal.h index 87437cd9ed3..4d03a40b860 100644 --- a/src/third_party/wiredtiger/src/include/wt_internal.h +++ b/src/third_party/wiredtiger/src/include/wt_internal.h @@ -337,6 +337,16 @@ typedef uint64_t wt_timestamp_t; #elif defined(_MSC_VER) #include "msvc.h" #endif +/* + * GLIBC 2.26 and later use the openat syscall to implement open. + * Set this flag so that our strace tests know to expect this. + */ +#ifdef __GLIBC_PREREQ +#if __GLIBC_PREREQ(2, 26) +#define WT_USE_OPENAT 1 +#endif +#endif + #include "hardware.h" #include "swap.h" diff --git a/src/third_party/wiredtiger/src/meta/meta_track.c b/src/third_party/wiredtiger/src/meta/meta_track.c index 8012eafe650..f411b9675eb 100644 --- a/src/third_party/wiredtiger/src/meta/meta_track.c +++ b/src/third_party/wiredtiger/src/meta/meta_track.c @@ -249,6 +249,7 @@ __wt_meta_track_off(WT_SESSION_IMPL *session, bool need_sync, bool unroll) WT_META_TRACK *trk, *trk_orig; WT_SESSION_IMPL *ckpt_session; int saved_ret; + bool did_drop; saved_ret = 0; @@ -323,14 +324,20 @@ err: /* * Undo any tracked operations on failure. * Apply any tracked operations post-commit. */ + did_drop = false; if (unroll || ret != 0) { saved_ret = ret; ret = 0; - while (--trk >= trk_orig) + while (--trk >= trk_orig) { + did_drop = did_drop || trk->op == WT_ST_DROP_COMMIT; WT_TRET(__meta_track_unroll(session, trk)); + } } else - for (; trk_orig < trk; trk_orig++) + for (; trk_orig < trk; trk_orig++) { + did_drop = did_drop || + trk_orig->op == WT_ST_DROP_COMMIT; WT_TRET(__meta_track_apply(session, trk_orig)); + } if (F_ISSET(session, WT_SESSION_SCHEMA_TXN)) { F_CLR(session, WT_SESSION_SCHEMA_TXN); @@ -346,6 +353,13 @@ err: /* #endif } + /* + * Wake up the sweep thread: particularly for the in-memory + * storage engine, we want to reclaim space immediately. + */ + if (did_drop && S2C(session)->sweep_cond != NULL) + __wt_cond_signal(session, S2C(session)->sweep_cond); + if (ret != 0) WT_PANIC_RET(session, ret, "failed to apply or unroll all tracked operations"); diff --git a/src/third_party/wiredtiger/src/txn/txn_timestamp.c b/src/third_party/wiredtiger/src/txn/txn_timestamp.c index 594be12e6b1..f4e340535ef 100644 --- a/src/third_party/wiredtiger/src/txn/txn_timestamp.c +++ b/src/third_party/wiredtiger/src/txn/txn_timestamp.c @@ -150,6 +150,20 @@ __wt_txn_parse_timestamp(WT_SESSION_IMPL *session, const char *name, } /* + * __txn_get_read_timestamp -- + * Get the read timestamp from the transaction. Additionally + * return bool to specify whether the transaction has set + * clear read queue flag. + */ +static bool +__txn_get_read_timestamp( + WT_TXN *txn, wt_timestamp_t *read_timestampp) +{ + WT_ORDERED_READ(*read_timestampp, txn->read_timestamp); + return (!txn->clear_read_q); +} + +/* * __txn_get_pinned_timestamp -- * Calculate the current pinned timestamp. */ @@ -160,7 +174,7 @@ __txn_get_pinned_timestamp( WT_CONNECTION_IMPL *conn; WT_TXN *txn; WT_TXN_GLOBAL *txn_global; - wt_timestamp_t tmp_ts; + wt_timestamp_t tmp_read_ts, tmp_ts; bool include_oldest, txn_has_write_lock; conn = S2C(session); @@ -189,15 +203,18 @@ __txn_get_pinned_timestamp( TAILQ_FOREACH(txn, &txn_global->read_timestamph, read_timestampq) { /* * Skip any transactions on the queue that are not active. + * Copy out value of read timestamp to prevent possible + * race where a transaction resets its read timestamp while + * we traverse the queue. */ - if (txn->clear_read_q) + if (!__txn_get_read_timestamp(txn, &tmp_read_ts)) continue; /* * A zero timestamp is possible here only when the oldest * timestamp is not accounted for. */ - if (tmp_ts == 0 || txn->read_timestamp < tmp_ts) - tmp_ts = txn->read_timestamp; + if (tmp_ts == 0 || tmp_read_ts < tmp_ts) + tmp_ts = tmp_read_ts; /* * We break on the first active txn on the list. */ @@ -638,22 +655,18 @@ __wt_txn_commit_timestamp_validate(WT_SESSION_IMPL *session, const char *name, * Compare against the prepare timestamp of the current transaction. * Return an error if the given timestamp is older than the prepare * timestamp. + * + * If roundup timestamps is configured, the commit timestamp will be + * rounded up to the prepare timestamp. */ - if (F_ISSET(txn, WT_TXN_PREPARE) && ts < txn->prepare_timestamp) { - /* - * If roundup timestamps is configured, the commit timestamp - * will be rounded up to the prepare timestamp. - */ - if (F_ISSET(txn, WT_TXN_TS_ROUND_PREPARED)) - ts = txn->prepare_timestamp; - else { - __wt_timestamp_to_string( - txn->prepare_timestamp, ts_string[0]); - WT_RET_MSG(session, EINVAL, - "%s timestamp %.*s older than the prepare " - "timestamp %s for this transaction", - name, (int)cval->len, cval->str, ts_string[0]); - } + if (F_ISSET(txn, WT_TXN_PREPARE) && + !F_ISSET(txn, WT_TXN_TS_ROUND_PREPARED) && + ts < txn->prepare_timestamp) { + __wt_timestamp_to_string(txn->prepare_timestamp, ts_string[0]); + WT_RET_MSG(session, EINVAL, + "%s timestamp %.*s older than the prepare " + "timestamp %s for this transaction", + name, (int)cval->len, cval->str, ts_string[0]); } if (F_ISSET(txn, WT_TXN_HAS_TS_DURABLE) && @@ -754,7 +767,7 @@ __wt_txn_parse_prepare_timestamp( WT_CONFIG_ITEM cval; WT_TXN *prev, *txn; WT_TXN_GLOBAL *txn_global; - wt_timestamp_t oldest_ts, timestamp; + wt_timestamp_t oldest_ts, timestamp, tmp_timestamp; char ts_string[2][WT_TS_INT_STRING_SIZE]; txn = &session->txn; @@ -779,18 +792,23 @@ __wt_txn_parse_prepare_timestamp( prev = TAILQ_LAST( &txn_global->read_timestamph, __wt_txn_rts_qh); while (prev != NULL) { - /* Skip self and non-active transactions. */ - if (prev->clear_read_q || prev == txn) { + /* + * Skip self and non-active transactions. Copy out value of + * read timestamp to prevent possible race where a transaction + * resets its read timestamp while we traverse the queue. + */ + if (!__txn_get_read_timestamp(prev, &tmp_timestamp) || + prev == txn) { prev = TAILQ_PREV( prev, __wt_txn_rts_qh, read_timestampq); continue; } - if (prev->read_timestamp >= timestamp) { + if (tmp_timestamp >= timestamp) { __wt_readunlock(session, &txn_global->read_timestamp_rwlock); __wt_timestamp_to_string( - prev->read_timestamp, ts_string[0]); + tmp_timestamp, ts_string[0]); WT_RET_MSG(session, EINVAL, "prepare timestamp %.*s must be greater than the " "latest active read timestamp %s ", @@ -1076,6 +1094,7 @@ __wt_txn_set_read_timestamp(WT_SESSION_IMPL *session) { WT_TXN *qtxn, *txn, *txn_tmp; WT_TXN_GLOBAL *txn_global; + wt_timestamp_t tmp_timestamp; uint64_t walked; txn = &session->txn; @@ -1127,11 +1146,14 @@ __wt_txn_set_read_timestamp(WT_SESSION_IMPL *session) */ qtxn = TAILQ_LAST( &txn_global->read_timestamph, __wt_txn_rts_qh); - while (qtxn != NULL && - qtxn->read_timestamp > txn->read_timestamp) { - ++walked; - qtxn = TAILQ_PREV( - qtxn, __wt_txn_rts_qh, read_timestampq); + while (qtxn != NULL) { + if (!__txn_get_read_timestamp(qtxn, &tmp_timestamp) || + tmp_timestamp > txn->read_timestamp) { + ++walked; + qtxn = TAILQ_PREV(qtxn, + __wt_txn_rts_qh, read_timestampq); + } else + break; } if (qtxn == NULL) { TAILQ_INSERT_HEAD(&txn_global->read_timestamph, @@ -1165,9 +1187,10 @@ __wt_txn_clear_read_timestamp(WT_SESSION_IMPL *session) txn = &session->txn; - if (!F_ISSET(txn, WT_TXN_PUBLIC_TS_READ)) + if (!F_ISSET(txn, WT_TXN_PUBLIC_TS_READ)) { + txn->read_timestamp = WT_TS_NONE; return; - + } #ifdef HAVE_DIAGNOSTIC { WT_TXN_GLOBAL *txn_global; @@ -1188,6 +1211,7 @@ __wt_txn_clear_read_timestamp(WT_SESSION_IMPL *session) */ WT_PUBLISH(txn->clear_read_q, true); WT_PUBLISH(txn->flags, flags); + txn->read_timestamp = WT_TS_NONE; } /* diff --git a/src/third_party/wiredtiger/test/suite/test_timestamp16.py b/src/third_party/wiredtiger/test/suite/test_timestamp16.py new file mode 100644 index 00000000000..259503b7d26 --- /dev/null +++ b/src/third_party/wiredtiger/test/suite/test_timestamp16.py @@ -0,0 +1,73 @@ +#!/usr/bin/env python +# +# Public Domain 2014-2019 MongoDB, Inc. +# Public Domain 2008-2014 WiredTiger, Inc. +# +# This is free and unencumbered software released into the public domain. +# +# Anyone is free to copy, modify, publish, use, compile, sell, or +# distribute this software, either in source code form or as a compiled +# binary, for any purpose, commercial or non-commercial, and by any +# means. +# +# In jurisdictions that recognize copyright laws, the author or authors +# of this software dedicate any and all copyright interest in the +# software to the public domain. We make this dedication for the benefit +# of the public at large and to the detriment of our heirs and +# successors. We intend this dedication to be an overt act of +# relinquishment in perpetuity of all present and future rights to this +# software under copyright law. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. +# +# test_timestamp16.py +# Test to ensure read timestamp is properly cleared at the +# end of a txn. +# + +import random +from suite_subprocess import suite_subprocess +import wiredtiger, wttest +from wtscenario import make_scenarios + +def timestamp_str(t): + return '%x' % t + +class test_timestamp16(wttest.WiredTigerTestCase, suite_subprocess): + tablename = 'test_timestamp16' + uri = 'table:' + tablename + + def test_read_timestamp_cleared(self): + # Ensure that the read timestamp doesn't move our checkpoint. + self.session.create(self.uri, 'key_format=i,value_format=i') + self.session.begin_transaction('read_timestamp=100') + self.session.rollback_transaction() + self.session.checkpoint('use_timestamp=true') + self.assertTimestampsEqual('0', + self.conn.query_timestamp('get=last_checkpoint')) + + # Set a stable and make sure that we still checkpoint at + # the stable. + self.conn.set_timestamp('stable_timestamp=1') + self.session.begin_transaction('read_timestamp=100') + self.session.rollback_transaction() + self.session.checkpoint('use_timestamp=true') + self.assertTimestampsEqual('1', + self.conn.query_timestamp('get=last_checkpoint')) + + # Finally make sure that commit also resets the read timestamp. + self.session.create(self.uri, 'key_format=i,value_format=i') + self.session.begin_transaction('read_timestamp=150') + self.session.commit_transaction() + self.session.checkpoint('use_timestamp=true') + self.assertTimestampsEqual('1', + self.conn.query_timestamp('get=last_checkpoint')) + +if __name__ == '__main__': + wttest.run()
\ No newline at end of file diff --git a/src/third_party/wiredtiger/test/syscall/syscall.py b/src/third_party/wiredtiger/test/syscall/syscall.py index 6d5f4bc4c10..0fafc56fe45 100644 --- a/src/third_party/wiredtiger/test/syscall/syscall.py +++ b/src/third_party/wiredtiger/test/syscall/syscall.py @@ -156,7 +156,7 @@ defines_used = [ 'HAVE_FTRUNCATE', 'O_ACCMODE', 'O_APPEND', 'O_ASYNC', 'O_CLOEXEC', 'O_CREAT', 'O_EXCL', 'O_EXLOCK', 'O_NOATIME', 'O_NOFOLLOW', 'O_NONBLOCK', 'O_RDONLY', 'O_RDWR', 'O_SHLOCK', - 'O_TRUNC', 'O_WRONLY' ] + 'O_TRUNC', 'O_WRONLY', 'WT_USE_OPENAT' ] ################################################################ diff --git a/src/third_party/wiredtiger/test/syscall/wt2336_base/base.run b/src/third_party/wiredtiger/test/syscall/wt2336_base/base.run index 0dc46548c5b..b51e24a2c06 100644 --- a/src/third_party/wiredtiger/test/syscall/wt2336_base/base.run +++ b/src/third_party/wiredtiger/test/syscall/wt2336_base/base.run @@ -32,11 +32,11 @@ */ #ifdef __linux__ SYSTEM("Linux"); -#define OPEN_EXISTING(name, flags) open(name, flags) +#define OPEN_EXISTING(name, flags) OPEN(name, flags) #else /* __linux__ */ SYSTEM("Darwin"); #define O_NOATIME 0 -#define OPEN_EXISTING(name, flags) open(name, flags, 0) +#define OPEN_EXISTING(name, flags) OPEN(name, flags, 0) #endif /* __linux__ */ #ifdef HAVE_FTRUNCATE @@ -49,14 +49,20 @@ SYSTEM("Darwin"); #define FTRUNCATE(fd, len) /* do nothing */ #endif -TRACE("close,fdatasync,fsync,ftruncate,open,pwrite64,rename"); +#ifdef WT_USE_OPENAT +#define OPEN(...) openat(AT_FDCWD, __VA_ARGS__) +#else +#define OPEN(...) open(__VA_ARGS__) +#endif + +TRACE("close,fdatasync,fsync,ftruncate,open,openat,pwrite64,rename"); RUN(""); ... OUTPUT("--------------wiredtiger_open"); // lock == 3 -lock = open("./WiredTiger.lock", O_RDWR|O_CREAT|O_CLOEXEC, 0666); +lock = OPEN("./WiredTiger.lock", O_RDWR|O_CREAT|O_CLOEXEC, 0666); pwrite64(lock, "WiredTiger lock file\n", 0x15, 0x0); -fd = open("./WiredTiger", O_RDWR|O_CREAT|O_CLOEXEC, 0666); +fd = OPEN("./WiredTiger", O_RDWR|O_CREAT|O_CLOEXEC, 0666); pwrite64(fd, "WiredTiger\nWiredTiger"..., ...); #ifdef __linux__ fdatasync(fd); @@ -65,7 +71,7 @@ close(fd); ... // On Linux, there are calls to open and read "/proc/meminfo" here. -fd = open("./WiredTiger.basecfg.set", O_RDWR|O_CREAT|O_EXCL|O_CLOEXEC, 0666); +fd = OPEN("./WiredTiger.basecfg.set", O_RDWR|O_CREAT|O_EXCL|O_CLOEXEC, 0666); pwrite64(fd, "# Do not modify this file."..., ...); #ifdef __linux__ fdatasync(fd); @@ -74,15 +80,15 @@ close(fd); rename("./WiredTiger.basecfg.set", "./WiredTiger.basecfg"); #ifdef __linux__ -dir = open("./", O_RDONLY); +dir = OPEN("./", O_RDONLY|O_CLOEXEC); fdatasync(dir); close(dir); #endif -fd = open("./WiredTiger.wt", O_RDWR|O_CREAT|O_EXCL|O_NOATIME|O_CLOEXEC, 0666); +fd = OPEN("./WiredTiger.wt", O_RDWR|O_CREAT|O_EXCL|O_NOATIME|O_CLOEXEC, 0666); #ifdef __linux__ -dir = open("./", O_RDONLY); +dir = OPEN("./", O_RDONLY|O_CLOEXEC); fdatasync(dir); close(dir); #endif /* __linux__ */ @@ -96,7 +102,7 @@ close(fd); wt = OPEN_EXISTING("./WiredTiger.wt\0", O_RDWR|O_NOATIME|O_CLOEXEC); FTRUNCATE(wt, 0x1000); -fd = open("./WiredTiger.turtle.set\0", O_RDWR|O_CREAT|O_EXCL|O_CLOEXEC, 0666); +fd = OPEN("./WiredTiger.turtle.set\0", O_RDWR|O_CREAT|O_EXCL|O_CLOEXEC, 0666); pwrite64(fd, "WiredTiger version string\nWiredTiger"..., ...); #ifdef __linux__ fdatasync(fd); @@ -106,10 +112,10 @@ rename("./WiredTiger.turtle.set", "./WiredTiger.turtle"); ... // There is a second open of turtle here, is it important? -fd = open("./WiredTigerLAS.wt", O_RDWR|O_CREAT|O_EXCL|O_NOATIME|O_CLOEXEC, 0666); +fd = OPEN("./WiredTigerLAS.wt", O_RDWR|O_CREAT|O_EXCL|O_NOATIME|O_CLOEXEC, 0666); #ifdef __linux__ -dir = open("./", O_RDONLY); +dir = OPEN("./", O_RDONLY|O_CLOEXEC); fdatasync(dir); close(dir); #endif /* __linux__ */ @@ -134,7 +140,7 @@ fdatasync(wt); fd = OPEN_EXISTING("./WiredTiger.turtle", O_RDWR|O_CLOEXEC); close(fd); -fd = open("./WiredTiger.turtle.set", O_RDWR|O_CREAT|O_EXCL|O_CLOEXEC, 0666); +fd = OPEN("./WiredTiger.turtle.set", O_RDWR|O_CREAT|O_EXCL|O_CLOEXEC, 0666); pwrite64(fd, "WiredTiger version string\nWiredTiger"..., ...); #ifdef __linux__ fdatasync(fd); @@ -142,7 +148,7 @@ fdatasync(fd); close(fd); rename("./WiredTiger.turtle.set", "./WiredTiger.turtle"); #ifdef __linux__ -dir = open("./", O_RDONLY); +dir = OPEN("./", O_RDONLY|O_CLOEXEC); fdatasync(dir); close(dir); fdatasync(wt); @@ -151,9 +157,9 @@ fdatasync(wt); OUTPUT("--------------open_session"); OUTPUT("--------------create"); -hello = open("./hello.wt", O_RDWR|O_CREAT|O_EXCL|O_NOATIME|O_CLOEXEC, 0666); +hello = OPEN("./hello.wt", O_RDWR|O_CREAT|O_EXCL|O_NOATIME|O_CLOEXEC, 0666); #ifdef __linux__ -dir = open("./", O_RDONLY); +dir = OPEN("./", O_RDONLY|O_CLOEXEC); fdatasync(dir); close(dir); #endif /* __linux__ */ |