Skip to content

Commit 73aff26

Browse files
jimwwalkerdaverigby
authored andcommitted
MB-21190: cbepctl support to change max_cas
The initial version of this commit blocks *all* set commands as it required they all pass a vbucket-id even when not required. This update means that changing max_cas is done via cbepctl set_vbucket_param That command requires the vbucket-id. This commit changes (reverts) to not requiring the extra CLI argument. cbepctl set Change-Id: I04b8b607ccfbc56bca46fe55ca0360f0fe7874ef Reviewed-on: http://review.couchbase.org/68736 Reviewed-by: Dave Rigby <[email protected]> Tested-by: buildbot <[email protected]>
1 parent a1702bb commit 73aff26

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

management/cbepctl

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def cmd(f):
4141
return g
4242

4343
@cmd
44-
def set_param(mc, type, key, val, vbucket):
44+
def set_param(mc, type, key, val):
4545
engine_param = None
4646
if type == 'checkpoint_param':
4747
engine_param = memcacheConstants.ENGINE_PARAM_CHECKPOINT
@@ -74,6 +74,20 @@ def set_param(mc, type, key, val, vbucket):
7474
_quota_ = int(mc.stats()['ep_max_size'])
7575
val = str(int(float(_x_)*(_quota_)/100))
7676

77+
try:
78+
mc.set_param(0, key, val, engine_param)
79+
print 'set %s to %s' %(key, val)
80+
except mc_bin_client.MemcachedError, error:
81+
print 'Error: %s' % error.msg
82+
except mc_bin_client.TimeoutError, error:
83+
print error
84+
except Exception, e:
85+
print 'Generic error (%s)' % e
86+
87+
@cmd
88+
def set_vbucket_param(mc, key, vbucket, val):
89+
engine_param = memcacheConstants.ENGINE_PARAM_VBUCKET
90+
7791
try:
7892
mc.set_param(int(vbucket), key, val, engine_param)
7993
print 'set %s to %s' %(key, val)
@@ -250,16 +264,18 @@ Available params for "set":
250264
dcp_consumer_process_buffered_messages_batch_size - The number of items the
251265
DCP processor will consume
252266
in a single batch.
253-
Available params for "set vbucket_param":
267+
268+
Available params for "set_vbucket_param:
254269
max_cas - Change the max_cas of a vbucket. The value and vbucket are specified as decimal
255270
integers. The new-value is interpretted as an unsigned 64-bit integer.
256271
257-
cbepctl host:port -b default set vbucket_param max_cas <new-value> <vbucket-id>
272+
cbepctl host:port -b default set_vbucket_param max_cas <vbucket-id> <new-value>
258273
259274
""")
260275

261276
c.addCommand('drain', drain, "drain")
262-
c.addCommand('set', set_param, 'set type param value vbucket')
277+
c.addCommand('set', set_param, 'set type param value')
278+
c.addCommand('set_vbucket_param', set_vbucket_param, 'type vbucket value')
263279
c.addCommand('start', start, 'start')
264280
c.addCommand('stop', stop, 'stop')
265281
c.addFlag('-a', 'allBuckets', 'iterate over all buckets (requires admin u/p)')

0 commit comments

Comments
 (0)