XMLWordPrintableJSON

Details

    Description

      Before supporting this feature, we should throw a meaningful exception to prevent data corruption which is caused by

       ALTER TABLE ... SET ('bucket' = '...');
       ALTER TABLE ... RESET ('bucket');

       

      How to reproduce

      -- Suppose we defined a managed table like
      CREATE TABLE IF NOT EXISTS managed_table (
        f0 INT,
        f1 STRING) WITH (
          'path' = '...'
          'bucket' = '3');
      
      -- then write some data
      INSERT INTO managed_table
      VALUES (1, 'Sense and Sensibility),
      (2, 'Pride and Prejudice), 
      (3, 'Emma'), 
      (4, 'Mansfield Park'), 
      (5, 'Northanger Abbey'),
      (6, 'The Mad Woman in the Attic'),
      (7, 'Little Woman');
      
      -- change bucket number
      ALTER TABLE managed_table SET ('bucket' = '5');
      
      -- write some data again
      INSERT INTO managed_table 
      VALUES (1, 'Sense and Sensibility'), 
      (2, 'Pride and Prejudice'), 
      (3, 'Emma'), 
      (4, 'Mansfield Park'), 
      (5, 'Northanger Abbey'), 
      (6, 'The Mad Woman in the Attic'), 
      (7, 'Little Woman'), 
      (8, 'Jane Eyre');
      
      -- change bucket number again
      ALTER TABLE managed_table SET ('bucket' = '1')
      
      -- then write some record with '-D' as rowkind
      -- E.g. changelogRow("-D", 7, "Little Woman"),
      -- changelogRow("-D", 2, "Pride and Prejudice"), 
      -- changelogRow("-D", 3, "Emma"), 
      -- changelogRow("-D", 4, "Mansfield Park"), 
      -- changelogRow("-D", 5, "Northanger Abbey"), 
      -- changelogRow("-D", 6, "The Mad Woman in the Attic"), 
      -- changelogRow("-D", 8, "Jane Eyre"), 
      -- changelogRow("-D", 1, "Sense and Sensibility"), 
      -- changelogRow("-D", 1, "Sense and Sensibility") 
      
      CREATE TABLE helper_source (
        f0 INT, 
        f1 STRING) WITH (
        'connector' = 'values', 
        'data-id' = '${register-id}', 
        'bounded' = 'false', 
        'changelog-mode' = 'I,UA,UB,D'
      ); 
      
      INSERT INTO managed_table SELECT * FROM helper_source;
      
      -- then read the snapshot
      
      SELECT * FROM managed_table
      

      which will get wrong results

      Attachments

        Issue Links

          Activity

            People

              qingyue Jane Chan
              qingyue Jane Chan
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: