summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/ext/compressors/zlib/zlib_compress.c
diff options
context:
space:
mode:
authorMichael Cahill <michael.cahill@mongodb.com>2016-11-16 21:10:29 +1100
committerMichael Cahill <michael.cahill@mongodb.com>2016-11-16 21:10:29 +1100
commitfb4ae3792065e98696e391ac1c4602216b8502cb (patch)
tree7d6ab84b45c4eb26bbe59e73a3950e9aa2233f41 /src/third_party/wiredtiger/ext/compressors/zlib/zlib_compress.c
parent6904d0ac5ea4bba1822103eb4e7a623cc81de641 (diff)
downloadmongo-fb4ae3792065e98696e391ac1c4602216b8502cb.tar.gz
Import wiredtiger: ca6eee06ffdacc8e191987e64b3791740dad21e1 from branch mongodb-3.4
ref: 74430da40c..ca6eee06ff for: 3.4.0 WT-2962 Provide a way to configure builtin extensions WT-2984 Search of metadata for recently created collection gets WT_NOTFOUND WT-3000 Missing log records in recovery when crashing after a log file switch WT-3002 Allow applications to exempt threads from eviction. WT-3004 lint: declare functions that don't return a value as void WT-3011 __wt_curjoin_open() saves the wrong URI in the cursor. WT-3012 Test format hanging on LSM configurations WT-3015 Test format stuck with 2mb cache WT-3016 Tests needed for systems without ftruncate WT-3017 Hazard pointer race with page replace causes error WT-3018 lint WT-3020 LSM primary changes impact parallel-pop-lsm load time WT-3022 LSM operations get stuck in __wt_clsm_await_switch waiting for switch on tree to complete WT-3023 Test format hang on zSeries WT-3024 wtperf medium-lsm-compact test can hang
Diffstat (limited to 'src/third_party/wiredtiger/ext/compressors/zlib/zlib_compress.c')
-rw-r--r--src/third_party/wiredtiger/ext/compressors/zlib/zlib_compress.c57
1 files changed, 17 insertions, 40 deletions
diff --git a/src/third_party/wiredtiger/ext/compressors/zlib/zlib_compress.c b/src/third_party/wiredtiger/ext/compressors/zlib/zlib_compress.c
index 3665ec48b9a..09a793646e7 100644
--- a/src/third_party/wiredtiger/ext/compressors/zlib/zlib_compress.c
+++ b/src/third_party/wiredtiger/ext/compressors/zlib/zlib_compress.c
@@ -483,8 +483,7 @@ static int
zlib_init_config(
WT_CONNECTION *connection, WT_CONFIG_ARG *config, int *zlib_levelp)
{
- WT_CONFIG_ITEM k, v;
- WT_CONFIG_PARSER *config_parser;
+ WT_CONFIG_ITEM v;
WT_EXTENSION_API *wt_api;
int ret, zlib_level;
@@ -497,49 +496,27 @@ zlib_init_config(
* level; review the configuration.
*/
wt_api = connection->get_extension_api(connection);
- if ((ret =
- wt_api->config_get(wt_api, NULL, config, "config", &v)) != 0) {
- (void)wt_api->err_printf(wt_api, NULL,
- "WT_EXTENSION_API.config_get: zlib configure: %s",
- wt_api->strerror(wt_api, NULL, ret));
- return (ret);
- }
- if ((ret = wt_api->config_parser_open(
- wt_api, NULL, v.str, v.len, &config_parser)) != 0) {
- (void)wt_api->err_printf(wt_api, NULL,
- "WT_EXTENSION_API.config_parser_open: zlib configure: %s",
- wt_api->strerror(wt_api, NULL, ret));
- return (ret);
- }
- while ((ret = config_parser->next(config_parser, &k, &v)) == 0)
- if (strlen("compression_level") == k.len &&
- strncmp("compression_level", k.str, k.len) == 0) {
- /*
- * Between 0-9: level: see zlib manual.
- */
- zlib_level = (int)v.val;
- if (zlib_level < 0 || zlib_level > 9) {
- (void)wt_api->err_printf(wt_api, NULL,
- "WT_CONFIG_PARSER.next: zlib configure: "
- "unsupported compression level %d",
- zlib_level);
- return (EINVAL);
- }
- *zlib_levelp = zlib_level;
- continue;
+ if ((ret = wt_api->config_get(
+ wt_api, NULL, config, "compression_level", &v)) == 0) {
+ /*
+ * Between 0-9: level: see zlib manual.
+ */
+ zlib_level = (int)v.val;
+ if (zlib_level < 0 || zlib_level > 9) {
+ (void)wt_api->err_printf(wt_api, NULL,
+ "zlib_init_config: "
+ "unsupported compression level %d",
+ zlib_level);
+ return (EINVAL);
}
- if (ret != WT_NOTFOUND) {
- (void)wt_api->err_printf(wt_api, NULL,
- "WT_CONFIG_PARSER.next: zlib configure: %s",
- wt_api->strerror(wt_api, NULL, ret));
- return (ret);
- }
- if ((ret = config_parser->close(config_parser)) != 0) {
+ *zlib_levelp = zlib_level;
+ } else if (ret != WT_NOTFOUND) {
(void)wt_api->err_printf(wt_api, NULL,
- "WT_CONFIG_PARSER.close: zlib configure: %s",
+ "zlib_init_config: %s",
wt_api->strerror(wt_api, NULL, ret));
return (ret);
}
+
return (0);
}