-
Notifications
You must be signed in to change notification settings - Fork 345
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mdfind takes multiple minutes if a NTFS bootcamp volume is mounted #48
Comments
From rrmiddleton@gmail.com on November 26, 2010 23:31:22 Labels: -Type-Defect -Priority-Medium Type-Enhancement Priority-Low |
From rrmiddleton@gmail.com on November 26, 2010 23:34:10 I am happy to make this change after receiving input from others on the idea. This probably won't help any speed problems people using read-only NFS automounts might be having (though it could if these were all in a top-directory location easy to exclude before running mdfind). |
From rrmiddleton@gmail.com on November 27, 2010 00:41:48 Test code below (replaces munkicommon.getSpotlightInstalledApplications). It provides a massive speedup on my test computer with bootcamp - from over 2 minutes to under 5 seconds for the entire getAppData routine. On another test computer without the bootcamp problem I am seeing this modified function slow things down a little more than expected (from sub 1 second to about 4 seconds to execute; the mdfind specifically on the /Applications directory is slower than the same mdfind on the entire computer). ie: it does have some performance hit for computers not experiencing the problem; however that performance hit is only a few seconds. def mdfindAppsInDir(directory,applist):
def getSpotlightInstalledApplications():
|
From rrmiddleton@gmail.com on November 27, 2010 00:43:05 Status: Started |
From jr...@google.com on December 06, 2010 13:48:43 overall I'm semi OK with this. I had hoped to eventually widen the removal of /Volumes from mdfind output, and only remove if they are network paths. Local disks should still be under consideration. be careful to use munkicommon.listdir() instead of os.listdir(), and while we're in here we should decode utf-8 output from mdfind into unicode objects. |
From gregnea...@mac.com on December 06, 2010 13:58:01 There's no one perfect answer for this problem; it may be specific to each deployment. |
From rrmiddleton@gmail.com on December 06, 2010 14:05:57 munkicommon.isExcludedFilesystem suits me well enough for the filesystems to be excluded. NFS or read-only get excluded (not sure what it does to AFP / SMB mounts). I would be happy to walk into Volumes as well, and only run the mdfind function on directories within that return false for isExcludedFilesystem. For my site walking into Volumes is unnecessary (but doesn't hurt either). Most computers have only one drive, some have more but in no standard way / not named the same thing. Managed applications will always be installed on the boot drive here. |
From rrmiddleton@gmail.com on December 08, 2010 01:00:42 Any thoughts on making the spotlight call from within python itself? I presume this starts up a thread that we don't really want to start up ... This code:
Oddly I'm noticing that on one of my systems with bootcamp I get the multi-minute delay, while on another spotlight appears to entirely ignore the read-only NTFS volume with bootcamp on it (and thus returns quickly). Perhaps slightly different builds of 10.6.5 (one is a MBAir). from Foundation import NSMetadataQuery, NSPredicate, NSRunLoop, NSDate def findAppsInDirs(dirlist,applist):
def getSpotlightInstalledApplications():
|
From gregnea...@mac.com on December 08, 2010 10:51:29 I think calling Spotlight via the API sounds great. I have two concerns:
|
From rrmiddleton@gmail.com on December 09, 2010 03:41:59 "1) Is NSRunLoop available at all times to a running Python script? I thought that required an application object..." "2) I'm not clear what you mean when you said "Oddly I'm noticing that on one of my systems with bootcamp I get the multi-minute delay" -- do you mean you get the delay even if you call Spotlight specifically excluding the NTFS filesystem?" I'm happy with the code below now, probably can commit the changes. Note: not tested on 10.5 yet (have few 10.5 computers left, and am upgrading them to 10.6 before installing munki). This change does change behaviour in terms of what is included / excluded. The unchanged LaunchServices code appears to find applications anywhere on the boot drive - including in user homes, these are later excluded in updatecheck. The changed Spotlight code:
from Foundation import NSDate, NSMetadataQuery, NSPredicate, NSRunLoop def findAppsInDirs(dirlist):
def getSpotlightInstalledApplications():
|
From rrmiddleton@gmail.com on January 30, 2011 15:46:51 Committed in r1003 . Closing issue. Further discussions still to be had on why we care if we find an app in a non-default location, and what we should do about it. Status: Verified |
From rrmiddleton@gmail.com on November 26, 2010 23:30:36
Relating to:
munkicommon.getSpotlightInstalledApplications()
** What steps will reproduce the problem?
0. Need a computer with a bootcamp partition
** What is the expected output? What do you see instead?
On my MBAir:
Spotlight can't do its thing on a read-only volume, but will still try to search it!
** Possible fix:
Reimplement:
munkicommon.getSpotlightInstalledApplications()
as a loop over the '/' directory:
/usr/bin/mdfind -onlyin /Applications
/usr/bin/mdfind -onlyin /Library
/usr/bin/mdfind -onlyin /Users
/usr/bin/mdfind -onlyin /System
... etc ...
deliberately skipping /Volumes at the stage of mdfind rather than as a post-processing exclusion.
** Why a problem:
Original issue: http://code.google.com/p/munki/issues/detail?id=48
The text was updated successfully, but these errors were encountered: