Uploaded image for project: 'Apache IoTDB'
  1. Apache IoTDB
  2. IOTDB-2158 Fix IT cases in cluster mode
  3. IOTDB-2462

Incorrect result of ALIGN BY DEVICE query

    XMLWordPrintableJSON

Details

    Description

      Repeat steps(By replaying IoTDBAlignByDeviceIT.aggregateTest):

      1. Set up a 3 node cluster with 2 replicas
      2. Prepare the data as the following SQL statements

       

      SET STORAGE GROUP TO root.vehicle;
      SET STORAGE GROUP TO root.other;
      CREATE TIMESERIES root.vehicle.d0.s0 WITH DATATYPE=INT32, ENCODING=RLE;
      CREATE TIMESERIES root.vehicle.d0.s1 WITH DATATYPE=INT64, ENCODING=RLE;
      CREATE TIMESERIES root.vehicle.d0.s2 WITH DATATYPE=FLOAT, ENCODING=RLE;
      CREATE TIMESERIES root.vehicle.d0.s3 WITH DATATYPE=TEXT, ENCODING=PLAIN;
      CREATE TIMESERIES root.vehicle.d0.s4 WITH DATATYPE=BOOLEAN, ENCODING=PLAIN;
      CREATE TIMESERIES root.vehicle.d1.s0 WITH DATATYPE=INT32, ENCODING=RLE;
      CREATE TIMESERIES root.other.d1.s0 WITH DATATYPE=FLOAT, ENCODING=RLE;
      insert into root.vehicle.d0(timestamp,s0) values(1,101);
      insert into root.vehicle.d0(timestamp,s0) values(2,198);
      insert into root.vehicle.d0(timestamp,s0) values(100,99);
      insert into root.vehicle.d0(timestamp,s0) values(101,99);
      insert into root.vehicle.d0(timestamp,s0) values(102,80);
      insert into root.vehicle.d0(timestamp,s0) values(103,99);
      insert into root.vehicle.d0(timestamp,s0) values(104,90);
      insert into root.vehicle.d0(timestamp,s0) values(105,99);
      insert into root.vehicle.d0(timestamp,s0) values(106,99);
      insert into root.vehicle.d0(timestamp,s0) values(2,10000);
      insert into root.vehicle.d0(timestamp,s0) values(50,10000);
      insert into root.vehicle.d0(timestamp,s0) values(1000,22222);
      insert into root.vehicle.d0(timestamp,s1) values(1,1101);
      insert into root.vehicle.d0(timestamp,s1) values(2,198);
      insert into root.vehicle.d0(timestamp,s1) values(100,199);
      insert into root.vehicle.d0(timestamp,s1) values(101,199);
      insert into root.vehicle.d0(timestamp,s1) values(102,180);
      insert into root.vehicle.d0(timestamp,s1) values(103,199);
      insert into root.vehicle.d0(timestamp,s1) values(104,190);
      insert into root.vehicle.d0(timestamp,s1) values(105,199);
      insert into root.vehicle.d0(timestamp,s1) values(2,40000);
      insert into root.vehicle.d0(timestamp,s1) values(50,50000);
      insert into root.vehicle.d0(timestamp,s1) values(1000,55555);
      insert into root.vehicle.d0(timestamp,s1) values(2000-01-01T08:00:00+08:00, 100);
      insert into root.vehicle.d0(timestamp,s2) values(1000,55555);
      insert into root.vehicle.d0(timestamp,s2) values(2,2.22);
      insert into root.vehicle.d0(timestamp,s2) values(3,3.33);
      insert into root.vehicle.d0(timestamp,s2) values(4,4.44);
      insert into root.vehicle.d0(timestamp,s2) values(102,10.00);
      insert into root.vehicle.d0(timestamp,s2) values(105,11.11);
      insert into root.vehicle.d0(timestamp,s2) values(1000,1000.11);
      insert into root.vehicle.d0(timestamp,s3) values(60,'aaaaa');
      insert into root.vehicle.d0(timestamp,s3) values(70,'bbbbb');
      insert into root.vehicle.d0(timestamp,s3) values(80,'ccccc');
      insert into root.vehicle.d0(timestamp,s3) values(101,'ddddd');
      insert into root.vehicle.d0(timestamp,s3) values(102,'fffff');
      insert into root.vehicle.d0(timestamp,s3) values(2000-01-01T08:00:00+08:00, 'good');
      insert into root.vehicle.d0(timestamp,s4) values(100, false);
      insert into root.vehicle.d0(timestamp,s4) values(100, true);
      insert into root.vehicle.d1(timestamp,s0) values(1,999);
      insert into root.vehicle.d1(timestamp,s0) values(1000,888);
      insert into root.other.d1(timestamp,s0) values(2, 3.14); 

      And we get the following input data

       

      2. Execute this query in each node, and we get an empty data set in one.

      select count(s0),count(s1),count(s2),count(s3),count(s4) from root.vehicle.d1,root.vehicle.d0 align by device; 

      The root cause is that MManager.getMatchedDevices(PartialPath, boolean) doesn't have a cluster implementation in CMManager. The node without the data will query the local mtree instead of doing through RPC, which causes empty devices returned.

      Attachments

        1. image-2022-01-21-14-37-40-581.png
          62 kB
          Eric Pai
        2. image-2022-01-21-14-37-01-639.png
          142 kB
          Eric Pai
        3. image-2022-01-21-14-36-16-250.png
          104 kB
          Eric Pai

        Issue Links

          Activity

            People

              ericpai Eric Pai
              ericpai Eric Pai
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: