in ccmlib/node.py [0:0]
def clear(self, clear_all=False, only_data=False):
data_dirs = ['data{0}'.format(x) for x in xrange(0, self.cluster.data_dir_count)]
data_dirs.append("commitlogs")
if clear_all:
data_dirs.extend(['saved_caches', 'logs'])
for d in data_dirs:
full_dir = os.path.join(self.get_path(), d)
if only_data and d != "commitlogs":
for dir in os.listdir(full_dir):
keyspace_dir = os.path.join(full_dir, dir)
if os.path.isdir(keyspace_dir) and dir != "system" and dir != "system_cluster_metadata":
for f in os.listdir(keyspace_dir):
table_dir = os.path.join(keyspace_dir, f)
shutil.rmtree(table_dir)
os.mkdir(table_dir)
else:
common.rmdirs(full_dir)
os.mkdir(full_dir)
# Needed for any subdirs stored underneath a data directory.
# Common for hints post CASSANDRA-6230
for dir in self._get_directories():
if not os.path.exists(dir):
os.mkdir(dir)