From c5612a752e4ad8652f81a18d5280a21d2efea768 Mon Sep 17 00:00:00 2001 From: sueloverso Date: Thu, 20 Jul 2017 23:00:40 -0400 Subject: WT-3433 Add support for alter and readonly. Add test case. (#3526) --- src/session/session_api.c | 24 +++++++++++++++++++++++- test/suite/test_readonly03.py | 9 ++++++--- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/src/session/session_api.c b/src/session/session_api.c index aff5b4eb797..f7d6ce5e7e7 100644 --- a/src/session/session_api.c +++ b/src/session/session_api.c @@ -175,6 +175,28 @@ err: if (ret != 0) API_END_RET_NOTFOUND_MAP(session, ret); } +/* + * __session_alter_readonly -- + * WT_SESSION->alter method; readonly version. + */ +static int +__session_alter_readonly( + WT_SESSION *wt_session, const char *uri, const char *config) +{ + WT_DECL_RET; + WT_SESSION_IMPL *session; + + WT_UNUSED(uri); + WT_UNUSED(config); + + session = (WT_SESSION_IMPL *)wt_session; + SESSION_API_CALL_NOCONF(session, alter); + + WT_STAT_CONN_INCR(session, session_table_alter_fail); + ret = __wt_session_notsup(session); +err: API_END_RET(session, ret); +} + /* * __session_close -- * WT_SESSION->close method. @@ -1774,7 +1796,7 @@ __open_session(WT_CONNECTION_IMPL *conn, }, stds_readonly = { NULL, NULL, - __session_alter, + __session_alter_readonly, __session_close, __session_reconfigure, __wt_session_strerror, diff --git a/test/suite/test_readonly03.py b/test/suite/test_readonly03.py index 6fe2942ca18..474e23981a2 100644 --- a/test/suite/test_readonly03.py +++ b/test/suite/test_readonly03.py @@ -43,8 +43,8 @@ class test_readonly03(wttest.WiredTigerTestCase, suite_subprocess): conn_params = 'create,log=(enabled),' conn_params_rd = 'readonly=true' - session_ops = [ 'create', 'compact', 'drop', 'log_flush', 'log_printf', - 'rebalance', 'rename', 'salvage', 'truncate', 'upgrade', ] + session_ops = [ 'alter', 'create', 'compact', 'drop', 'log_flush', + 'log_printf', 'rebalance', 'rename', 'salvage', 'truncate', 'upgrade', ] cursor_ops = [ 'insert', 'remove', 'update', ] def setUpConnectionOpen(self, dir): @@ -86,7 +86,10 @@ class test_readonly03(wttest.WiredTigerTestCase, suite_subprocess): self.fail('Unknown cursor operation: ' + op) c.close() for op in self.session_ops: - if op == 'create': + if op == 'alter': + self.assertRaisesWithMessage(wiredtiger.WiredTigerError, + lambda: self.session.alter(self.uri, None), msg) + elif op == 'create': self.assertRaisesWithMessage(wiredtiger.WiredTigerError, lambda: self.session.create(self.uri2, create_params), msg) -- cgit v1.2.1