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
This commit is contained in:
zhangjianweibj 2019-06-10 17:18:30 +08:00
parent c32885aed8
commit 506717e23e
1 changed files with 2 additions and 1 deletions

View File

@ -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,