Skip to content

Conversation

@ginolzh
Copy link
Contributor

@ginolzh ginolzh commented Aug 16, 2018

There is a logging statement that is able to catch two exception types (FileNotFoundException or NoSuchFileException) but cannot distinguish which type of exception occurred just base on the log message. Maybe adding a stack trace could help.

@dnhatn dnhatn added the :Distributed Indexing/Store Issues around managing unopened Lucene indices. If it touches Store.java, this is a likely label. label Aug 16, 2018
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-distributed

Copy link
Member

@dnhatn dnhatn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@elasticmachine test this please.

@jasontedor
Copy link
Member

Yet these two exceptions represent the same failure: a file that is not found?

@ginolzh
Copy link
Contributor Author

ginolzh commented Aug 16, 2018

Maybe there're some slight differences between these two exceptions, according to the java documentation it describes FileNotFoundException as:
"This exception will be thrown by the FileInputStream, FileOutputStream, and RandomAccessFile constructors when a file with the specified pathname does not exist. It will also be thrown by these constructors if the file does exist but for some reason is inaccessible, for example when an attempt is made to open a read-only file for writing."

And for NoSuchFileException it is: "Checked exception thrown when an attempt is made to access a file that does not exist."

@bleskes
Copy link
Contributor

bleskes commented Sep 9, 2018

@jasontedor anything you want done here?

Copy link
Contributor

@ywelsch ywelsch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. While logging the exception, we also get info about the file that's missing. Given that this should very rarely happen, I think it's ok having the stack trace.

@ywelsch
Copy link
Contributor

ywelsch commented Mar 11, 2019

@elasticmachine test this please

@ywelsch ywelsch changed the title Add stack trace to a logging statement Log missing file exception when failing to read metadata snapshot Mar 12, 2019
@ywelsch ywelsch merged commit fe405bd into elastic:master Mar 12, 2019
ywelsch pushed a commit that referenced this pull request Mar 12, 2019
…2920)

Adds the exception to the logged output, which contains info about the file that's missing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Distributed Indexing/Store Issues around managing unopened Lucene indices. If it touches Store.java, this is a likely label. >enhancement v7.2.0 v8.0.0-alpha1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants