diff options
author | Michael Cahill <michael.cahill@mongodb.com> | 2015-08-28 16:02:38 +1000 |
---|---|---|
committer | Michael Cahill <michael.cahill@mongodb.com> | 2015-08-28 16:02:38 +1000 |
commit | a7338c436160e259d0b20058f0a9ae4b442ca102 (patch) | |
tree | bfc887ab328328c72face3d1afc99530a89584ff /src/third_party/wiredtiger/dist | |
parent | f51b43f0fbabe121c18387d8bfbb187a2c6efdee (diff) | |
download | mongo-a7338c436160e259d0b20058f0a9ae4b442ca102.tar.gz |
Import wiredtiger-wiredtiger-2.6.1-633-g0cccab3.tar.gz from wiredtiger branch mongodb-3.2
Diffstat (limited to 'src/third_party/wiredtiger/dist')
-rw-r--r-- | src/third_party/wiredtiger/dist/api_data.py | 12 | ||||
-rw-r--r-- | src/third_party/wiredtiger/dist/flags.py | 4 | ||||
-rwxr-xr-x | src/third_party/wiredtiger/dist/s_all | 2 | ||||
-rw-r--r-- | src/third_party/wiredtiger/dist/s_define.list | 33 | ||||
-rwxr-xr-x | src/third_party/wiredtiger/dist/s_stat | 2 | ||||
-rw-r--r-- | src/third_party/wiredtiger/dist/s_string.ok | 3 | ||||
-rwxr-xr-x | src/third_party/wiredtiger/dist/s_style | 7 | ||||
-rwxr-xr-x | src/third_party/wiredtiger/dist/s_typedef | 2 | ||||
-rwxr-xr-x | src/third_party/wiredtiger/dist/s_whitespace | 23 | ||||
-rw-r--r-- | src/third_party/wiredtiger/dist/stat.py | 128 | ||||
-rw-r--r-- | src/third_party/wiredtiger/dist/stat_data.py | 17 |
11 files changed, 148 insertions, 85 deletions
diff --git a/src/third_party/wiredtiger/dist/api_data.py b/src/third_party/wiredtiger/dist/api_data.py index 43b585a6c6d..d9830191d94 100644 --- a/src/third_party/wiredtiger/dist/api_data.py +++ b/src/third_party/wiredtiger/dist/api_data.py @@ -981,8 +981,10 @@ methods = { connection_runtime_config + common_wiredtiger_open + [ Config('config_base', 'true', r''' - write the base configuration file if creating the database, - see @ref config_base for more information''', + write the base configuration file if creating the database. If + \c false in the config passed directly to ::wiredtiger_open, will + ignore any existing base configuration file in addition to not creating + one. See @ref config_base for more information''', type='boolean'), Config('create', 'false', r''' create the database if it does not exist''', @@ -1011,8 +1013,10 @@ methods = { connection_runtime_config + common_wiredtiger_open + [ Config('config_base', 'true', r''' - write the base configuration file if creating the database, - see @ref config_base for more information''', + write the base configuration file if creating the database. If + \c false in the config passed directly to ::wiredtiger_open, will + ignore any existing base configuration file in addition to not creating + one. See @ref config_base for more information''', type='boolean'), Config('create', 'false', r''' create the database if it does not exist''', diff --git a/src/third_party/wiredtiger/dist/flags.py b/src/third_party/wiredtiger/dist/flags.py index c8d9bcc6a5e..d861eabc7ff 100644 --- a/src/third_party/wiredtiger/dist/flags.py +++ b/src/third_party/wiredtiger/dist/flags.py @@ -12,7 +12,6 @@ flags = { 'SYNC_CHECKPOINT', 'SYNC_CLOSE', 'SYNC_DISCARD', - 'SYNC_DISCARD_FORCE', 'SYNC_WRITE_LEAVES', ], 'file_types' : [ @@ -107,7 +106,6 @@ flags = { 'session' : [ 'SESSION_CAN_WAIT', 'SESSION_CLEAR_EVICT_WALK', - 'SESSION_DISCARD_FORCE', 'SESSION_LOCKED_CHECKPOINT', 'SESSION_LOCKED_HANDLE_LIST', 'SESSION_LOCKED_SCHEMA', @@ -119,7 +117,7 @@ flags = { 'SESSION_NO_DATA_HANDLES', 'SESSION_NO_LOGGING', 'SESSION_NO_SCHEMA_LOCK', - 'SESSION_SALVAGE_CORRUPT_OK', + 'SESSION_QUIET_CORRUPT_FILE', 'SESSION_SERVER_ASYNC', ], } diff --git a/src/third_party/wiredtiger/dist/s_all b/src/third_party/wiredtiger/dist/s_all index c624db06a97..8e3f265e79b 100755 --- a/src/third_party/wiredtiger/dist/s_all +++ b/src/third_party/wiredtiger/dist/s_all @@ -2,7 +2,7 @@ # Run standard scripts. t=__wt.$$ -t_pfx=__s_all_tmp +t_pfx=__s_all_tmp_ trap 'rm -f $t *.pyc __tmp __wt.* __s_all_tmp*' 0 1 2 3 13 15 # We require python which may not be installed. diff --git a/src/third_party/wiredtiger/dist/s_define.list b/src/third_party/wiredtiger/dist/s_define.list index 9e64d81bc93..f3858da477e 100644 --- a/src/third_party/wiredtiger/dist/s_define.list +++ b/src/third_party/wiredtiger/dist/s_define.list @@ -16,22 +16,14 @@ TXN_API_CALL TXN_API_CALL_NOCONF TXN_API_END WIN32_LEAN_AND_MEAN -WT_ATOMIC_ADD1 -WT_ATOMIC_ADD2 -WT_ATOMIC_CAS1 -WT_ATOMIC_CAS2 -WT_ATOMIC_FETCH_ADD1 -WT_ATOMIC_FETCH_ADD4 -WT_ATOMIC_FETCH_ADD8 -WT_ATOMIC_STORE1 -WT_ATOMIC_STORE2 -WT_ATOMIC_SUB1 -WT_ATOMIC_SUB2 +WT_ATOMIC_CAS +WT_ATOMIC_FUNC WT_BARRIER WT_BLOCK_DESC_SIZE WT_CACHE_LINE_ALIGNMENT WT_COMPILER_TYPE_ALIGN WT_CONN_CHECK_PANIC +WT_COUNTER_SLOTS WT_DEADLOCK WT_DEBUG_BYTE WT_HANDLE_CLOSED @@ -41,30 +33,19 @@ WT_PACKED_STRUCT_END WT_READ_BARRIER WT_REF_SIZE WT_SESSION_LOCKED_CHECKPOINT -WT_STAT_ATOMIC_DECR -WT_STAT_ATOMIC_DECRV -WT_STAT_ATOMIC_INCR -WT_STAT_ATOMIC_INCRV +WT_STATS_FIELD_TO_SLOT +WT_STATS_SLOT_ID WT_STAT_DECR WT_STAT_DECRV -WT_STAT_FAST_ATOMIC_DECR -WT_STAT_FAST_ATOMIC_DECRV -WT_STAT_FAST_ATOMIC_INCR -WT_STAT_FAST_ATOMIC_INCRV -WT_STAT_FAST_CONN_ATOMIC_DECRV -WT_STAT_FAST_CONN_ATOMIC_INCRV WT_STAT_FAST_CONN_DECRV WT_STAT_FAST_DATA_DECRV WT_STAT_FAST_DECR WT_STAT_FAST_DECRV +WT_STAT_FAST_INCR WT_STAT_FAST_INCRV WT_STAT_FAST_SET +WT_STAT_WRITE WT_WITH_LOCK __F __WIREDTIGER_EXT_H_ __WIREDTIGER_H_ -__WT_ATOMIC_ADD -__WT_ATOMIC_CAS -__WT_ATOMIC_FETCH_ADD -__WT_ATOMIC_STORE -__WT_ATOMIC_SUB diff --git a/src/third_party/wiredtiger/dist/s_stat b/src/third_party/wiredtiger/dist/s_stat index 152097f14be..44c22ab56bb 100755 --- a/src/third_party/wiredtiger/dist/s_stat +++ b/src/third_party/wiredtiger/dist/s_stat @@ -16,7 +16,7 @@ l="$l `echo ../src/include/*.i`" ( # Get the list of statistics fields. search=`sed \ - -e 's/^ WT_STATS \([a-z_*]*\);$/\1/p' \ + -e 's/^ int64_t \([a-z_*]*\);$/\1/p' \ -e d ../src/include/stat.h | sort` diff --git a/src/third_party/wiredtiger/dist/s_string.ok b/src/third_party/wiredtiger/dist/s_string.ok index a104bb011da..fc706226c0a 100644 --- a/src/third_party/wiredtiger/dist/s_string.ok +++ b/src/third_party/wiredtiger/dist/s_string.ok @@ -395,6 +395,7 @@ bzalloc bzfree bzip calloc +cas catfmt cd centric @@ -493,6 +494,7 @@ desc dest destSize dev +dh dhandle dhandles dir @@ -797,6 +799,7 @@ progname ps psp pthread +ptr pushms putK putV diff --git a/src/third_party/wiredtiger/dist/s_style b/src/third_party/wiredtiger/dist/s_style index 2237b520020..0e013852914 100755 --- a/src/third_party/wiredtiger/dist/s_style +++ b/src/third_party/wiredtiger/dist/s_style @@ -74,6 +74,13 @@ else cat $t } + # Alignment directive before "struct". + egrep 'WT_COMPILER_TYPE_ALIGN.*struct' $f > $t + test -s $t && { + echo "$f: compiler alignment direction must precede \"struct\"" + cat $t + } + # Direct calls to functions we're not supposed to use in the library. # We don't check for all of them, just a few of the common ones. if ! expr "$f" : 'bench/.*' > /dev/null && diff --git a/src/third_party/wiredtiger/dist/s_typedef b/src/third_party/wiredtiger/dist/s_typedef index 2e206757f48..233f432f0e5 100755 --- a/src/third_party/wiredtiger/dist/s_typedef +++ b/src/third_party/wiredtiger/dist/s_typedef @@ -25,7 +25,7 @@ build() { $l | sed -e 's/WT_PACKED_STRUCT_BEGIN(\(.*\))/struct \1 {/' \ -e 's/WT_COMPILER_TYPE_ALIGN(.*)[ ]*//' \ - -e 's/^[ ]*//' -e 's/[ ]*{.*//' | sort | \ + -e 's/^[ ]*//' -e 's/[ ]*{.*//' | sort -u | \ while read t n; do upper=`echo $n | sed -e 's/^__//' | tr [a-z] [A-Z]` echo "$t $n;" diff --git a/src/third_party/wiredtiger/dist/s_whitespace b/src/third_party/wiredtiger/dist/s_whitespace index 3a51b251bfe..dfc031e3ea4 100755 --- a/src/third_party/wiredtiger/dist/s_whitespace +++ b/src/third_party/wiredtiger/dist/s_whitespace @@ -4,7 +4,16 @@ t=__wt.$$ trap 'rm -f $t; exit 0' 0 1 2 3 13 15 -ws() +# Clear lines that only contain whitespace. +whitespace() +{ + sed -e 's/[ ][ ]*$//' < $1 > $t + cmp $t $1 > /dev/null 2>&1 || (echo "$1" && cp $t $1) +} + +# Clear lines that only contain whitespace, compress multiple empty lines +# into a single line, discarding trailing empty lines. +whitespace_and_empty_line() { sed -e 's/[ ][ ]*$//' \ -e '/^$/N' \ @@ -14,10 +23,12 @@ ws() cd .. +# Scripts. for f in `find dist -name '*.py' -name 's_*'`; do - ws $f + whitespace_and_empty_line $f done +# C-language sources. for f in `find examples ext src test \ -name '*.[chi]' -o \ -name '*.dox' -o \ @@ -26,5 +37,11 @@ for f in `find examples ext src test \ if expr "$f" : ".*/Makefile.in" > /dev/null; then continue fi - ws $f + whitespace_and_empty_line $f +done + +# Python sources. +for f in `find test \ + -name '*.py' | sed '/3rdparty/d'`; do + whitespace $f done diff --git a/src/third_party/wiredtiger/dist/stat.py b/src/third_party/wiredtiger/dist/stat.py index 2a87d4425e6..c9684665a53 100644 --- a/src/third_party/wiredtiger/dist/stat.py +++ b/src/third_party/wiredtiger/dist/stat.py @@ -12,12 +12,11 @@ def print_struct(title, name, base, stats): f.write('/*\n') f.write(' * Statistics entries for ' + title + '.\n') f.write(' */\n') - f.write( - '#define\tWT_' + name.upper() + '_STATS_BASE\t' + str(base) + '\n') + f.write('#define\tWT_' + name.upper() + '_STATS_BASE\t' + str(base) + '\n') f.write('struct __wt_' + name + '_stats {\n') for l in stats: - f.write('\tWT_STATS ' + l.name + ';\n') + f.write('\tint64_t ' + l.name + ';\n') f.write('};\n\n') # Update the #defines in the stat.h file. @@ -90,67 +89,113 @@ for line in open('../src/include/wiredtiger.in', 'r'): f.close() compare_srcfile(tmp_file, '../src/include/wiredtiger.in') -def print_func(name, list): - '''Print the functions for the stat.c file.''' +def print_func(name, handle, list): + '''Print the structures/functions for the stat.c file.''' + f.write('\n') + f.write('static const char * const __stats_' + name + '_desc[] = {\n') + for l in list: + f.write('\t"' + l.desc + '",\n') + f.write('};\n') + + f.write(''' +const char * +__wt_stat_''' + name + '''_desc(int slot) +{ +\treturn (__stats_''' + name + '''_desc[slot]); +} +''') + f.write(''' void -__wt_stat_init_''' + name + '''_stats(WT_''' + name.upper() + '''_STATS *stats) +__wt_stat_''' + name + '_init_single(WT_' + name.upper() + '''_STATS *stats) { -\t/* Clear, so can also be called for reinitialization. */ \tmemset(stats, 0, sizeof(*stats)); - -''') - for l in sorted(list): - o = '\tstats->' + l.name + '.desc = "' + l.desc + '";\n' - if len(o) + 7 > 80: - o = o.replace('= ', '=\n\t ') - f.write(o) - f.write('''} +} ''') f.write(''' void -__wt_stat_refresh_''' + name + '''_stats(void *stats_arg) +__wt_stat_''' + name + '_init(' + handle + ''' *handle) { -\tWT_''' + name.upper() + '''_STATS *stats; +\tint i; + +\tfor (i = 0; i < WT_COUNTER_SLOTS; ++i) { +\t\thandle->stats[i] = &handle->stat_array[i]; +\t\t__wt_stat_''' + name + '''_init_single(handle->stats[i]); +\t} +} +''') -\tstats = (WT_''' + name.upper() + '''_STATS *)stats_arg; + f.write(''' +void +__wt_stat_''' + name + '_clear_single(WT_' + name.upper() + '''_STATS *stats) +{ ''') for l in sorted(list): # no_clear: don't clear the value. - if not 'no_clear' in l.flags: - f.write('\tstats->' + l.name + '.v = 0;\n'); + if 'no_clear' in l.flags: + f.write('\t\t/* not clearing ' + l.name + ' */\n') + else: + f.write('\tstats->' + l.name + ' = 0;\n') f.write('}\n') - # Aggregation is only interesting for data-source statistics. - # Complain if any aggregation flags are set. - if name == 'connection': + f.write(''' +void +__wt_stat_''' + name + '_clear_all(WT_' + name.upper() + '''_STATS **stats) +{ +\tu_int i; + +\tfor (i = 0; i < WT_COUNTER_SLOTS; ++i) +\t\t__wt_stat_''' + name + '''_clear_single(stats[i]); +} +''') + + # Single structure aggregation is currently only used by data sources. + if name == 'dsrc': + f.write(''' +void +__wt_stat_''' + name + '''_aggregate_single( + WT_''' + name.upper() + '_STATS *from, WT_' + name.upper() + '''_STATS *to) +{ +''') for l in sorted(list): - if 'no_aggregate' in l.flags or 'max_aggregate' in l.flags: - print >>sys.stdout,\ - "Aggregation configuration for " +\ - name + "." + l.name + " statistics not supported" - return; + if 'no_aggregate' in l.flags: + o = '\tto->' + l.name + ' = from->' + l.name + ';\n' + elif 'max_aggregate' in l.flags: + o = '\tif (from->' + l.name + ' > to->' + l.name + ')\n' +\ + '\t\tto->' + l.name + ' = from->' + l.name + ';\n' + else: + o = '\tto->' + l.name + ' += from->' + l.name + ';\n' + if len(o) > 72: # Account for the leading tab. + o = o.replace(' += ', ' +=\n\t ') + f.write(o) + f.write('}\n') f.write(''' void -__wt_stat_aggregate_''' + name + -'''_stats(const void *child, const void *parent) +__wt_stat_''' + name + '''_aggregate( + WT_''' + name.upper() + '_STATS **from, WT_' + name.upper() + '''_STATS *to) { -\tWT_''' + name.upper() + '''_STATS *c, *p; - -\tc = (WT_''' + name.upper() + '''_STATS *)child; -\tp = (WT_''' + name.upper() + '''_STATS *)parent; ''') + # Connection level aggregation does not currently have any computation + # of a maximum value; I'm leaving in support for it, but don't declare + # a temporary variable until it's needed. + for l in sorted(list): + if 'max_aggregate' in l.flags: + f.write('\tint64_t v;\n\n') + break; for l in sorted(list): if 'no_aggregate' in l.flags: - continue; + o = '\tto->' + l.name + ' = from[0]->' + l.name + ';\n' elif 'max_aggregate' in l.flags: - o = 'if (c->' + l.name + '.v > p->' + l.name +\ - '.v)\n\t p->' + l.name + '.v = c->' + l.name + '.v;' + o = '\tif ((v = WT_STAT_READ(from, ' + l.name + ')) >\n' +\ + '\t to->' + l.name + ')\n' +\ + '\t\tto->' + l.name + ' = v;\n' else: - o = 'p->' + l.name + '.v += c->' + l.name + '.v;' - f.write('\t' + o + '\n') + o = '\tto->' + l.name + ' += WT_STAT_READ(from, ' + l.name + ');\n' + if len(o) > 72: # Account for the leading tab. + o = o.replace(' += ', ' +=\n\t ') + f.write(o) f.write('}\n') # Write the stat initialization and refresh routines to the stat.c file. @@ -158,12 +203,11 @@ f = open(tmp_file, 'w') f.write('/* DO NOT EDIT: automatically built by dist/stat.py. */\n\n') f.write('#include "wt_internal.h"\n') -print_func('dsrc', dsrc_stats) -print_func('connection', connection_stats) +print_func('dsrc', 'WT_DATA_HANDLE', dsrc_stats) +print_func('connection', 'WT_CONNECTION_IMPL', connection_stats) f.close() compare_srcfile(tmp_file, '../src/support/stat.c') - # Update the statlog file with the entries we can scale per second. scale_info = 'no_scale_per_second_list = [\n' clear_info = 'no_clear_list = [\n' diff --git a/src/third_party/wiredtiger/dist/stat_data.py b/src/third_party/wiredtiger/dist/stat_data.py index 51152fcc6af..70e1d32843c 100644 --- a/src/third_party/wiredtiger/dist/stat_data.py +++ b/src/third_party/wiredtiger/dist/stat_data.py @@ -7,14 +7,21 @@ # currently open'. # NOTE: All statistics descriptions must have a prefix string followed by ':'. # -# Optional configuration flags: -# no_clear Value not cleared when statistics cleared -# no_scale Don't scale value per second in the logging tool script -# # Data-source statistics are normally aggregated across the set of underlying # objects. Additional optionaly configuration flags are available: # no_aggregate Ignore the value when aggregating statistics # max_aggregate Take the maximum value when aggregating statistics +# +# Optional configuration flags: +# no_clear Value not cleared when statistics cleared +# no_scale Don't scale value per second in the logging tool script +# +# The no_clear flag is a little complicated: it means we don't clear the values +# when resetting statistics after each run (necessary when the WiredTiger engine +# is updating values that persist over multiple runs, for example the count of +# cursors), but it also causes the underlying display routines to not treat the +# change between displays as relative to the number of seconds, that is, it's an +# absolute value. The no_clear flag should be set in either case. from operator import attrgetter import sys @@ -326,6 +333,7 @@ connection_stats = [ CursorStat('cursor_prev', 'cursor prev calls'), CursorStat('cursor_remove', 'cursor remove calls'), CursorStat('cursor_reset', 'cursor reset calls'), + CursorStat('cursor_restart', 'cursor restarted searches'), CursorStat('cursor_search', 'cursor search calls'), CursorStat('cursor_search_near', 'cursor search near calls'), CursorStat('cursor_update', 'cursor update calls'), @@ -366,6 +374,7 @@ dsrc_stats = [ CursorStat('cursor_remove', 'remove calls'), CursorStat('cursor_remove_bytes', 'cursor-remove key bytes removed'), CursorStat('cursor_reset', 'reset calls'), + CursorStat('cursor_restart', 'restarted searches'), CursorStat('cursor_search', 'search calls'), CursorStat('cursor_search_near', 'search near calls'), CursorStat('cursor_update', 'update calls'), |