Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-35602 [Umbrella] Test Flink Release 1.20
  3. FLINK-35689

Release Testing: Verify FLIP-435 & FLIP-448: Introduce a New Materialized Table for Simplifying Data Pipelines

    XMLWordPrintableJSON

Details

    Description

      Follow up the test for https://issues.apache.org/jira/browse/FLINK-35187, https://issues.apache.org/jira/browse/FLINK-35345

      Materialized Table depends on FLIP-435 & FLIP-448 to complete the end-to-end process, so the Release testing is an overall test of FLIP-435 & FLIP-448 feature at the same time.
      Since Materialized Table depends on CatalogStore, Catalog, Workflow Scheduler, SQL Client, SQL Gateway, and Standalone cluster to go through the whole process, the validation process consists of two parts: Environment Setup and Feature Verification.

      Environment Setup:

      1. create the File CatalogStore directory
      2. Create the test-filesystem Catalog and put flink-table-filesystem-test-utils-1.20-SNAPSHOT.jar into the lib directory.
      3. Create the Savepoint directory.
      4. Configure the Flink config.yaml file.

      #==============================================================================
      # Common
      #==============================================================================
      
      jobmanager: 
        bind-host: localhost
        rpc: 
          address: localhost
          # The RPC port where the JobManager is reachable.
          port: 6123
        memory: 
          process: 
            size: 1600m
        execution: 
          failover-strategy: region
      
      taskmanager: 
        bind-host: localhost
        host: localhost
        # The number of task slots that each TaskManager offers. Each slot runs one parallel pipeline.
        numberOfTaskSlots: 3
        memory: 
          process: 
            size: 1728m
      
      parallelism: 
        # The parallelism used for programs that did not specify and other parallelism.
        default: 1
      
      #==============================================================================
      # Rest & web frontend
      #==============================================================================
      
      rest: 
        # The address to which the REST client will connect to
        address: localhost
        bind-address: localhost
      
      # Catalog Store
      table: 
        catalog-store: 
          kind: file
          file: 
            path: xxx
      
      # Embedded Scheduler config
      workflow-scheduler: 
        type: embedded
      
      # SQL Gateway address
      sql-gateway: 
        endpoint: 
          rest: 
            address: 127.0.0.1
      

      5. Start the Standalone cluster: . /bin/start-cluster.sh
      6. Start the SQL Gateway: . /bin/sql-gateway.sh
      7. Start SQL Client: /bin/sql-client.sh gateway --endpoint http://127.0.0.1:8083
      8. Register the test-filesystem Catalog

      CREATE CATALOG mt_cat
      WITH (
        'type' = 'test-filesystem',
        'path' = '...',
        'default-database' = 'mydb'  
      );
      
      USE CATALOG mt_cat;
      

      9. Create the test-filesystem source table and insert the data

      -- 1. create json format table
      CREATE TABLE json_source (
        order_id BIGINT,
        user_id BIGINT,
        user_name STRING,
        order_created_at STRING,
        payment_amount_cents BIGINT
      ) WITH (
        'format' = 'json',
        'source.monitor-interval' = '5S'
      );
      
      -- 2. insert data
      INSERT INTO mt_cat.mydb.json_source VALUES
      (1001, 1, 'user1', '2024-06-24 10:00:00', 10),
      (1002, 1, 'user2', '2024-06-24 10:01:00', 20),
      (1003, 2, 'user3', '2024-06-24 10:02:00', 30),
      (1004, 2, 'user4', '2024-06-24 10:03:00', 40),
      (1005, 1, 'user1', '2024-06-25 10:00:00', 10),
      (1006, 1, 'user2', '2024-06-25 10:01:00', 20),
      (1007, 2, 'user3', '2024-06-25 10:02:00', 30),
      (1008, 2, 'user4', '2024-06-25 10:03:00', 40);
      
      INSERT INTO mt_cat.mydb.json_source VALUES
      (1001, 1, 'user1', '2024-06-26 10:00:00', 10),
      (1002, 1, 'user2', '2024-06-26 10:01:00', 20),
      (1003, 2, 'user3', '2024-06-26 10:02:00', 30),
      (1004, 2, 'user4', '2024-06-26 10:03:00', 40),
      (1005, 1, 'user1', '2024-06-27 10:00:00', 10),
      (1006, 1, 'user2', '2024-06-27 10:01:00', 20),
      (1007, 2, 'user3', '2024-06-27 10:02:00', 30),
      (1008, 2, 'user4', '2024-06-27 10:03:00', 40);
      

      Feature verification

      Continuous Mode

      In Continuous Mode, Materialized Table runs a Flink streaming job to update the data in real-time. Feature verify includes various scenarios such as Create & Suspend & Resume & Drop.

      1. Create Materialized Table, including various bad cases and good cases, and execute the following statement in the SQL Client

      CREATE MATERIALIZED TABLE continuous_users_shops 
      (
        PRIMARY KEY(id) NOT ENFORCED
      )
      WITH(
        'format' = 'debezium-json'
      )
      FRESHNESS = INTERVAL '30' SECOND
      AS SELECT 
        user_id,
        ds,
        SUM (payment_amount_cents) AS payed_buy_fee_sum,
        SUM (1) AS pv
      FROM (
          SELECT user_id, DATE_FORMAT(order_created_at, 'yyyy-MM-dd') AS ds, payment_amount_cents FROM json_source ) AS tmp
       GROUP BY (user_id, ds);
      

      2. Suspend Materialized Table and execute the following statement in the SQL Client

      ALTER MATERIALIZED TABLE mt_cat.mydb.continuous_users_shops SUSPEND;
      

      3. Resume Materialized Table

      ALTER MATERIALIZED TABLE mt_cat.mydb.continuous_users_shops RESUME;
      

      4. Manual Refresh Materialized Table

      ALTER MATERIALIZED TABLE mt_cat.mydb.continuous_users_shops REFRESH PARTITION(ds = '2024-06-25');
      

      5. Drop Materialized Table

      DROP MATERIALIZED TABLE mt_cat.mydb.continuous_users_shops;
      

      Full Mode

      In Full Mode, Materialized Table needs to rely on Workflow Scheduler to complete the periodic full refresh operation, so the main purpose is to verify the FLIP-448 function.

      1. Create Materialized Table, verify various good and bad cases, and execute the following statement

      CREATE MATERIALIZED TABLE mt_cat.mydb.full_users_shops
      PARTITIONED BY (ds)
      WITH(
        'format' = 'json'
      )
      FRESHNESS = INTERVAL '1' MINUTE
      REFRESH_MODE = FULL
      AS SELECT 
        user_id,
        ds,
        SUM (payment_amount_cents) AS payed_buy_fee_sum,
        SUM (1) AS pv
      FROM (
          SELECT user_id, DATE_FORMAT(order_created_at, 'yyyy-MM-dd') AS ds, payment_amount_cents FROM mt_cat.mydb.json_source ) AS tmp
      GROUP BY (user_id, ds);
      

      2. Suspend Materialized Table by executing the following statement

      ALTER MATERIALIZED TABLE mt_cat.mydb.full_users_shops SUSPEND;
      

      3. Resume Materialized Table and execute the following statement

      ALTER MATERIALIZED TABLE mt_cat.mydb.full_users_shops RESUME;
      

      4. Drop Materialized Table and execute the following statement

      DROP MATERIALIZED TABLE mt_cat.mydb.full_users_shops;
      
      DROP MATERIALIZED TABLE IF EXISTS mt_cat.mydb.full_users_shops;
      

      Attachments

        1. image-2024-06-25-12-00-07-616.png
          499 kB
          dalongliu
        2. image-2024-06-25-12-01-09-648.png
          482 kB
          dalongliu
        3. image-2024-06-25-12-02-08-558.png
          421 kB
          dalongliu
        4. image-2024-06-25-12-02-51-615.png
          415 kB
          dalongliu
        5. image-2024-06-25-12-03-20-930.png
          412 kB
          dalongliu
        6. image-2024-06-25-12-04-24-948.png
          769 kB
          dalongliu
        7. image-2024-06-25-12-05-39-089.png
          588 kB
          dalongliu
        8. image-2024-06-25-12-05-54-104.png
          1.24 MB
          dalongliu
        9. image-2024-06-25-12-07-52-182.png
          143 kB
          dalongliu
        10. image-2024-06-25-12-09-11-207.png
          148 kB
          dalongliu
        11. image-2024-06-25-12-09-22-879.png
          801 kB
          dalongliu
        12. image-2024-06-25-12-11-08-720.png
          176 kB
          dalongliu
        13. image-2024-06-25-12-13-47-363.png
          1.06 MB
          dalongliu
        14. image-2024-06-25-12-14-13-107.png
          2.35 MB
          dalongliu
        15. image-2024-06-25-12-15-03-493.png
          129 kB
          dalongliu
        16. image-2024-06-25-12-16-47-160.png
          72 kB
          dalongliu
        17. image-2024-06-25-12-16-57-076.png
          247 kB
          dalongliu
        18. image-2024-06-25-12-18-12-506.png
          233 kB
          dalongliu
        19. image-2024-06-25-13-38-47-663.png
          246 kB
          dalongliu
        20. image-2024-06-25-13-39-44-790.png
          193 kB
          dalongliu
        21. image-2024-06-25-13-39-56-133.png
          989 kB
          dalongliu
        22. image-2024-06-25-13-43-10-439.png
          182 kB
          dalongliu
        23. image-2024-06-25-13-43-22-548.png
          1.04 MB
          dalongliu
        24. image-2024-06-25-13-44-07-669.png
          234 kB
          dalongliu
        25. screenshot-1.png
          523 kB
          dalongliu
        26. screenshot-10.png
          88 kB
          dalongliu
        27. screenshot-11.png
          130 kB
          dalongliu
        28. screenshot-12.png
          1.33 MB
          dalongliu
        29. screenshot-13.png
          1.03 MB
          dalongliu
        30. screenshot-14.png
          1.26 MB
          dalongliu
        31. screenshot-15.png
          478 kB
          dalongliu
        32. screenshot-16.png
          169 kB
          dalongliu
        33. screenshot-2.png
          461 kB
          dalongliu
        34. screenshot-3.png
          500 kB
          dalongliu
        35. screenshot-4.png
          461 kB
          dalongliu
        36. screenshot-5.png
          822 kB
          dalongliu
        37. screenshot-6.png
          498 kB
          dalongliu
        38. screenshot-7.png
          198 kB
          dalongliu
        39. screenshot-8.png
          872 kB
          dalongliu
        40. screenshot-9.png
          208 kB
          dalongliu

        Issue Links

          Activity

            People

              lsy dalongliu
              lsy dalongliu
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: