Skip to content

Report error message when deleting template time series with multi-level wildcard pattern#12306

Merged
JackieTien97 merged 6 commits intoapache:masterfrom
Cpaulyz:fix_delete_timeseries
Apr 19, 2024
Merged

Report error message when deleting template time series with multi-level wildcard pattern#12306
JackieTien97 merged 6 commits intoapache:masterfrom
Cpaulyz:fix_delete_timeseries

Conversation

@Cpaulyz
Copy link
Copy Markdown
Contributor

@Cpaulyz Cpaulyz commented Apr 9, 2024

Description

In #12174, we apply some optimization on deleting time series by pattern ended with multi-level wildcard(**).

However, some corner cases were ignored, which led to inconsistent bahavior with orgin version. For example, if time series root.db.d1.s1 is represented by template, it should not be deleted if client executs command delete timeseries root.**.

This PR fix this problem.

Reprodeuce step:

# 1. create template
create database root.sg;
create schema template t1 aligned (s_name TEXT, s_status BOOLEAN, start_time INT64, s_lat FLOAT encoding=Gorilla, s_lon FLOAT encoding=Gorilla);
show schema templates;
show nodes in schema template t1;
# 2. set
show paths set schema template t1;
set schema template t1 to root.sg;
show paths set schema template t1;
# 3. activate
show paths using schema template t1;
create timeseries of schema template on root.sg.d1;
create timeseries using schema template on root.sg.d2;
show paths using schema template t1;show child nodes root.sg.d1;
insert into root.sg.d1(time, s_name, s_status, start_time, s_lat, s_lon) values (1, 'arrow', true, 1697167800000, 3.5, 435.67);
insert into root.sg.d2(time, s_name, s_status, start_time, s_lat, s_lon) values (2, 'Ed', true, 1697166600000, 13.5, 135.33);
alter schema template t1 add (s_speed double);
show nodes in schema template t1;insert into root.sg.d3(time, s_name, s_status, start_time, s_lat, s_lon) values (3, 'Jean', true, 1697167600000, 3.5, 15.11);
select * from root.sg.** align by device;insert into root.sg.d1(time, s_speed) values (1, 109.36);
insert into root.sg.d3(time, s_speed) values (3, 409.19);
select * from root.sg.** align by device;
insert into root.sg.d1(time, s_name, s_status, s_lon2) values (1, null, true, 100.45);
insert into root.sg.d2(time, s_name, s_status, s_lon2) values (2, 'aya', false, 300.03);
# show nodes in template
show nodes in schema template t1;select start_time,s_lat,s_lon2,s_speed,s_status,s_name,s_lon from root.sg.** align by device;
#  Delete template series as nornal time series, expect exception 508
delete timeseries root.sg.d1.**;
delete timeseries root.sg.**;
show timeseries; 

@Cpaulyz Cpaulyz requested a review from MarcosZyk April 9, 2024 08:23
@JackieTien97 JackieTien97 merged commit 3d7413c into apache:master Apr 19, 2024
@Cpaulyz Cpaulyz deleted the fix_delete_timeseries branch May 7, 2024 02:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants