Skip to content

Commit d8d07a3

Browse files
[fix] Avoid error on rts already exists (was causing a leak on TSDB) (#278)
* Reduced the ammount of collected data on server stats and commandstats * [fix] Avoid error on rts already exists (was causing a leak on TSDB) * [fix] Avoid error on rts already exists (was causing a leak on TSDB)
1 parent 823c31f commit d8d07a3

File tree

2 files changed

+27
-20
lines changed

2 files changed

+27
-20
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "redisbench-admin"
3-
version = "0.6.15"
3+
version = "0.6.16"
44
description = "Redis benchmark run helper. A wrapper around Redis and Redis Modules benchmark tools ( ftsb_redisearch, memtier_benchmark, redis-benchmark, aibench, etc... )."
55
authors = ["filipecosta90 <[email protected]>","Redis Performance Group <[email protected]>"]
66
readme = "README.md"

redisbench_admin/utils/remote.py

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -550,28 +550,18 @@ def push_data_to_redistimeseries(rts, time_series_dict: dict, expire_msecs=0):
550550

551551
def exporter_create_ts(rts, time_series, timeseries_name):
552552
try:
553-
logging.debug(
554-
"Creating timeseries named {} with labels {}".format(
555-
timeseries_name, time_series["labels"]
556-
)
557-
)
558-
rts.create(timeseries_name, labels=time_series["labels"], chunk_size=128)
559-
except redis.exceptions.ResponseError as e:
560-
if "already exists" in e.__str__():
553+
if rts.redis.exists(timeseries_name) is False:
561554
logging.debug(
562-
"Timeseries named {} already exists. Checking that the labels match.".format(
563-
timeseries_name
555+
"Creating timeseries named {} with labels {}".format(
556+
timeseries_name, time_series["labels"]
564557
)
565558
)
566-
set1 = set(time_series["labels"].items())
567-
set2 = set(rts.info(timeseries_name).labels.items())
568-
if len(set1 - set2) > 0 or len(set2 - set1) > 0:
569-
logging.info(
570-
"Given the labels don't match using TS.ALTER on {} to update labels to {}".format(
571-
timeseries_name, time_series["labels"]
572-
)
573-
)
574-
rts.alter(timeseries_name, labels=time_series["labels"])
559+
rts.create(timeseries_name, labels=time_series["labels"], chunk_size=128)
560+
else:
561+
check_rts_labels(rts, time_series, timeseries_name)
562+
except redis.exceptions.ResponseError as e:
563+
if "already exists" in e.__str__():
564+
check_rts_labels(rts, time_series, timeseries_name)
575565
pass
576566
else:
577567
logging.error(
@@ -582,6 +572,23 @@ def exporter_create_ts(rts, time_series, timeseries_name):
582572
raise
583573

584574

575+
def check_rts_labels(rts, time_series, timeseries_name):
576+
logging.debug(
577+
"Timeseries named {} already exists. Checking that the labels match.".format(
578+
timeseries_name
579+
)
580+
)
581+
set1 = set(time_series["labels"].items())
582+
set2 = set(rts.info(timeseries_name).labels.items())
583+
if len(set1 - set2) > 0 or len(set2 - set1) > 0:
584+
logging.info(
585+
"Given the labels don't match using TS.ALTER on {} to update labels to {}".format(
586+
timeseries_name, time_series["labels"]
587+
)
588+
)
589+
rts.alter(timeseries_name, labels=time_series["labels"])
590+
591+
585592
def extract_redisgraph_version_from_resultdict(results_dict: dict):
586593
version = None
587594
if "DBSpecificConfigs" in results_dict:

0 commit comments

Comments
 (0)