diff options
author | sueloverso <sue@mongodb.com> | 2016-08-14 20:38:40 -0400 |
---|---|---|
committer | Michael Cahill <michael.cahill@mongodb.com> | 2016-08-15 10:38:40 +1000 |
commit | b2fbc74c45a9c50982d0b5aafb5a658fe593cf8a (patch) | |
tree | cdd71416eda0622433374df4bd8f2940a3818753 | |
parent | 50e0767bbc62bc7574805793b661ccfabfea9459 (diff) | |
download | mongo-b2fbc74c45a9c50982d0b5aafb5a658fe593cf8a.tar.gz |
WT-2827 Set a reasonable minimum for log_size. (#2946)
-rw-r--r-- | dist/api_data.py | 3 | ||||
-rw-r--r-- | src/conn/conn_ckpt.c | 9 | ||||
-rw-r--r-- | src/include/wiredtiger.in | 19 | ||||
-rw-r--r-- | test/suite/test_reconfig03.py | 8 |
4 files changed, 29 insertions, 10 deletions
diff --git a/dist/api_data.py b/dist/api_data.py index 4c4cf9270f6..3eb6d6c5f26 100644 --- a/dist/api_data.py +++ b/dist/api_data.py @@ -375,7 +375,8 @@ connection_runtime_config = [ type='category', subconfig=[ Config('log_size', '0', r''' wait for this amount of log record bytes to be written to - the log between each checkpoint. A database can configure + the log between each checkpoint. If non-zero, this value will + use a minimum of the log file size. A database can configure both log_size and wait to set an upper bound for checkpoints; setting this value above 0 configures periodic checkpoints''', min='0', max='2GB'), diff --git a/src/conn/conn_ckpt.c b/src/conn/conn_ckpt.c index d54c65c4767..24546fc4943 100644 --- a/src/conn/conn_ckpt.c +++ b/src/conn/conn_ckpt.c @@ -38,6 +38,15 @@ __ckpt_server_config(WT_SESSION_IMPL *session, const char **cfg, bool *startp) if (conn->ckpt_usecs != 0 || (conn->ckpt_logsize != 0 && FLD_ISSET(conn->log_flags, WT_CONN_LOG_ENABLED))) { + /* + * If checkpointing based on log data, use a minimum of the + * log file size. The logging subsystem has already been + * initialized. + */ + if (conn->ckpt_logsize != 0 && + FLD_ISSET(conn->log_flags, WT_CONN_LOG_ENABLED)) + conn->ckpt_logsize = WT_MAX( + conn->ckpt_logsize, conn->log_file_max); /* Checkpoints are incompatible with in-memory configuration */ WT_RET(__wt_config_gets(session, cfg, "in_memory", &cval)); if (cval.val != 0) diff --git a/src/include/wiredtiger.in b/src/include/wiredtiger.in index 006c8bccdff..cfed6a6aa89 100644 --- a/src/include/wiredtiger.in +++ b/src/include/wiredtiger.in @@ -1785,7 +1785,8 @@ struct __wt_connection { * Enabling the checkpoint server uses a session from the configured * session_max., a set of related configuration options defined below.} * @config{ log_size, wait for this amount of log - * record bytes to be written to the log between each checkpoint. A + * record bytes to be written to the log between each checkpoint. If + * non-zero\, this value will use a minimum of the log file size. A * database can configure both log_size and wait to set an upper bound * for checkpoints; setting this value above 0 configures periodic * checkpoints., an integer between 0 and 2GB; default \c 0.} @@ -2203,14 +2204,14 @@ struct __wt_connection { * checkpoint server uses a session from the configured session_max., a set of * related configuration options defined below.} * @config{ log_size, wait for this amount of log record - * bytes to be written to the log between each checkpoint. A database can - * configure both log_size and wait to set an upper bound for checkpoints; - * setting this value above 0 configures periodic checkpoints., an integer - * between 0 and 2GB; default \c 0.} - * @config{ wait, - * seconds to wait between each checkpoint; setting this value above 0 - * configures periodic checkpoints., an integer between 0 and 100000; default \c - * 0.} + * bytes to be written to the log between each checkpoint. If non-zero\, this + * value will use a minimum of the log file size. A database can configure both + * log_size and wait to set an upper bound for checkpoints; setting this value + * above 0 configures periodic checkpoints., an integer between 0 and 2GB; + * default \c 0.} + * @config{ wait, seconds to wait between + * each checkpoint; setting this value above 0 configures periodic checkpoints., + * an integer between 0 and 100000; default \c 0.} * @config{ ),,} * @config{checkpoint_sync, flush files to stable storage when closing or * writing checkpoints., a boolean flag; default \c true.} diff --git a/test/suite/test_reconfig03.py b/test/suite/test_reconfig03.py index c667a5c7d9d..e9d39ea5a76 100644 --- a/test/suite/test_reconfig03.py +++ b/test/suite/test_reconfig03.py @@ -54,5 +54,13 @@ class test_reconfig03(wttest.WiredTigerTestCase): time.sleep(1) self.conn.reconfigure("shared_cache=(chunk=11MB, name=bar, reserve=12MB, size=1G)") + def test_reconfig03_log_size(self): + # + # Reconfigure checkpoint based on log size. + # + self.conn.reconfigure("checkpoint=(log_size=20)") + self.conn.reconfigure("checkpoint=(log_size=1M)") + self.conn.reconfigure("checkpoint=(log_size=0)") + if __name__ == '__main__': wttest.run() |