Internal help: Refactor detailed db/index stats

master
François-Xavier Thomas 5 years ago committed by jvoisin
parent 9d3ec88796
commit 6c54f1f7c8
  1. 68
      airsonic-main/src/main/java/org/airsonic/player/controller/InternalHelpController.java
  2. 16
      airsonic-main/src/main/resources/org/airsonic/player/i18n/ResourceBundle_en.properties
  3. 43
      airsonic-main/src/main/webapp/WEB-INF/jsp/internalhelp.jsp

@ -68,6 +68,36 @@ public class InternalHelpController {
private static final int LOG_LINES_TO_SHOW = 50;
public class IndexStatistics {
private String name;
private int count;
private int deletedCount;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
public int getDeletedCount() {
return deletedCount;
}
public void setDeletedCount(int deletedCount) {
this.deletedCount = deletedCount;
}
}
public class FileStatistics {
private String name;
private String path;
@ -225,36 +255,20 @@ public class InternalHelpController {
}
private void gatherIndexInfo(Map<String, Object> map) {
try (IndexReader reader = indexManager.getSearcher(IndexType.SONG).getIndexReader()) {
map.put("indexSongCount", reader.numDocs());
map.put("indexSongDeletedCount", reader.numDeletedDocs());
} catch (IOException e) {
LOG.debug("Unable to gather information", e);
}
try (IndexReader reader = indexManager.getSearcher(IndexType.ALBUM).getIndexReader()) {
map.put("indexAlbumCount", reader.numDocs());
map.put("indexAlbumDeletedCount", reader.numDeletedDocs());
} catch (IOException e) {
LOG.debug("Unable to gather information", e);
}
try (IndexReader reader = indexManager.getSearcher(IndexType.ARTIST).getIndexReader()) {
map.put("indexArtistCount", reader.numDocs());
map.put("indexArtistDeletedCount", reader.numDeletedDocs());
} catch (IOException e) {
LOG.debug("Unable to gather information", e);
}
try (IndexReader reader = indexManager.getSearcher(IndexType.ALBUM_ID3).getIndexReader()) {
map.put("indexAlbumId3Count", reader.numDocs());
map.put("indexAlbumId3DeletedCount", reader.numDeletedDocs());
SortedMap<String, IndexStatistics> indexStats = new TreeMap<>();
for (IndexType indexType : IndexType.values()) {
try (IndexReader reader = indexManager.getSearcher(indexType).getIndexReader()) {
IndexStatistics stat = new IndexStatistics();
stat.setName(indexType.name());
stat.setCount(reader.numDocs());
stat.setDeletedCount(reader.numDeletedDocs());
indexStats.put(indexType.name(), stat);
} catch (IOException e) {
LOG.debug("Unable to gather information", e);
LOG.debug("Unable to gather information about {} index", indexType.name(), e);
}
try (IndexReader reader = indexManager.getSearcher(IndexType.ARTIST_ID3).getIndexReader()) {
map.put("indexArtistId3Count", reader.numDocs());
map.put("indexArtistId3DeletedCount", reader.numDeletedDocs());
} catch (IOException e) {
LOG.debug("Unable to gather information", e);
}
map.put("indexStatistics", indexStats);
try (Analyzer analyzer = analyzerFactory.getAnalyzer()) {
map.put("indexLuceneVersion", analyzer.getVersion().toString());
} catch (IOException e) {

@ -263,11 +263,13 @@ upload.failed=Uploading failed with the following error:<br><b>"{0}"</b>
upload.unzipped=Unzipped {0}
internalhelp.title=About {0} Internals
internalhelp.details=Internal details
internalhelp.details=Internal Details
internalhelp.statistics=Statistics
internalhelp.database=Database
internalhelp.databasedetails=Database Details
internalhelp.databaseconsistency=Database Consistency
internalhelp.index=Search Index
internalhelp.indexdetails=Search Index Details
internalhelp.filesystem=Filesystem
internalhelp.transcoding=Transcoding
internalhelp.musicfolders=Music Folders
@ -287,22 +289,18 @@ internalhelp.lastscandate=Last scan date
internalhelp.totaldurationseconds=Total duration (s)
internalhelp.totalsizebytes=Total size (bytes)
internalhelp.luceneversion=Lucene version
internalhelp.albumcount=Album count
internalhelp.artistcount=Artist count
internalhelp.songcount=Song count
internalhelp.indexcount=Index "{0}" count
internalhelp.indexdeletedcount=Index "{0}" deleted count
internalhelp.musiccount=Music file count
internalhelp.podcastcount=Podcast count
internalhelp.directorycount=Directory count
internalhelp.artistid3count=Artist (ID3) count
internalhelp.albumid3count=Album (ID3) count
internalhelp.songdeletedcount=Deleted song count
internalhelp.albumcount=Album count
internalhelp.musicdeletedcount=Deleted music file count
internalhelp.podcastdeletedcount=Deleted podcast count
internalhelp.directorydeletedcount=Deleted directory count
internalhelp.albumdeletedcount=Deleted album count
internalhelp.artistdeletedcount=Deleted artist count
internalhelp.artistid3deletedcount=Deleted artist (ID3) count
internalhelp.albumid3deletedcount=Deleted album (ID3) count
internalhelp.distinctalbumcount=Distinct album count
internalhelp.distinctartistcount=Distinct artist count
internalhelp.distinctalbumartistcount=Distinct album artist count
@ -314,7 +312,7 @@ internalhelp.dbdirectorysize=Size of the internal database directory
internalhelp.dblogsize=Size of the internal database log
internalhelp.dblogsize.ok=The size of the database log file (db/airsonic.log) appears healthy.
internalhelp.dblogsize.warn=The size of the database log file (db/airsonic.log) is large (greater than 256M). Run a scan to clean it up.
internalhelp.tablecount={0} row count
internalhelp.tablecount=Table "{0}" count
internalhelp.mediafilesinnonpresentmusicfoldercount=Nubmer of media files in non-present music folders
internalhelp.mediafilesinnonpresentmusicfoldercount.ok=All media files in the database have a valid music folder.
internalhelp.mediafilesinnonpresentmusicfoldercount.warn=The media file database contains files whose music folder is no longer present. Examples are below.

@ -71,16 +71,6 @@
<table width="75%" class="ruleTable indent">
<tr><td class="ruleTableHeader"><fmt:message key="internalhelp.luceneversion"/></td><td class="ruleTableCell">${model.indexLuceneVersion}</td></tr>
<tr><td class="ruleTableHeader"><fmt:message key="internalhelp.songdeletedcount"/></td><td class="ruleTableCell">${model.indexSongDeletedCount}</td></tr>
<tr><td class="ruleTableHeader"><fmt:message key="internalhelp.albumdeletedcount"/></td><td class="ruleTableCell">${model.indexAlbumDeletedCount}</td></tr>
<tr><td class="ruleTableHeader"><fmt:message key="internalhelp.artistdeletedcount"/></td><td class="ruleTableCell">${model.indexArtistDeletedCount}</td></tr>
<tr><td class="ruleTableHeader"><fmt:message key="internalhelp.albumid3deletedcount"/></td><td class="ruleTableCell">${model.indexAlbumId3DeletedCount}</td></tr>
<tr><td class="ruleTableHeader"><fmt:message key="internalhelp.artistid3deletedcount"/></td><td class="ruleTableCell">${model.indexArtistId3DeletedCount}</td></tr>
<tr><td class="ruleTableHeader"><fmt:message key="internalhelp.songcount"/></td><td class="ruleTableCell">${model.indexSongCount}</td></tr>
<tr><td class="ruleTableHeader"><fmt:message key="internalhelp.albumcount"/></td><td class="ruleTableCell">${model.indexAlbumCount}</td></tr>
<tr><td class="ruleTableHeader"><fmt:message key="internalhelp.artistcount"/></td><td class="ruleTableCell">${model.indexArtistCount}</td></tr>
<tr><td class="ruleTableHeader"><fmt:message key="internalhelp.albumid3count"/></td><td class="ruleTableCell">${model.indexAlbumId3Count}</td></tr>
<tr><td class="ruleTableHeader"><fmt:message key="internalhelp.artistid3count"/></td><td class="ruleTableCell">${model.indexArtistId3Count}</td></tr>
</table>
<p></p>
@ -138,10 +128,6 @@
<tr><td class="ruleTableHeader"><fmt:message key="internalhelp.distinctalbumcount"/></td><td class="ruleTableCell">${model.dbMediaFileDistinctAlbumCount}</td></tr>
<tr><td class="ruleTableHeader"><fmt:message key="internalhelp.distinctartistcount"/></td><td class="ruleTableCell">${model.dbMediaFileDistinctArtistCount}</td></tr>
<tr><td class="ruleTableHeader"><fmt:message key="internalhelp.distinctalbumartistcount"/></td><td class="ruleTableCell">${model.dbMediaFileDistinctAlbumArtistCount}</td></tr>
<c:forEach var="tableCount" items="${model.dbTableCount}">
<tr><td class="ruleTableHeader"><fmt:message key="internalhelp.tablecount"><fmt:param value="${tableCount.key}"/></fmt:message></td><td class="ruleTableCell">${tableCount.value}</td></tr>
</c:forEach>
</table>
<p></p>
@ -345,6 +331,35 @@
<p></p>
<h2>
<img src="<spring:theme code='logImage'/>" alt="">
<span style="vertical-align: middle"><fmt:message key="internalhelp.indexdetails"/></span>
</h2>
<table width="75%" class="ruleTable indent">
<c:forEach var="stat" items="${model.indexStatistics}">
<tr><td class="ruleTableHeader"><fmt:message key="internalhelp.indexdeletedcount"><fmt:param value="${stat.value.name}"/></fmt:message></td><td class="ruleTableCell">${stat.value.deletedCount}</td></tr>
</c:forEach>
<c:forEach var="stat" items="${model.indexStatistics}">
<tr><td class="ruleTableHeader"><fmt:message key="internalhelp.indexcount"><fmt:param value="${stat.value.name}"/></fmt:message></td><td class="ruleTableCell">${stat.value.count}</td></tr>
</c:forEach>
</table>
<p></p>
<h2>
<img src="<spring:theme code='logImage'/>" alt="">
<span style="vertical-align: middle"><fmt:message key="internalhelp.databasedetails"/></span>
</h2>
<table width="75%" class="ruleTable indent">
<c:forEach var="tableCount" items="${model.dbTableCount}">
<tr><td class="ruleTableHeader"><fmt:message key="internalhelp.tablecount"><fmt:param value="${tableCount.key}"/></fmt:message></td><td class="ruleTableCell">${tableCount.value}</td></tr>
</c:forEach>
</table>
<p></p>
<h2>
<img src="<spring:theme code='logImage'/>" alt="">
<span style="vertical-align: middle"><fmt:message key="help.log"/></span>

Loading…
Cancel
Save