embulk-output-elasticsearch 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 75dffd640bad902148ef5c1a3ad38ab1f3621979
|
4
|
+
data.tar.gz: b2f3b8a9e8573c821494d953f481ec2cd3d03c77
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df79299ab2a3158c6986a6c61ad7cef7b43775d7297a5898021cf471090258887096ae66c070b5f63c8eab6d5f16b2275e65a1f7b95bd11b231cf3f982521a62
|
7
|
+
data.tar.gz: 1d285ccb4fd669a827c08d66c8ae5ea4bbc7097ab021c81002c14d52a46216bc20a54fa369e18f69b27f290ddc772faeba907e7c6a48166e92fc5ad9aad740a4
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
## 0.4.1 - 2017-04-21
|
2
|
+
|
3
|
+
* [maintenance] Check snapshot progress status before delete index [#36](https://github.com/muga/embulk-output-elasticsearch/pull/36)
|
4
|
+
|
1
5
|
## 0.4.0 - 2017-03-28
|
2
6
|
|
3
7
|
* [new feature] Support multiple Elasticsearch version [#32](https://github.com/muga/embulk-output-elasticsearch/pull/32)
|
data/README.md
CHANGED
@@ -27,6 +27,11 @@ This plugin uses HTTP/REST Client and haven't be implemented AWS authentication.
|
|
27
27
|
- **bulk_actions**: Sets when to flush a new bulk request based on the number of actions currently added. (int, default is 1000)
|
28
28
|
- **bulk_size**: Sets when to flush a new bulk request based on the size of actions currently added. (long, default is 5242880)
|
29
29
|
- ~~**concurrent_requests**: concurrent_requests (int, default is 5)~~ Not used now. May use in the future
|
30
|
+
- **maximum_retries** Number of maximam retry times (int, optional, default is 7)
|
31
|
+
- **initial_retry_interval_millis** Initial interval between retries in milliseconds (int, optional, default is 1000)
|
32
|
+
- **maximum_retry_interval_millis** Maximum interval between retries in milliseconds (int, optional, default is 120000)
|
33
|
+
- **timeout_millis** timeout in milliseconds for HTTP client(int, optional, default is 60000)
|
34
|
+
- **max_snapshot_waiting_secs** maximam waiting time in second when snapshot is just creating before delete index. works when `mode: replace` (int, optional, default is 1800)
|
30
35
|
|
31
36
|
### Modes
|
32
37
|
|
data/build.gradle
CHANGED
@@ -265,11 +265,46 @@ public class ElasticsearchHttpClient
|
|
265
265
|
// curl -XDELETE localhost:9200/{index}
|
266
266
|
// Success: {"acknowledged":true}
|
267
267
|
if (isIndexExisting(indexName, task, retryHelper)) {
|
268
|
+
waitSnapshot(task, retryHelper);
|
268
269
|
sendRequest(indexName, HttpMethod.DELETE, task, retryHelper);
|
269
270
|
log.info("Deleted Index [{}]", indexName);
|
270
271
|
}
|
271
272
|
}
|
272
273
|
|
274
|
+
private void waitSnapshot(PluginTask task, Jetty92RetryHelper retryHelper)
|
275
|
+
{
|
276
|
+
int maxSnapshotWaitingMills = task.getMaxSnapshotWaitingSecs() * 1000;
|
277
|
+
long execCount = 1;
|
278
|
+
long totalWaitingTime = 0;
|
279
|
+
// Since only needs exponential backoff, don't need exception handling and others, I don't use Embulk RetryExecutor
|
280
|
+
while (isSnapshotProgressing(task, retryHelper)) {
|
281
|
+
long sleepTime = ((long) Math.pow(2, execCount) * 1000);
|
282
|
+
try {
|
283
|
+
Thread.sleep(sleepTime);
|
284
|
+
}
|
285
|
+
catch (InterruptedException ex) {
|
286
|
+
// do nothing
|
287
|
+
}
|
288
|
+
if (execCount > 1) {
|
289
|
+
log.info("Waiting for snapshot completed.");
|
290
|
+
}
|
291
|
+
execCount++;
|
292
|
+
totalWaitingTime += sleepTime;
|
293
|
+
if (totalWaitingTime > maxSnapshotWaitingMills) {
|
294
|
+
throw new ConfigException(String.format("Waiting creating snapshot is expired. %s sec.", maxSnapshotWaitingMills));
|
295
|
+
}
|
296
|
+
}
|
297
|
+
}
|
298
|
+
|
299
|
+
private boolean isSnapshotProgressing(PluginTask task, Jetty92RetryHelper retryHelper)
|
300
|
+
{
|
301
|
+
// https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-snapshots.html#_snapshot_status
|
302
|
+
// curl -XGET localhost:9200/_snapshot/_status
|
303
|
+
JsonNode response = sendRequest("/_snapshot/_status", HttpMethod.GET, task, retryHelper);
|
304
|
+
String snapshots = response.get("snapshots").asText();
|
305
|
+
return !snapshots.equals("");
|
306
|
+
}
|
307
|
+
|
273
308
|
private JsonNode sendRequest(String path, final HttpMethod method, PluginTask task, Jetty92RetryHelper retryHelper)
|
274
309
|
{
|
275
310
|
return sendRequest(path, method, task, retryHelper, "");
|
@@ -126,6 +126,10 @@ public class ElasticsearchOutputPluginDelegate
|
|
126
126
|
@ConfigDefault("60000")
|
127
127
|
int getTimeoutMills();
|
128
128
|
|
129
|
+
@Config("max_snapshot_waiting_secs")
|
130
|
+
@ConfigDefault("1800")
|
131
|
+
int getMaxSnapshotWaitingSecs();
|
132
|
+
|
129
133
|
@Config("time_zone")
|
130
134
|
@ConfigDefault("\"UTC\"")
|
131
135
|
String getTimeZone();
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: embulk-output-elasticsearch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Muga Nishizawa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-04-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -83,7 +83,7 @@ files:
|
|
83
83
|
- src/test/java/org/embulk/output/elasticsearch/TestElasticsearchOutputPlugin.java
|
84
84
|
- src/test/resources/sample_01.csv
|
85
85
|
- classpath/embulk-base-restclient-0.4.2.jar
|
86
|
-
- classpath/embulk-output-elasticsearch-0.4.
|
86
|
+
- classpath/embulk-output-elasticsearch-0.4.1.jar
|
87
87
|
- classpath/embulk-util-retryhelper-jetty92-0.4.2.jar
|
88
88
|
- classpath/jetty-client-9.2.14.v20151106.jar
|
89
89
|
- classpath/jetty-http-9.2.14.v20151106.jar
|