本文整理汇总了Python中couchbase.cluster.Cluster.modify_fragmentation_config方法的典型用法代码示例。如果您正苦于以下问题:Python Cluster.modify_fragmentation_config方法的具体用法?Python Cluster.modify_fragmentation_config怎么用?Python Cluster.modify_fragmentation_config使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类couchbase.cluster.Cluster
的用法示例。
在下文中一共展示了Cluster.modify_fragmentation_config方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: BaseTestCase
# 需要导入模块: from couchbase.cluster import Cluster [as 别名]
# 或者: from couchbase.cluster.Cluster import modify_fragmentation_config [as 别名]
#.........这里部分代码省略.........
for server in servers:
for bucket in self.buckets:
tasks.append(self.cluster.async_wait_for_stats([server], bucket, '',
'ep_queue_size', '==', 0))
tasks.append(self.cluster.async_wait_for_stats([server], bucket, '',
'ep_flusher_todo', '==', 0))
for task in tasks:
task.result()
"""Verifies data on all of the nodes in a cluster.
Verifies all of the data in a specific kv_store index for all buckets in
the cluster.
Args:
server - A server in the cluster. (TestInputServer)
kv_store - The kv store index to check. (int)
"""
def _verify_all_buckets(self, server, kv_store=1, timeout=180, max_verify=None, only_store_hash=True, batch_size=1):
tasks = []
for bucket in self.buckets:
tasks.append(self.cluster.async_verify_data(server, bucket, bucket.kvs[kv_store], max_verify, only_store_hash, batch_size))
for task in tasks:
task.result(timeout)
def disable_compaction(self, server=None, bucket="default"):
server = server or self.servers[0]
new_config = {"viewFragmntThresholdPercentage" : None,
"dbFragmentThresholdPercentage" : None,
"dbFragmentThreshold" : None,
"viewFragmntThreshold" : None}
self.cluster.modify_fragmentation_config(server, new_config, bucket)
def async_create_views(self, server, design_doc_name, views, bucket="default"):
tasks = []
if len(views):
for view in views:
t_ = self.cluster.async_create_view(server, design_doc_name, view, bucket)
tasks.append(t_)
else:
t_ = self.cluster.async_create_view(server, design_doc_name, None, bucket)
tasks.append(t_)
return tasks
def create_views(self, server, design_doc_name, views, bucket="default", timeout=None):
if len(views):
for view in views:
self.cluster.create_view(server, design_doc_name, view, bucket, timeout)
else:
self.cluster.create_view(server, design_doc_name, None, bucket, timeout)
def make_default_views(self, prefix, count, is_dev_ddoc=False):
ref_view = self.default_view
ref_view.name = (prefix, ref_view.name)[prefix is None]
return [View(ref_view.name + str(i), ref_view.map_func, None, is_dev_ddoc) for i in xrange(count)]
def _load_doc_data_all_buckets(self, data_op="create"):
#initialize the template for document generator
age = range(5)
first = ['james', 'sharon']
template = '{{ "age": {0}, "first_name": "{1}" }}'
gen_load = DocumentGenerator('test_docs', template, age, first, start=0, end=self.num_items)
self.log.info("%s %s documents..." % (data_op, self.num_items))
示例2: BaseTestCase
# 需要导入模块: from couchbase.cluster import Cluster [as 别名]
# 或者: from couchbase.cluster.Cluster import modify_fragmentation_config [as 别名]
#.........这里部分代码省略.........
kv_store - The index of the bucket's kv_store to use. (int)
"""
def _load_all_buckets(self, server, kv_gen, op_type, exp, kv_store=1, flag=0, only_store_hash=True, batch_size=1000, pause_secs=1, timeout_secs=30):
tasks = self._async_load_all_buckets(server, kv_gen, op_type, exp, kv_store, flag, only_store_hash, batch_size, pause_secs, timeout_secs)
for task in tasks:
task.result()
"""Waits for queues to drain on all servers and buckets in a cluster.
A utility function that waits for all of the items loaded to be persisted
and replicated.
Args:
servers - A list of all of the servers in the cluster. ([TestInputServer])
"""
def _wait_for_stats_all_buckets(self, servers):
tasks = []
for server in servers:
for bucket in self.buckets:
tasks.append(self.cluster.async_wait_for_stats([server], bucket, '',
'ep_queue_size', '==', 0))
tasks.append(self.cluster.async_wait_for_stats([server], bucket, '',
'ep_flusher_todo', '==', 0))
for task in tasks:
task.result()
"""Verifies data on all of the nodes in a cluster.
Verifies all of the data in a specific kv_store index for all buckets in
the cluster.
Args:
server - A server in the cluster. (TestInputServer)
kv_store - The kv store index to check. (int)
"""
def _verify_all_buckets(self, server, kv_store=1, timeout=180, max_verify=None, only_store_hash=True, batch_size=1000):
tasks = []
for bucket in self.buckets:
tasks.append(self.cluster.async_verify_data(server, bucket, bucket.kvs[kv_store], max_verify, only_store_hash, batch_size))
for task in tasks:
task.result(timeout)
def disable_compaction(self, server=None, bucket="default"):
server = server or self.servers[0]
new_config = {"viewFragmntThresholdPercentage" : None,
"dbFragmentThresholdPercentage" : None,
"dbFragmentThreshold" : None,
"viewFragmntThreshold" : None}
self.cluster.modify_fragmentation_config(server, new_config, bucket)
def async_create_views(self, server, design_doc_name, views, bucket="default", with_query=True):
tasks = []
if len(views):
for view in views:
t_ = self.cluster.async_create_view(server, design_doc_name, view, bucket, with_query)
tasks.append(t_)
else:
t_ = self.cluster.async_create_view(server, design_doc_name, None, bucket, with_query)
tasks.append(t_)
return tasks
def create_views(self, server, design_doc_name, views, bucket="default", timeout=None):
if len(views):
for view in views:
self.cluster.create_view(server, design_doc_name, view, bucket, timeout)
else:
self.cluster.create_view(server, design_doc_name, None, bucket, timeout)
def make_default_views(self, prefix, count, is_dev_ddoc=False):
ref_view = self.default_view
ref_view.name = (prefix, ref_view.name)[prefix is None]
return [View(ref_view.name + str(i), ref_view.map_func, None, is_dev_ddoc) for i in xrange(count)]
def _load_doc_data_all_buckets(self, data_op="create", batch_size=1000):
#initialize the template for document generator
age = range(5)
first = ['james', 'sharon']
template = '{{ "age": {0}, "first_name": "{1}" }}'
gen_load = DocumentGenerator('test_docs', template, age, first, start=0, end=self.num_items)
self.log.info("%s %s documents..." % (data_op, self.num_items))
self._load_all_buckets(self.master, gen_load, data_op, 0, batch_size=batch_size)
def verify_cluster_stats(self, servers=None, master=None, max_verify=None):
if servers is None:
servers = self.servers
if master is None:
master = self.master
if max_verify is None:
max_verify = self.max_verify
self._wait_for_stats_all_buckets(servers)
self._verify_all_buckets(master, max_verify=max_verify)
self._verify_stats_all_buckets(servers)
#verify that curr_items_tot corresponds to sum of curr_items from all nodes
verified = True
for bucket in self.buckets:
verified &= RebalanceHelper.wait_till_total_numbers_match(master, bucket)
self.assertTrue(verified, "Lost items!!! Replication was completed but sum(curr_items) don't match the curr_items_total")