diff options
| author | Lucas de Castro Borges <lucas@gnuabordo.com.br> | 2025-02-14 14:26:38 -0300 |
|---|---|---|
| committer | Lucas de Castro Borges <lucas@gnuabordo.com.br> | 2025-02-14 14:26:38 -0300 |
| commit | 294bc6ecabf14c09c9bc8644704921dcf97cb44e (patch) | |
| tree | 279b1e0bab53901a1647ac63c1c724f0f789a663 /src/third_party/wiredtiger/test/suite/test_bug030.py | |
| parent | 70be7c27a251621187a1de533462ae2bb1e3bd39 (diff) | |
| parent | 1e917fd798aa25b7066d4b414b51184f13d5a092 (diff) | |
Update upstream source from tag 'upstream/6.0.10'debian/6.0.10-1
Update to upstream version '6.0.10'
with Debian dir 2d176fa254eee97b139f712fec5709641335a8c3
Diffstat (limited to 'src/third_party/wiredtiger/test/suite/test_bug030.py')
| -rw-r--r-- | src/third_party/wiredtiger/test/suite/test_bug030.py | 125 |
1 files changed, 125 insertions, 0 deletions
diff --git a/src/third_party/wiredtiger/test/suite/test_bug030.py b/src/third_party/wiredtiger/test/suite/test_bug030.py new file mode 100644 index 00000000000..3969d71de9d --- /dev/null +++ b/src/third_party/wiredtiger/test/suite/test_bug030.py @@ -0,0 +1,125 @@ +#!/usr/bin/env python +# +# Public Domain 2014-present 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. +import wttest +from helper import simulate_crash_restart +from wiredtiger import stat +from wtdataset import SimpleDataSet +from wtscenario import make_scenarios + +# test_bug030.py +# This tests for the scenario in WT-10522 where we could return early when +# appending a key's original value to its update list due to checking some +# flags that must be ignored when looking at an aborted tombstone. +class test_bug_030(wttest.WiredTigerTestCase): + format_values = [ + ('column', dict(key_format='r', value_format='S')), + ('column_fix', dict(key_format='r', value_format='8t')), + ('row_integer', dict(key_format='i', value_format='S')), + ] + + scenarios = make_scenarios(format_values) + + def conn_config(self): + config = 'debug_mode=(update_restore_evict=true)' + return config + + def test_bug030(self): + nrows = 10 + uri = "table:test_bug030" + + if self.value_format == '8t': + valuea = 97 + valueb = 98 + else: + valuea = "abcdef" * 3 + valueb = "ghijkl" * 3 + + self.session.create(uri, 'key_format={},value_format={}'.format( + self.key_format, self.value_format)) + + # Stable insert + self.session.begin_transaction() + cursor = self.session.open_cursor(uri) + for i in range(1, nrows + 1): + cursor[i] = valuea + cursor.close() + self.session.commit_transaction('commit_timestamp=' + self.timestamp_str(10)) + + self.conn.set_timestamp('oldest_timestamp={},stable_timestamp={}'.format( + self.timestamp_str(10), self.timestamp_str(20))) + + # Unstable delete + self.session.begin_transaction() + cursor = self.session.open_cursor(uri) + for i in range(1, nrows + 1): + cursor.set_key(i) + cursor.remove() + cursor.close() + self.session.commit_transaction('commit_timestamp=' + self.timestamp_str(30)) + + # Evict everything + self.session.begin_transaction() + evict_cursor = self.session.open_cursor(uri, None, 'debug=(release_evict)') + for i in range(1, nrows + 1): + evict_cursor.set_key(i) + evict_cursor.search() + evict_cursor.reset() + evict_cursor.close() + self.session.commit_transaction('commit_timestamp=' + self.timestamp_str(40)) + + # Unstable, uncommitted update + self.session.begin_transaction() + cursor = self.session.open_cursor(uri) + for i in range(1, nrows + 1): + cursor[i] = valueb + cursor.close() + self.session.commit_transaction('commit_timestamp=' + self.timestamp_str(50)) + + self.session.checkpoint() + self.conn.rollback_to_stable() + + # Another delete, committed this time + self.session.begin_transaction() + cursor = self.session.open_cursor(uri) + for i in range(1, nrows + 1): + cursor.set_key(i) + cursor.remove() + cursor.close() + self.session.commit_transaction('commit_timestamp=' + self.timestamp_str(60)) + + # Finally, evict everything. At this point, our key(s) have an + # update chain with a single entry that's both aborted and restored + # from the data store, that we attempt to reconcile. + self.session.begin_transaction() + evict_cursor = self.session.open_cursor(uri, None, 'debug=(release_evict)') + for i in range(1, nrows + 1): + evict_cursor.set_key(i) + evict_cursor.search() + evict_cursor.reset() + evict_cursor.close() + self.session.commit_transaction('commit_timestamp=' + self.timestamp_str(70)) |
