When trying to replace a dead node, the replacement node fails after a long time with an OOM error. I believe the issue is linked to secondary indexes on a table. I can see that on the new nodes /var/lib/cassandra/<keyspace>/<table>/.<secondary_index>
directory that there are hundreds of thousands of files. To make matters worse, there are a couple of secondary indexes. I've tried increasing node memory/heap, but it doesn't seem to matter, the node will not come online. At this point the failed node has been offline for longer than gc_grace_time
.
If I run nodetool removenode
, will this same issue get spread to other nodes?
If I add a new node, run nodetool assasinate
, then repair, will it spread this issue to other nodes?
Thoughts on how best to get a replacement node into the cluster and operational?
I'm sure there are design issues with the DB structure - that is out of my control. I'm simply trying to help a team get their cluster back fully operational.
Update with more info: The old node failed during a repair, and would not come online due to a too many open files error. The configured open files on the host is already at the linux/OS MAX per best practice.
At that point, we attempted to start a replacement node (empty data dirs) with the JVM replace_address_first_boot setting. This did work and a new node came online, but there was a repair job on a large table with secondary indexes that never progressed (see above regarding hundreds of thousands of files present). The repair progress stayed at 0 and eventually java crashed with an OOM error.
We then truncated this table as it wasn't needed for this particular keyspace. At this point the "new" node is in the cluster but down. We then tried to replace the replaced node with the replace_address_first_boot setting, using the original IP (wiped data dirs), and it's failing to come online. It will startup and stream data from the other nodes for ~20 hours, then slow to a crawl as it writes hundreds of thousands of files for the same table in another keyspace (one we cannot drop/truncate), before eventually going OOM with an OOM:
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (malloc) failed to allocate 4088 bytes for AllocateHeap
# Possible reasons:
# The system is out of physical RAM or swap space
# Possible solutions:
# Reduce memory load on the system
# Increase physical memory or swap space
# Check if swap backing store is full
# Decrease Java heap size (-Xmx/-Xms)
# Decrease number of Java threads
# Decrease Java thread stack sizes (-Xss)
# Set larger code cache with -XX:ReservedCodeCacheSize=
# This output file may be truncated or incomplete.
#
# Out of Memory Error (allocation.inline.hpp:61), pid=31868, tid=0x00007f2297272700
The nodes are 80Gb memory w/40Gb heap using the defaults for G1GC. We've tried increase memory up to 128Gb (leaving heap alone), with no change.
It feels like it may be best to assasinate this node and simply add a new node. This will require running repairs across all keyspaces from my understanding? As the original issue started with a repair (after deleting a bunch of data), the concern is that we don't want to introduce further issues into the database.