[ https://issues.apache.org/jira/browse/SOLR-10719?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16025518#comment-16025518 ]
Erick Erickson edited comment on SOLR-10719 at 5/25/17 11:00 PM: ----------------------------------------------------------------- This is actually a bit weirder. Files.createDirectories _does_ succeed if you specify a subdir of the symlink. So if sym -> dir1 and I ask CreateDirectories to create sym/eoe1/eoe2/eoe3 all the directories are created just fine. But when core.properties is being written, it wants to write to sym/core.properties and the createDirectories fails on creating sym as it's a symlink. I see multiple places in the code where we call Files.createDirectories, even some tagged with //note, this will fail if this is a symlink All in all, symlinks are going to be a problem in several places in the code. So I'm thinking of providing a method in FileUtils to deal with this kind of thing that would then be available for other users as appropriate. Oh, and I'm _not_ suggesting that we make this a blanket change as I'm not sure these other places _should_ be changed. was (Author: erickerickson): This is actually a bit weirder. Files.createDirectories _does_ succeed if you specify a subdir of the symlink. So if sym -> dir1 and I ask CreateDirectories to create sym/eoe1/eoe2/eoe3 all the directories are created just fine. But when core.properties is being written, it wants to write to sym/core.properties and the createDirectories fails on creating sym as it's a symlink. I see multiple places in the code where we call Files.createDirectories, even some tagged with //note, this will fail if this is a symlink All in all, symlinks are going to be a problem in several places in the code. So I'm thinking of providing a method in FileUtils to deal with this kind of thing that would then be available for other users as appropriate > ADDREPLICA fails if the instanceDir is a symlink > ------------------------------------------------ > > Key: SOLR-10719 > URL: https://issues.apache.org/jira/browse/SOLR-10719 > Project: Solr > Issue Type: Bug > Security Level: Public(Default Security Level. Issues are Public) > Reporter: Erick Erickson > Assignee: Erick Erickson > > Well, it doesn't actually fail until you try to restart the Solr instance. > The root is that creating core.properties fails. > This is due to SOLR-8260. CorePropertiesLocator.writePropertiesFile changed > from: > propfile.getParentFile().mkdirs(); > to > Files.createDirectories(propfile.getParent()); > The former (apparently) thinks it's OK if a symlink points to a directory, > but the latter throws an exception. > So the behavior here is that the call appears to succeed, the replica is > created and is functional. Until you restart the instance when it's not > discovered. > I hacked in a simple test to see if the parent existed already and skip the > call to createDirectories if so and ADDREPLICA works just fine. Restarting > Solr finds the replica. > The test "for real" would probably have to be better than this as we probably > really want to keep from overwriting an existing replica and the like, didn't > check whether that's already accounted for though. > There's another issue here that failing to write the properties file should > fail the ADDREPLICA IMO. > [~romseygeek] I'm guessing that this is an unintended side-effect of > SOLR-8260 but wanted to check before diving in deeper. -- This message was sent by Atlassian JIRA (v6.3.15#6346) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org