Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Use DocumentTitle component on IndicesPage * Extenx IndexSetsResource to support pagination * Start UI for index sets This allows the creation and configuration of index sets. * Add config type to retention/rotation config during save and not in store * Add "standalone" prop to input fields in rotation/retention config * Let IndexSetRegistry return a list of configs to keep order * Add comment about MongoDB date issue * Cleanup after index set deletion and check for assigned streams - Do not allow index set deletion if any streams use it - Do not allow deletion of the default index set via REST API - Create index set cleanup system job to delete the indices and the index template * Implement UI components for index set deletion * Return to the correct page when pressing Cancel in index set config * Show index set details/settings in overview and on index set page * Add missing /cluster/deflector/{indexSet}/cycle endpoint Fixes manual index rotation for an index set. * Remove magic cycleCompleted function and list after cycle is done * Change wording to "Recalculate all index range" until we fix this * Add missing cancel link
- Loading branch information
Showing
53 changed files
with
1,514 additions
and
355 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
117 changes: 117 additions & 0 deletions
117
graylog2-server/src/main/java/org/graylog2/indexer/indices/jobs/IndexSetCleanupJob.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
/** | ||
* This file is part of Graylog. | ||
* | ||
* Graylog is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Graylog is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with Graylog. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package org.graylog2.indexer.indices.jobs; | ||
|
||
import com.google.inject.assistedinject.Assisted; | ||
import org.graylog2.indexer.IndexSet; | ||
import org.graylog2.indexer.indexset.IndexSetConfig; | ||
import org.graylog2.indexer.indices.Indices; | ||
import org.graylog2.system.jobs.SystemJob; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import javax.inject.Inject; | ||
|
||
public class IndexSetCleanupJob extends SystemJob { | ||
private static final Logger LOG = LoggerFactory.getLogger(IndexSetCleanupJob.class); | ||
private static final int MAX_CONCURRENCY = 1_000; | ||
|
||
public interface Factory { | ||
IndexSetCleanupJob create(IndexSet indexSet); | ||
} | ||
|
||
private final Indices indices; | ||
private final IndexSet indexSet; | ||
|
||
private volatile boolean cancel; | ||
private volatile long total = 0L; | ||
private volatile long deleted = 0L; | ||
|
||
@Inject | ||
public IndexSetCleanupJob(final Indices indices, @Assisted final IndexSet indexSet) { | ||
this.indices = indices; | ||
this.indexSet = indexSet; | ||
this.cancel = false; | ||
} | ||
|
||
@Override | ||
public void execute() { | ||
final IndexSetConfig config = indexSet.getConfig(); | ||
final String[] managedIndices = indexSet.getManagedIndicesNames(); | ||
|
||
this.total = managedIndices.length; | ||
|
||
try { | ||
LOG.info("Deleting index template <{}> from Elasticsearch", config.indexTemplateName()); | ||
indices.deleteIndexTemplate(indexSet); | ||
} catch (Exception e) { | ||
LOG.error("Unable to delete index template <{}>", config.indexTemplateName(), e); | ||
} | ||
|
||
for (String indexName : managedIndices) { | ||
if (cancel) { | ||
LOG.info("Cancel requested. Deleted <{}> of <{}> indices.", deleted, total); | ||
break; | ||
} | ||
try { | ||
LOG.info("Deleting index <{}> in index set <{}> ({})", indexName, config.id(), config.title()); | ||
indices.delete(indexName); | ||
this.deleted++; | ||
} catch (Exception e) { | ||
LOG.error("Unable to delete index <{}>", indexName, e); | ||
} | ||
} | ||
} | ||
|
||
@Override | ||
public void requestCancel() { | ||
this.cancel = true; | ||
} | ||
|
||
@Override | ||
public int getProgress() { | ||
if (total <= 0) { | ||
return 0; | ||
} | ||
return (int) Math.floor(((float) deleted / (float) total) * 100); | ||
} | ||
|
||
@Override | ||
public int maxConcurrency() { | ||
return MAX_CONCURRENCY; | ||
} | ||
|
||
@Override | ||
public boolean providesProgress() { | ||
return true; | ||
} | ||
|
||
@Override | ||
public boolean isCancelable() { | ||
return true; | ||
} | ||
|
||
@Override | ||
public String getDescription() { | ||
return "Deletes all indices in an index set."; | ||
} | ||
|
||
@Override | ||
public String getClassName() { | ||
return getClass().getCanonicalName(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.