Uploaded image for project: 'Cassandra'
  1. Cassandra
  2. CASSANDRA-15021

TestBootstrapAfterUpgrade.test_upgrade_with_range_tombstone_eoc_0 upgrade test is failing with TypeError

    XMLWordPrintableJSON

Details

    • Correctness - Test Failure
    • Low

    Description

      While running upgrade tests for 3.11.4 candidate I noticed that upgrade_tests.storage_engine_upgrade_test.TestBootstrapAfterUpgrade.test_upgrade_with_range_tombstone_eoc_0 is failing with TypeError.

      Example run with error:

      self = <upgrade_tests.storage_engine_upgrade_test.TestBootstrapAfterUpgrade object at 0x7f8db9908240>
      
          @since('3.0', max_version='3.99')
          def test_upgrade_with_range_tombstone_eoc_0(self):
              """
                  Check sstable upgrading when the sstable contains a range tombstone with EOC=0.
          
                  @jira_ticket CASSANDRA-12423
                  """
              session = self._setup_cluster(cluster_options={'start_rpc': 'true'})
          
              session.execute("CREATE TABLE rt (id INT, c1 TEXT, c2 TEXT, v INT, PRIMARY KEY (id, c1, c2)) "
                              "with compact storage and compression = {'sstable_compression': ''};")
          
              range_delete = {
                  i32(1): {
                      'rt': [Mutation(deletion=Deletion(2470761440040513,
                                                        predicate=SlicePredicate(slice_range=SliceRange(
      >                                                     start=composite('a', eoc='\x00'),
                                                            finish=composite('asd', eoc='\x00')))))]
                  }
              }
      
      upgrade_tests/storage_engine_upgrade_test.py:434: 
      _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
      
      item1 = b'a', item2 = None, eoc = '\x00'
      
          def composite(item1, item2=None, eoc=b'\x00'):
              if isinstance(item1, str):
                  item1 = utf8encode(item1)
              if isinstance(item2, str):
                  item2 = utf8encode(item2)
          
      >       packed = _i16(len(item1)) + item1 + eoc
      E       TypeError: can't concat str to bytes
      
      thrift_test.py:153: TypeError
      

      This TypeError is from Python3 migration. Python 3's standard string type is Unicode based, and Python 3 adds a dedicated bytes type, but critically, no automatic coercion between bytes and unicode strings is provided - context

      This change in python3 is leading to "TypeError: can't concat str to bytes" while appending bytes to string.

      Attachments

        Activity

          People

            vinaykumarcse Vinay Chella
            vinaykumarcse Vinay Chella
            Vinay Chella
            Ariel Weisberg
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: