"alter table drop column" no backup

18 Views Asked by At

I found that when I drop a column in the table, cnosdb did not update the backup information. Is this a bug?

0. Env

version:cnosdb 2.4.0
revision 297495a

1. Reproduce step

1.1 Create table

oceanic_station ❯ CREATE TABLE air (visibility DOUBLE,temperature DOUBLE,pressure DOUBLE,TAGS(station));
Query took 0.014 seconds.
oceanic_station ❯ DESCRIBE TABLE air;
+-------------+-----------------------+-------------+-------------------+
| column_name | data_type             | column_type | compression_codec |
+-------------+-----------------------+-------------+-------------------+
| time        | TIMESTAMP(NANOSECOND) | TIME        | DEFAULT           |
| station     | STRING                | TAG         | DEFAULT           |
| visibility  | DOUBLE                | FIELD       | DEFAULT           |
| temperature | DOUBLE                | FIELD       | DEFAULT           |
| pressure    | DOUBLE                | FIELD       | DEFAULT           |
+-------------+-----------------------+-------------+-------------------+
Query took 0.017 seconds.

1.2 Drop column

oceanic_station ❯ ALTER TABLE air DROP pressure;
Query took 0.022 seconds.
oceanic_station ❯ DESCRIBE TABLE air;
+-------------+-----------------------+-------------+-------------------+
| column_name | data_type             | column_type | compression_codec |
+-------------+-----------------------+-------------+-------------------+
| time        | TIMESTAMP(NANOSECOND) | TIME        | DEFAULT           |
| station     | STRING                | TAG         | DEFAULT           |
| visibility  | DOUBLE                | FIELD       | DEFAULT           |
| temperature | DOUBLE                | FIELD       | DEFAULT           |
+-------------+-----------------------+-------------+-------------------+
Query took 0.012 seconds.

1.3 Check backup

root@3ff133af434b:/# cnosdb-cli dump-ddl -t cnosdb > tenant_cnosdb.sql
root@3ff133af434b:/# cat tenant_cnosdb.sql 
...
create table "oceanic_station"."air" ("visibility" DOUBLE, "temperature" DOUBLE, "pressure" DOUBLE, tags ("station"));
...

As you can see, the "pressure" column still exists, that is, the backup information has not been updated.

0

There are 0 best solutions below