[
https://issues.apache.org/jira/browse/LUCENE-5951?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14250327#comment-14250327
]
Hoss Man commented on LUCENE-5951:
----------------------------------
{noformat}
+ for (FileStore store : FileSystems.getDefault().getFileStores()) {
+ String desc = store.toString();
+ int start = desc.lastIndexOf('(');
+ int end = desc.indexOf(')', start);
+ mountToDevice.put(desc.substring(0, start-1), desc.substring(start+1,
end));
+ }
{noformat}
...I don't see anything in the javadocs for FileStore making any guarantees
about the toString -- so the results of these lastIndexOf and indexOf calls
should probably have bounds checks to prevent IOOBE from substring. (either
that or just catch the IOOBE and give up)
{noformat}
+ if (!devName.isEmpty() &&
Character.isDigit(devName.charAt(devName.length()-1))) {
+ devName = devName.substring(0, devName.length()-1);
{noformat}
...what about people with lots of partitions? ie: "/dev/sda42"
> Detect when index is on SSD and set dynamic defaults
> ----------------------------------------------------
>
> Key: LUCENE-5951
> URL: https://issues.apache.org/jira/browse/LUCENE-5951
> Project: Lucene - Core
> Issue Type: Improvement
> Reporter: Michael McCandless
> Assignee: Michael McCandless
> Attachments: LUCENE-5951.patch, LUCENE-5951.patch, LUCENE-5951.patch,
> LUCENE-5951.patch, LUCENE-5951.patch
>
>
> E.g. ConcurrentMergeScheduler should default maxMergeThreads to 3 if it's on
> SSD and 1 if it's on spinning disks.
> I think the new NIO2 APIs can let us figure out which device we are mounted
> on, and from there maybe we can do os-specific stuff e.g. look at
> /sys/block/dev/queue/rotational to see if it's spinning storage or not ...
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]