Nodetool refresh claims TOC is empty, but it's not

Installation details
#ScyllaDB version: 2024.2.9-0.20250423.9aa1f3a492bc
#Cluster size: 1
os (RHEL/CentOS/Ubuntu/AWS AMI): Ubuntu

Hello all

Trying to load some SSTables using nodetool refresh gibing me the following error:

sstables::malformed_sstable_exception (Empty TOC in sstable /var/lib/scylla/data/edm/zeitreihe-f4e0fec02f3a11f0a243ef45d6d60258/upload/mc-855-big-TOC.txt in sstable /var/lib/scylla/data/edm/zeitreihe-f4e0fec02f3a11f0a243ef45d6d60258/upload/mc-855-big-TOC.txt)

The content of the file mc-855-big-TOC.txt is:

TOC.txt
Summary.db
Index.db
CompressionInfo.db
Filter.db
Data.db
Digest.crc32
Statistics.db

Relevant code is in sstables.cc line from 815:

future<> sstable::read_toc() noexcept {
    if (_recognized_components.size()) {
        co_return;
    }

    try {
        co_await do_read_simple(component_type::TOC, [&] (version_types v, file f) -> future<> {
            auto comps = co_await read_and_parse_toc(f);
            for (auto& c: comps) {
                // accept trailing newlines
                if (c == "") {
                    continue;
                }
                try {
                    _recognized_components.insert(reverse_map(c, sstable_version_constants::get_component_map(_version)));
                } catch (std::out_of_range& oor) {
                    _unrecognized_components.push_back(c);
                    sstlog.info("Unrecognized TOC component was found: {} in sstable {}", c, toc_filename());
                }
            }
            if (!_recognized_components.size()) {
                throw malformed_sstable_exception("Empty TOC", toc_filename());
            }
        });
    } catch (std::system_error& e) {
        if (e.code() == std::error_code(ENOENT, std::system_category())) {
            throw malformed_sstable_exception(fmt::format("{}: file not found", toc_filename()));
        }
        throw;
    }
}

Anyone can help?

Thanks a lot.

daprodigy

Hey @daprodigy,

The TOC file looks alright. Did anyone edit this file manually?
The only potential problem I see now is that the file is parsed with “\n” as line terminator and maybe that’s not the case with your file.

Also, do you see any “Unrecognized TOC component was found:” info logs?

Cheers,
Robert

1 Like

Hello @robertbindar

You were exactly right. The backup was comming from a Windows System. So the line endings are CR+LF. After eliminating the CRs from the file, the import could be processed without a problem.

Thank you very much.

daprodigy

1 Like

@daprodigy nice, I’m glad you fixed the issue!

1 Like