From 8de9c9a637804a107ea81275d59dc20a64c19901 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89douard=20Thuleau?= Date: Wed, 16 Mar 2016 17:51:24 +0100 Subject: [PATCH] Use pycassa xget() instead of get() When listing all resources of a type without any filters, the get() method is used to fetch data from cassandra and can fail if the amount of resources exceed 10k due to a thrift limitation. Use of xget() method resolves that. Change-Id: I4ba804ed3f400118eb5c28b1d5be0cf7a7a6cedc Closes-Bug: #1538991 --- src/config/common/tests/test_utils.py | 2 +- src/config/common/vnc_cassandra.py | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/config/common/tests/test_utils.py b/src/config/common/tests/test_utils.py index 7063a9f0444..8af2dac682a 100644 --- a/src/config/common/tests/test_utils.py +++ b/src/config/common/tests/test_utils.py @@ -254,7 +254,7 @@ def remove(self, key, columns=None): # end remove def xget(self, key, column_start=None, column_finish=None, - include_timestamp=False, include_ttl=False): + column_count=0, include_timestamp=False, include_ttl=False): col_names = [] if key in self._rows: col_names = self._rows[key].keys() diff --git a/src/config/common/vnc_cassandra.py b/src/config/common/vnc_cassandra.py index 32005d39764..1b443a242a2 100644 --- a/src/config/common/vnc_cassandra.py +++ b/src/config/common/vnc_cassandra.py @@ -934,7 +934,7 @@ def filter_rows_object_list(): else: # grab all resources of this type obj_fq_name_cf = self._obj_fq_name_cf try: - cols = obj_fq_name_cf.get('%s' %(obj_type), + cols = obj_fq_name_cf.xget('%s' %(obj_type), column_count=self._MAX_COL) except pycassa.NotFoundException: if count: @@ -944,7 +944,7 @@ def filter_rows_object_list(): def filter_rows_no_anchor(): all_obj_infos = {} - for col_name, col_val in cols.items(): + for col_name, _ in cols: # give chance for zk heartbeat/ping gevent.sleep(0) col_name_arr = utils.decode_string(col_name).split(':') @@ -1223,5 +1223,3 @@ def _read_back_ref(self, result, obj_uuid, back_ref_type, result['%s_back_refs' % (back_ref_type)].append(back_ref_info) # end _read_back_ref - -