Skip to content

Commit 2e2ae19

Browse files
drop elasticsearch-translog for 7.0 (#33373)
#32281 adds elasticsearch-shard to provide bwc version of elasticsearch-translog for 6.x; have to remove elasticsearch-translog for 7.0 Relates to #31389
1 parent 8082b4a commit 2e2ae19

File tree

12 files changed

+25
-169
lines changed

12 files changed

+25
-169
lines changed

distribution/src/bin/elasticsearch-translog

Lines changed: 0 additions & 5 deletions
This file was deleted.

distribution/src/bin/elasticsearch-translog.bat

Lines changed: 0 additions & 12 deletions
This file was deleted.

docs/reference/index-modules/translog.asciidoc

Lines changed: 0 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -86,65 +86,3 @@ file based sync. Defaults to `512mb`
8686
`index.translog.retention.age`::
8787

8888
The maximum duration for which translog files will be kept. Defaults to `12h`.
89-
90-
91-
[float]
92-
[[corrupt-translog-truncation]]
93-
=== What to do if the translog becomes corrupted?
94-
95-
[WARNING]
96-
This tool is deprecated and will be completely removed in 7.0.
97-
Use the <<shard-tool,elasticsearch-shard tool>> instead of this one.
98-
99-
In some cases (a bad drive, user error) the translog on a shard copy can become
100-
corrupted. When this corruption is detected by Elasticsearch due to mismatching
101-
checksums, Elasticsearch will fail that shard copy and refuse to use that copy
102-
of the data. If there are other copies of the shard available then
103-
Elasticsearch will automatically recover from one of them using the normal
104-
shard allocation and recovery mechanism. In particular, if the corrupt shard
105-
copy was the primary when the corruption was detected then one of its replicas
106-
will be promoted in its place.
107-
108-
If there is no copy of the data from which Elasticsearch can recover
109-
successfully, a user may want to recover the data that is part of the shard at
110-
the cost of losing the data that is currently contained in the translog. We
111-
provide a command-line tool for this, `elasticsearch-translog`.
112-
113-
[WARNING]
114-
The `elasticsearch-translog` tool should *not* be run while Elasticsearch is
115-
running. If you attempt to run this tool while Elasticsearch is running, you
116-
will permanently lose the documents that were contained only in the translog!
117-
118-
In order to run the `elasticsearch-translog` tool, specify the `truncate`
119-
subcommand as well as the directory for the corrupted translog with the `-d`
120-
option:
121-
122-
[source,txt]
123-
--------------------------------------------------
124-
$ bin/elasticsearch-translog truncate -d /var/lib/elasticsearchdata/nodes/0/indices/P45vf_YQRhqjfwLMUvSqDw/0/translog/
125-
Checking existing translog files
126-
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
127-
! WARNING: Elasticsearch MUST be stopped before running this tool !
128-
! !
129-
! WARNING: Documents inside of translog files will be lost !
130-
! !
131-
! WARNING: The following files will be DELETED! !
132-
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
133-
--> data/nodes/0/indices/P45vf_YQRhqjfwLMUvSqDw/0/translog/translog-41.ckp
134-
--> data/nodes/0/indices/P45vf_YQRhqjfwLMUvSqDw/0/translog/translog-6.ckp
135-
--> data/nodes/0/indices/P45vf_YQRhqjfwLMUvSqDw/0/translog/translog-37.ckp
136-
--> data/nodes/0/indices/P45vf_YQRhqjfwLMUvSqDw/0/translog/translog-24.ckp
137-
--> data/nodes/0/indices/P45vf_YQRhqjfwLMUvSqDw/0/translog/translog-11.ckp
138-
139-
Continue and DELETE files? [y/N] y
140-
Reading translog UUID information from Lucene commit from shard at [data/nodes/0/indices/P45vf_YQRhqjfwLMUvSqDw/0/index]
141-
Translog Generation: 3
142-
Translog UUID : AxqC4rocTC6e0fwsljAh-Q
143-
Removing existing translog files
144-
Creating new empty checkpoint at [data/nodes/0/indices/P45vf_YQRhqjfwLMUvSqDw/0/translog/translog.ckp]
145-
Creating new empty translog at [data/nodes/0/indices/P45vf_YQRhqjfwLMUvSqDw/0/translog/translog-3.tlog]
146-
Done.
147-
--------------------------------------------------
148-
149-
You can also use the `-h` option to get a list of all options and parameters
150-
that the `elasticsearch-translog` tool supports.

docs/reference/migration/migrate_7_0/indices.asciidoc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,4 +90,8 @@ The previous behavior can be restored by setting `indices.breaker.total.use_real
9090
[float]
9191
==== `fix` value for `index.shard.check_on_startup` is removed
9292

93-
Deprecated option value `fix` for setting `index.shard.check_on_startup` is not supported.
93+
Deprecated option value `fix` for setting `index.shard.check_on_startup` is not supported.
94+
95+
==== `elasticsearch-translog` is removed
96+
97+
Use the `elasticsearch-shard` tool to remove corrupted translog data.

qa/vagrant/src/main/java/org/elasticsearch/packaging/util/Archives.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,7 @@ private static void verifyOssInstallation(Installation es, Distribution distribu
186186
"elasticsearch-env",
187187
"elasticsearch-keystore",
188188
"elasticsearch-plugin",
189-
"elasticsearch-shard",
190-
"elasticsearch-translog"
189+
"elasticsearch-shard"
191190
).forEach(executable -> {
192191

193192
assertThat(es.bin(executable), file(File, owner, owner, p755));

qa/vagrant/src/main/java/org/elasticsearch/packaging/util/Installation.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ public class Executables {
102102
public final Path elasticsearchKeystore = platformExecutable("elasticsearch-keystore");
103103
public final Path elasticsearchCertutil = platformExecutable("elasticsearch-certutil");
104104
public final Path elasticsearchShard = platformExecutable("elasticsearch-shard");
105-
public final Path elasticsearchTranslog = platformExecutable("elasticsearch-translog");
106105

107106
private Path platformExecutable(String name) {
108107
final String platformExecutableName = Platforms.WINDOWS

qa/vagrant/src/main/java/org/elasticsearch/packaging/util/Packages.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,7 @@ private static void verifyOssInstallation(Installation es, Distribution distribu
187187
"elasticsearch",
188188
"elasticsearch-plugin",
189189
"elasticsearch-keystore",
190-
"elasticsearch-shard",
191-
"elasticsearch-translog"
190+
"elasticsearch-shard"
192191
).forEach(executable -> assertThat(es.bin(executable), file(File, "root", "root", p755)));
193192

194193
Stream.of(

qa/vagrant/src/test/resources/packaging/utils/packages.bash

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ verify_package_installation() {
9696
assert_file "$ESHOME/bin/elasticsearch" f root root 755
9797
assert_file "$ESHOME/bin/elasticsearch-plugin" f root root 755
9898
assert_file "$ESHOME/bin/elasticsearch-shard" f root root 755
99-
assert_file "$ESHOME/bin/elasticsearch-translog" f root root 755
10099
assert_file "$ESHOME/lib" d root root 755
101100
assert_file "$ESCONFIG" d root elasticsearch 2750
102101
assert_file "$ESCONFIG/elasticsearch.keystore" f root elasticsearch 660

qa/vagrant/src/test/resources/packaging/utils/tar.bash

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ verify_archive_installation() {
9595
assert_file "$ESHOME/bin/elasticsearch-keystore" f elasticsearch elasticsearch 755
9696
assert_file "$ESHOME/bin/elasticsearch-plugin" f elasticsearch elasticsearch 755
9797
assert_file "$ESHOME/bin/elasticsearch-shard" f elasticsearch elasticsearch 755
98-
assert_file "$ESHOME/bin/elasticsearch-translog" f elasticsearch elasticsearch 755
9998
assert_file "$ESCONFIG" d elasticsearch elasticsearch 755
10099
assert_file "$ESCONFIG/elasticsearch.yml" f elasticsearch elasticsearch 660
101100
assert_file "$ESCONFIG/jvm.options" f elasticsearch elasticsearch 660

server/src/main/java/org/elasticsearch/index/shard/RemoveCorruptedShardDataCommand.java

Lines changed: 15 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,6 @@ public class RemoveCorruptedShardDataCommand extends EnvironmentAwareCommand {
8585
private final NamedXContentRegistry namedXContentRegistry;
8686

8787
public RemoveCorruptedShardDataCommand() {
88-
this(false);
89-
}
90-
91-
public RemoveCorruptedShardDataCommand(boolean translogOnly) {
9288
super("Removes corrupted shard files");
9389

9490
folderOption = parser.acceptsAll(Arrays.asList("d", "dir"),
@@ -104,18 +100,13 @@ public RemoveCorruptedShardDataCommand(boolean translogOnly) {
104100

105101
namedXContentRegistry = new NamedXContentRegistry(ClusterModule.getNamedXWriteables());
106102

107-
removeCorruptedLuceneSegmentsAction = translogOnly ? null : new RemoveCorruptedLuceneSegmentsAction();
103+
removeCorruptedLuceneSegmentsAction = new RemoveCorruptedLuceneSegmentsAction();
108104
truncateTranslogAction = new TruncateTranslogAction(namedXContentRegistry);
109105
}
110106

111107
@Override
112108
protected void printAdditionalHelp(Terminal terminal) {
113-
if (removeCorruptedLuceneSegmentsAction == null) {
114-
// that's only for 6.x branch for bwc with elasticsearch-translog
115-
terminal.println("This tool truncates the translog and translog checkpoint files to create a new translog");
116-
} else {
117-
terminal.println("This tool attempts to detect and remove unrecoverable corrupted data in a shard.");
118-
}
109+
terminal.println("This tool attempts to detect and remove unrecoverable corrupted data in a shard.");
119110
}
120111

121112
// Visible for testing
@@ -277,12 +268,6 @@ private void warnAboutESShouldBeStopped(Terminal terminal) {
277268
terminal.println("");
278269
terminal.println(" WARNING: Elasticsearch MUST be stopped before running this tool.");
279270
terminal.println("");
280-
// that's only for 6.x branch for bwc with elasticsearch-translog
281-
if (removeCorruptedLuceneSegmentsAction == null) {
282-
terminal.println(" This tool is deprecated and will be completely removed in 7.0.");
283-
terminal.println(" It is replaced by the elasticsearch-shard tool. ");
284-
terminal.println("");
285-
}
286271
terminal.println(" Please make a complete backup of your index before using this tool.");
287272
terminal.println("");
288273
terminal.println("-----------------------------------------------------------------------");
@@ -318,26 +303,21 @@ public void write(int b) {
318303
// keep the index lock to block any runs of older versions of this tool
319304
try (Lock writeIndexLock = indexDir.obtainLock(IndexWriter.WRITE_LOCK_NAME)) {
320305
////////// Index
321-
// that's only for 6.x branch for bwc with elasticsearch-translog
322-
if (removeCorruptedLuceneSegmentsAction != null) {
323-
terminal.println("");
324-
terminal.println("Opening Lucene index at " + indexPath);
325-
terminal.println("");
326-
try {
327-
indexCleanStatus = removeCorruptedLuceneSegmentsAction.getCleanStatus(shardPath, indexDir,
328-
writeIndexLock, printStream, verbose);
329-
} catch (Exception e) {
330-
terminal.println(e.getMessage());
331-
throw e;
332-
}
333-
334-
terminal.println("");
335-
terminal.println(" >> Lucene index is " + indexCleanStatus.v1().getMessage() + " at " + indexPath);
336-
terminal.println("");
337-
} else {
338-
indexCleanStatus = Tuple.tuple(CleanStatus.CLEAN, null);
306+
terminal.println("");
307+
terminal.println("Opening Lucene index at " + indexPath);
308+
terminal.println("");
309+
try {
310+
indexCleanStatus = removeCorruptedLuceneSegmentsAction.getCleanStatus(shardPath, indexDir,
311+
writeIndexLock, printStream, verbose);
312+
} catch (Exception e) {
313+
terminal.println(e.getMessage());
314+
throw e;
339315
}
340316

317+
terminal.println("");
318+
terminal.println(" >> Lucene index is " + indexCleanStatus.v1().getMessage() + " at " + indexPath);
319+
terminal.println("");
320+
341321
////////// Translog
342322
// as translog relies on data stored in an index commit - we have to have non unrecoverable index to truncate translog
343323
if (indexCleanStatus.v1() != CleanStatus.UNRECOVERABLE) {

server/src/main/java/org/elasticsearch/index/translog/TranslogToolCli.java

Lines changed: 0 additions & 42 deletions
This file was deleted.

server/src/test/java/org/elasticsearch/index/shard/RemoveCorruptedShardDataCommandIT.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -293,11 +293,9 @@ public void testCorruptTranslogTruncation() throws Exception {
293293
indexRandom(false, false, false, Arrays.asList(builders));
294294
Set<Path> translogDirs = getDirs(indexName, ShardPath.TRANSLOG_FOLDER_NAME);
295295

296-
// that's only for 6.x branch for bwc with elasticsearch-translog
297-
final boolean translogOnly = randomBoolean();
298-
final RemoveCorruptedShardDataCommand command = new RemoveCorruptedShardDataCommand(translogOnly);
299-
final MockTerminal terminal = new MockTerminal();
300-
final OptionParser parser = command.getParser();
296+
RemoveCorruptedShardDataCommand command = new RemoveCorruptedShardDataCommand();
297+
MockTerminal terminal = new MockTerminal();
298+
OptionParser parser = command.getParser();
301299

302300
if (randomBoolean() && numDocsToTruncate > 0) {
303301
// flush the replica, so it will have more docs than what the primary will have

0 commit comments

Comments
 (0)