VISHNU
VISHNU

Reputation: 13

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 .

Upvotes: 1

Views: 75

Answers (2)

Erick Ramirez
Erick Ramirez

Reputation: 16313

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!

Upvotes: 0

Aaron
Aaron

Reputation: 57748

The error you posted in the image indicates that the YAML file is improperly formatted. As memtable_heap_space and memtable_offheap_space are commented out by default, it looks (to me) like you may have an extra space before each of those properties. That's not valid for the YAML format.

In my example below, you can see that memtable_heap_space is formatted correctly, while memtable_offheap_space is not.

# Min unit: MiB
memtable_heap_space: 2048MiB
# Min unit: MiB
 memtable_offheap_space: 2048MiB

Also note that these properties are in MiB. If the desired outcome is to increase memtable usage in GiBs, you'll want to make sure those are multiples of 1024 and not 1000:

5000 MiB = 4.883 GiB
5120 MiB = 5.0 GiB

Upvotes: 1

Related Questions