From 506717e23e0295c76686e7ca803f980ff769eeca Mon Sep 17 00:00:00 2001 From: zhangjianweibj Date: Mon, 10 Jun 2019 17:18:30 +0800 Subject: [PATCH] cassandra metrics_id contain null value bug metrics table in cassandra always contain row which has no metric_id. it is casused by cassandra ttl.cassandra supports TTL column only, so when update a row,metric_id must update as well. Change-Id: Ia2d2e1585965dd31f9679e2a63497bf4cc68349e Story: 2005832 Task: 33590 --- monasca_persister/repositories/cassandra/metrics_repository.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/monasca_persister/repositories/cassandra/metrics_repository.py b/monasca_persister/repositories/cassandra/metrics_repository.py index fbd0695c..d3e70151 100644 --- a/monasca_persister/repositories/cassandra/metrics_repository.py +++ b/monasca_persister/repositories/cassandra/metrics_repository.py @@ -45,7 +45,7 @@ METRICS_INSERT_CQL = ('update monasca.metrics USING TTL ? ' 'and dimension_names = ?') METRICS_UPDATE_CQL = ('update monasca.metrics USING TTL ? ' - 'set updated_at = ? ' + 'set metric_id = ?, updated_at = ? ' 'where region = ? and tenant_id = ? and metric_name = ? and dimensions = ? ' 'and dimension_names = ?') @@ -156,6 +156,7 @@ class MetricCassandraRepository(abstract_repository.AbstractCassandraRepository) self._metric_batch.add_measurement_query(measurement_bound_stmt) metric_update_bound_stmt = self._metric_update_stmt.bind((self._retention, + id_bytes, metric.time_stamp, metric.region, metric.tenant_id,