You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Michael Semb Wever (Jira)" <ji...@apache.org> on 2026/08/26 14:40:00 UTC

[jira] [Created] (CASSANDRA-21612) Compile the sstable component type patterns once

Michael Semb Wever created CASSANDRA-21612:
----------------------------------------------

             Summary: Compile the sstable component type patterns once
                 Key: CASSANDRA-21612
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-21612
             Project: Apache Cassandra
          Issue Type: Improvement
          Components: Local/SSTable
            Reporter: Michael Semb Wever
            Assignee: Michael Semb Wever


{{Component.Type.fromRepresentation}} walks every registered type and calls {{Pattern.matches}}:

{code:java}
for (Type type : Type.all)
{
    if (type.repr != null && Pattern.matches(type.repr, repr) && type.formatClass.isAssignableFrom(format.getClass()))
        return type;
}
{code}

{{Pattern.matches}} compiles its regular expression on every call, so each filename parsed compiles up to a dozen patterns. {{Component.parse}} runs for every component file the node lists, which makes startup and every sstable directory scan pay the cost.

The patch compiles the pattern once in the {{Type}} constructor and matches against the compiled pattern. Behaviour is unchanged.

Patch: [mck/upstream/component-type-pattern/trunk|https://github.com/thelastpickle/cassandra/tree/mck/upstream/component-type-pattern/trunk]
Provenance: [8f54f6ad93|https://github.com/datastax/cassandra/commit/8f54f6ad93ac3470e0eeff694575c08403cd972a] by Kamil Leśniak



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org