Search code examples
cassandracassandra-4.0

Setting memtable properties returns ConfigurationException, "Invalid yaml" due to ParserException


How can I update memtable size in Cassandra 4.1.2?

In cassandra.yaml I update value for key memtable_heap_space: 5000 and memtable_offheap_space: 5000 and restart cassandra service. I got Exception while restart. Exception Image .


Solution

  • YAML is a data serialisation language commonly used for configuration files. Similar to Python, indentation is important since it is used to determine the structure of the data, with nested data indicating hierarchy.

    If you incorrectly nest (indent) the lines with either missing or extra spaces, it makes the YAML invalid and the YAML parser won't be able to read it properly.

    In your case, the exception shows that the parser failed on line 616 of the cassandra.yaml because it was expecting the nested block to end but got a block "start" because of the extra space at the start of the line:

    ...
    Caused by: org.yaml.snakeyaml.parser.ParserException: while parsing a block mapping
     ...
    expected <block end>, but found '<block mapping start>'
     in 'reader', line 616, column 2:
         memtable_heap_space: 5000
         ^
     ...
    

    If you remove the space ( ) at the start of the line, it should resolve the problem.

    You should always check that entries in cassandra.yaml are formatted correctly or Cassandra will fail to start. Cheers!