Reputation: 1865
I need to find out how cqlsh does the autocomplete because I want to include a custom compaction strategy in the autocomplete for the create table statement. I usually do this by putting a breakpoint somewhere in the code and then following the flow. But I'm not sure how to do this with cqlsh since I don't see the main method. How can I debug cqlsh to better understand where I need to implement this? Probably not relevant, but I'm using v3.11.
Upvotes: 1
Views: 1708
Reputation: 11
cqlsh command have option --debug that help you to debug it in detail and get more verbose information.
Upvotes: 1
Reputation: 108
cqlsh:demo> TRACING ON
Now Tracing is enabled
sometimes this level of logging is sufficient in debugging.
Upvotes: -1
Reputation: 12850
Cqlsh is a python tool, It located at $CASSANDRA_HOME/bin/cqlsh.py
If you want to add custom compaction strategy to cqlsh, you have to edit it's dependency file located at $CASSANDRA_HOME//pylib/cqlshlib/cqlhandling.py
Find the available_compaction_classes
field and add yours.
available_compaction_classes = (
'LeveledCompactionStrategy',
'SizeTieredCompactionStrategy',
'DateTieredCompactionStrategy',
'TimeWindowCompactionStrategy',
'MyCompactionStrategy'
)
Here i have added MyCompactionStrategy
.
Now save the changes and relogin, you will get autocomplete for compaction
cassandra@cqlsh:titan> CREATE TABLE test (id int primary key, data text) WITH compaction = {'class': '
DateTieredCompactionStrategy LeveledCompactionStrategy MyCompactionStrategy SizeTieredCompactionStrategy TimeWindowCompactionStrategy
Upvotes: 2
Reputation: 573
cqlsh is written using python, hence you can use any python editor to debug the code. One such python editor which I'm using is JetBrains PyCharm You can open the cqlsh.py script from "Cassandra installed directory\bin" in this editor and run the cqlsh.py in debug mode. While running/debugging use the console view to give the input. By the way I am using PyCharm.
Upvotes: 2