diff options
author | Luke Chen <luke.chen@mongodb.com> | 2022-02-02 15:00:31 +1100 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-02-02 04:51:20 +0000 |
commit | 9ca304d428cc1e730c7ec4e9da7a75107c3e0cb0 (patch) | |
tree | 4bb1ffd2a0c322dc78d29838200b23d3e5048782 | |
parent | 34af57bc151c2ac51009834409f0e33364d9bf0a (diff) | |
download | mongo-9ca304d428cc1e730c7ec4e9da7a75107c3e0cb0.tar.gz |
Import wiredtiger: 06efe1b93ce8435ae7bf296af669293f3d9ace19 from branch mongodb-master
ref: 296ca76184..06efe1b93c
for: 5.3.0
WT-8239 Disable statistics logging in read only mode
-rw-r--r-- | src/third_party/wiredtiger/import.data | 2 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/conn/conn_stat.c | 8 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/suite/test_stat_log01.py | 21 |
3 files changed, 23 insertions, 8 deletions
diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data index 67e48d6987e..953f12152dc 100644 --- a/src/third_party/wiredtiger/import.data +++ b/src/third_party/wiredtiger/import.data @@ -2,5 +2,5 @@ "vendor": "wiredtiger", "github": "wiredtiger/wiredtiger.git", "branch": "mongodb-master", - "commit": "296ca76184fff794bc0eefe9f6b4f7cfe12b0c23" + "commit": "06efe1b93ce8435ae7bf296af669293f3d9ace19" } diff --git a/src/third_party/wiredtiger/src/conn/conn_stat.c b/src/third_party/wiredtiger/src/conn/conn_stat.c index ed4730a078b..95028fa55e0 100644 --- a/src/third_party/wiredtiger/src/conn/conn_stat.c +++ b/src/third_party/wiredtiger/src/conn/conn_stat.c @@ -649,6 +649,10 @@ __wt_statlog_create(WT_SESSION_IMPL *session, const char *cfg[]) conn = S2C(session); + /* Readonly systems don't configure statistics logging. */ + if (F_ISSET(conn, WT_CONN_READONLY)) + return (0); + /* * Stop any server that is already running. This means that each time reconfigure is called * we'll bounce the server even if there are no configuration changes. This makes our life @@ -684,6 +688,10 @@ __wt_statlog_destroy(WT_SESSION_IMPL *session, bool is_close) conn = S2C(session); + /* Readonly systems don't configure statistics logging. */ + if (F_ISSET(conn, WT_CONN_READONLY)) + return (0); + /* Stop the server thread. */ FLD_CLR(conn->server_flags, WT_CONN_SERVER_STATISTICS); if (conn->stat_tid_set) { diff --git a/src/third_party/wiredtiger/test/suite/test_stat_log01.py b/src/third_party/wiredtiger/test/suite/test_stat_log01.py index 1d4b43e3c74..51e693cdf46 100644 --- a/src/third_party/wiredtiger/test/suite/test_stat_log01.py +++ b/src/third_party/wiredtiger/test/suite/test_stat_log01.py @@ -35,10 +35,6 @@ from wiredtiger import stat # test_stat_log01.py # Statistics log class test_stat_log01(wttest.WiredTigerTestCase): - """ - Test statistics log - """ - # Tests need to setup the connection in their own way. def setUpConnectionOpen(self, dir): return None @@ -46,6 +42,10 @@ class test_stat_log01(wttest.WiredTigerTestCase): def setUpSessionOpen(self, conn): return None + def check_stats_file(self, dir): + files = glob.glob(dir + '/' + 'WiredTigerStat.[0-9]*') + self.assertTrue(files) + def test_stats_log_default(self): self.conn = self.wiredtiger_open( None, "create,statistics=(fast),statistics_log=(wait=1)") @@ -76,9 +76,16 @@ class test_stat_log01(wttest.WiredTigerTestCase): self.close_conn() self.check_stats_file(".") - def check_stats_file(self, dir): - files = glob.glob(dir + '/' + 'WiredTigerStat.[0-9]*') - self.assertTrue(files) +# Statistics log, test subsequent readonly open works. +class test_stat_log01_readonly(wttest.WiredTigerTestCase): + # Configure statistics logging so it gets written into the base configuration file. + conn_config = 'log=(enabled),statistics=(all),statistics_log=(on_close=true)' + + def test_stat_log01_readonly(self): + # Close and reopen in readonly mode. + self.close_conn() + conn = self.wiredtiger_open(self.home, "readonly") + conn.close() if __name__ == '__main__': wttest.run() |