Michael Semb Wever created CASSANDRA-21614:
----------------------------------------------

             Summary: Hold the file move options in constants
                 Key: CASSANDRA-21614
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-21614
             Project: Apache Cassandra
          Issue Type: Improvement
          Components: Local/Other
            Reporter: Michael Semb Wever
            Assignee: Michael Semb Wever


{{PathUtils.atomicMoveWithFallback}} passes its copy options as varargs:

{code:java}
Files.move(from, to, StandardCopyOption.REPLACE_EXISTING, 
StandardCopyOption.ATOMIC_MOVE);
{code}

Every call allocates a {{CopyOption}} array, and the 
{{AtomicMoveNotSupportedException}} fallback allocates a second one. Renames 
run once per sstable component. Profiling on a file cache preload in the 
DataStax fork showed the method as an allocation hotspot.

The patch holds the two option arrays in static constants, as {{PathUtils}} 
already does for its open options and for {{NO_ATTRIBUTES}}.

Patch: 
[mck/upstream/pathutils-copyoptions/trunk|https://github.com/thelastpickle/cassandra/tree/mck/upstream/pathutils-copyoptions/trunk]
Provenance: 
[82818025f3|https://github.com/datastax/cassandra/commit/82818025f34eb2cfb053e5dd14d8c3bbfc465526]
 by Kamil Leśniak



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to