Skip to content

Commit 1d7055b

Browse files
lukechEvergreen Agent
authored andcommitted
Import wiredtiger: 39757ea990f11e884aecbe5fe86648389f26feb6 from branch mongodb-master
ref: 8288276864..39757ea990 for: 7.3.0-rc0 WT-12005 Fix memory leak in __wt_background_compact_signal
1 parent 3a92d0c commit 1d7055b

File tree

4 files changed

+19
-17
lines changed

4 files changed

+19
-17
lines changed

src/third_party/wiredtiger/import.data

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"vendor": "wiredtiger",
33
"github": "wiredtiger/wiredtiger.git",
44
"branch": "mongodb-master",
5-
"commit": "8288276864b2dc8a03e879c002c6f4f6c0c2f5b0"
5+
"commit": "39757ea990f11e884aecbe5fe86648389f26feb6"
66
}

src/third_party/wiredtiger/src/conn/conn_compact.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -727,10 +727,12 @@ __wt_background_compact_signal(WT_SESSION_IMPL *session, const char *config)
727727
conn->background_compact.running = enable;
728728
__wt_free(session, conn->background_compact.config);
729729
conn->background_compact.config = stripped_config;
730+
stripped_config = NULL;
730731
conn->background_compact.signalled = true;
731732
__wt_cond_signal(session, conn->background_compact.cond);
732733

733734
err:
735+
__wt_free(session, stripped_config);
734736
__wt_spin_unlock(session, &conn->background_compact.lock);
735737
return (ret);
736738
}

src/third_party/wiredtiger/test/cppsuite/tests/background_compact.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -300,12 +300,13 @@ class background_compact : public test {
300300
logger::log_msg(
301301
LOG_INFO, type_string(tw->type) + " thread {" + std::to_string(tw->id) + "} commencing.");
302302

303-
bool enabled = false;
304-
305303
while (tw->running()) {
306-
enabled = !enabled;
307-
308-
std::string compact_cfg = enabled ?
304+
/*
305+
* The API supports enabling or disabling the background compact server multiple times
306+
* in a row. Randomly pick whether we are enabling or disabling to cover all state
307+
* changes.
308+
*/
309+
std::string compact_cfg = random_generator::instance().generate_bool() ?
309310
"background=true,free_space_target=" + std::to_string(tw->free_space_target_mb) +
310311
"MB" :
311312
"background=false";

src/third_party/wiredtiger/test/format/compact.c

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -63,26 +63,25 @@ background_compact(void *arg)
6363
if (g.workers_finished)
6464
break;
6565

66-
if (g.background_compaction_running)
67-
testutil_snprintf(config_buf, sizeof(config_buf), "%s", "background=false");
68-
else
66+
/*
67+
* The API supports enabling or disabling the background compact server multiple times in a
68+
* row. Randomly pick whether we are enabling or disabling to cover all state changes.
69+
*/
70+
if (mmrand(&g.extra_rnd, 0, 1))
6971
testutil_snprintf(config_buf, sizeof(config_buf),
7072
"background=true,free_space_target=%" PRIu32 "MB",
7173
GV(BACKGROUND_COMPACT_FREE_SPACE_TARGET));
74+
else
75+
testutil_snprintf(config_buf, sizeof(config_buf), "%s", "background=false");
7276

7377
ret = session->compact(session, NULL, config_buf);
74-
if (ret == 0)
75-
g.background_compaction_running = !g.background_compaction_running;
76-
else
78+
if (ret != 0)
7779
testutil_assertfmt(ret == EBUSY, "WT_SESSION.compact failed: %d", ret);
7880
}
7981

8082
/* Always disable the background compaction server. */
81-
if (g.background_compaction_running)
82-
ret = session->compact(session, NULL, "background=false");
83-
if (ret == 0)
84-
g.background_compaction_running = false;
85-
else
83+
ret = session->compact(session, NULL, "background=false");
84+
if (ret != 0)
8685
testutil_assertfmt(ret == EBUSY, "WT_SESSION.compact failed: %d", ret);
8786

8887
wt_wrap_close_session(session);

0 commit comments

Comments
 (0)