Bringing together the Apache Cassandra experts from the community and DataStax.

Want to learn? Have a question? Want to share your expertise? You are in the right place!

Not sure where to begin? Getting Started

 

question

azim_91_184236 avatar image
azim_91_184236 asked ·

Can 2.0 sstables be loaded on a 3.11 cluster with sstableloader?

[FOLLOW UP QUESTION TO #8518]

The approach (using sstableloader to migrate to higher version) should work for source Cassandra C* 2.0.x as well, correct?

sstableloader
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

Erick Ramirez avatar image
Erick Ramirez answered ·

Yes, it is possible for a Cassandra 3.11 sstableloader to read and load 2.0 SSTables to a 3.11 cluster.

As a general rule, Cassandra can read and open SSTables formats in the current version and the previous major version. In your case, Cassandra major version 3.x can read SSTables from major version 2.x.

I've done a quick test by building a C* 2.0.17 cluster and creating a table with the following schema:

CREATE TABLE community.users (
    name text PRIMARY KEY,
    booleancol boolean,
    colour text,
    intcol int
)

and populating it with the following test data:

$ cat users.csv 
name,colour,intcol,booleancol
'alice','red',1,true
'bob','orange',2,false
'cynthia','yellow',3,true
'dan','green',4,false
'echo','blue',5,true
'fox','indigo',6,false
'gabriel','violet',7,true

so I end up with:

[cqlsh 4.1.1 | Cassandra 2.0.17 | CQL spec 3.1.1 | Thrift protocol 19.39.0]
cqlsh> SELECT * FROM community.users ;

 name      | booleancol | colour   | intcol
-----------+------------+----------+--------
 'gabriel' |       True | 'violet' |      7
     'bob' |      False | 'orange' |      2
     'fox' |      False | 'indigo' |      6
    'echo' |       True |   'blue' |      5
   'alice' |       True |    'red' |      1
     'dan' |      False |  'green' |      4
 'cynthia' |       True | 'yellow' |      3

I end up with the following SSTable in the 2.0 -jb- format:

$ ls -1 community/users/
community-users-jb-1-CompressionInfo.db
community-users-jb-1-Data.db
community-users-jb-1-Filter.db
community-users-jb-1-Index.db
community-users-jb-1-Statistics.db
community-users-jb-1-Summary.db
community-users-jb-1-TOC.txt

I loaded this SSTable to a C* 3.11.9 cluster with:

$ cd apache-cassandra-3.11.9
$ bin/sstableloader -d 10.1.2.3 /path/to/community/users/
Established connection to initial hosts
Opening sstables and calculating sections to stream
Streaming relevant part of /home/ubuntu/community/users/community-users-jb-1-Data.db  to [/10.1.2.3]
progress: [/10.1.2.3]0:1/1 100% total: 100% 0.115KiB/s (avg: 0.115KiB/s)
progress: [/10.1.2.3]0:1/1 100% total: 100% 0.000KiB/s (avg: 0.113KiB/s)

Summary statistics: 
   Connections per host    : 1         
   Total files transferred : 1         
   Total bytes transferred : 0.373KiB  
   Total duration          : 3282 ms   
   Average transfer rate   : 0.113KiB/s
   Peak transfer rate      : 0.115KiB/s

I now have the data loaded in the new cluster:

[cqlsh 5.0.1 | Cassandra 3.11.9 | CQL spec 3.4.4 | Native protocol v4]
cqlsh> SELECT * FROM community.users ;

 name      | booleancol | colour   | intcol
-----------+------------+----------+--------
 'gabriel' |       True | 'violet' |      7
     'bob' |      False | 'orange' |      2
     'fox' |      False | 'indigo' |      6
    'echo' |       True |   'blue' |      5
   'alice' |       True |    'red' |      1
     'dan' |      False |  'green' |      4
 'cynthia' |       True | 'yellow' |      3

As always, you need to test exhaustively in your environment since C* 2.0 is no longer supported and loading SSTables from very old version is not part of the normal testing for current releases. Cheers!

Share
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.