├── .gitignore ├── 15080.patch ├── NOTICE.txt └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | /data 2 | /work 3 | /logs 4 | /.idea 5 | /target 6 | .DS_Store 7 | *.iml 8 | /.project 9 | /.settings 10 | /.classpath 11 | /plugin_tools 12 | /.local-execution-hints.log 13 | /.local-*-execution-hints.log 14 | *.vmoptions 15 | /eclipse-build/ 16 | -------------------------------------------------------------------------------- /15080.patch: -------------------------------------------------------------------------------- 1 | Index: src/main/java/org/elasticsearch/cloud/azure/storage/AzureStorageService.java 2 | IDEA additional info: 3 | Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP 4 | <+>UTF-8 5 | =================================================================== 6 | --- src/main/java/org/elasticsearch/cloud/azure/storage/AzureStorageService.java (revision e3d8015487617c36e92b7f9262cea446beea476e) 7 | +++ src/main/java/org/elasticsearch/cloud/azure/storage/AzureStorageService.java (revision 2bbba3f48fa91b2d6d7fc0546c7d0f9eedc6cb66) 8 | @@ -38,8 +38,14 @@ 9 | public static final String API_IMPLEMENTATION = "cloud.azure.storage.api.impl"; 10 | public static final String PREFIX = "cloud.azure.storage."; 11 | @Deprecated 12 | - public static final String ACCOUNT = "cloud.azure.storage.account"; 13 | + public static final String ACCOUNT_DEPRECATED = "cloud.azure.storage.account"; 14 | @Deprecated 15 | + public static final String KEY_DEPRECATED = "cloud.azure.storage.key"; 16 | + 17 | + public static final String TIMEOUT = "cloud.azure.storage.timeout"; 18 | + 19 | + public static final String ACCOUNT = "repositories.azure.account"; 20 | + public static final String LOCATION_MODE = "repositories.azure.location_mode"; 21 | public static final String KEY = "cloud.azure.storage.key"; 22 | public static final String CONTAINER = "repositories.azure.container"; 23 | public static final String BASE_PATH = "repositories.azure.base_path"; 24 | Index: src/main/java/org/elasticsearch/cloud/azure/storage/AzureStorageServiceImpl.java 25 | IDEA additional info: 26 | Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP 27 | <+>UTF-8 28 | =================================================================== 29 | --- src/main/java/org/elasticsearch/cloud/azure/storage/AzureStorageServiceImpl.java (revision e3d8015487617c36e92b7f9262cea446beea476e) 30 | +++ src/main/java/org/elasticsearch/cloud/azure/storage/AzureStorageServiceImpl.java (revision 2bbba3f48fa91b2d6d7fc0546c7d0f9eedc6cb66) 31 | @@ -115,6 +115,14 @@ 32 | // NOTE: for now, just set the location mode in case it is different; 33 | // only one mode per storage account can be active at a time 34 | client.getDefaultRequestOptions().setLocationMode(mode); 35 | + 36 | + // Set timeout option. Defaults to 5mn. See cloud.azure.storage.timeout or cloud.azure.storage.xxx.timeout 37 | + try { 38 | + int timeout = (int) azureStorageSettings.getTimeout().getMillis(); 39 | + client.getDefaultRequestOptions().setTimeoutIntervalInMs(timeout); 40 | + } catch (ClassCastException e) { 41 | + throw new IllegalArgumentException("Can not cast [" + azureStorageSettings.getTimeout() + "] to int."); 42 | + } 43 | return client; 44 | } 45 | 46 | Index: src/main/java/org/elasticsearch/cloud/azure/storage/AzureStorageSettings.java 47 | IDEA additional info: 48 | Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP 49 | <+>UTF-8 50 | =================================================================== 51 | --- src/main/java/org/elasticsearch/cloud/azure/storage/AzureStorageSettings.java (revision e3d8015487617c36e92b7f9262cea446beea476e) 52 | +++ src/main/java/org/elasticsearch/cloud/azure/storage/AzureStorageSettings.java (revision 2bbba3f48fa91b2d6d7fc0546c7d0f9eedc6cb66) 53 | @@ -24,6 +24,9 @@ 54 | import org.elasticsearch.common.logging.ESLogger; 55 | import org.elasticsearch.common.logging.ESLoggerFactory; 56 | import org.elasticsearch.common.settings.Settings; 57 | +import org.elasticsearch.common.unit.ByteSizeValue; 58 | +import org.elasticsearch.common.unit.TimeValue; 59 | +import org.elasticsearch.repositories.RepositorySettings; 60 | 61 | import java.util.HashMap; 62 | import java.util.Map; 63 | @@ -34,11 +37,13 @@ 64 | private String name; 65 | private String account; 66 | private String key; 67 | + private TimeValue timeout; 68 | 69 | - public AzureStorageSettings(String name, String account, String key) { 70 | + public AzureStorageSettings(String name, String account, String key, TimeValue timeout) { 71 | this.name = name; 72 | this.account = account; 73 | this.key = key; 74 | + this.timeout = timeout; 75 | } 76 | 77 | public String getName() { 78 | @@ -53,12 +58,17 @@ 79 | return account; 80 | } 81 | 82 | + public TimeValue getTimeout() { 83 | + return timeout; 84 | + } 85 | + 86 | @Override 87 | public String toString() { 88 | final StringBuffer sb = new StringBuffer("AzureStorageSettings{"); 89 | sb.append("name='").append(name).append('\''); 90 | sb.append(", account='").append(account).append('\''); 91 | sb.append(", key='").append(key).append('\''); 92 | + sb.append(", timeout=").append(timeout); 93 | sb.append('}'); 94 | return sb.toString(); 95 | } 96 | @@ -73,12 +83,15 @@ 97 | Map secondaryStorage = new HashMap<>(); 98 | 99 | // We check for deprecated settings 100 | - String account = settings.get(Storage.ACCOUNT); 101 | - String key = settings.get(Storage.KEY); 102 | + String account = settings.get(Storage.ACCOUNT_DEPRECATED); 103 | + String key = settings.get(Storage.KEY_DEPRECATED); 104 | + 105 | + TimeValue globalTimeout = settings.getAsTime(Storage.TIMEOUT, TimeValue.timeValueMinutes(5)); 106 | + 107 | if (account != null) { 108 | logger.warn("[{}] and [{}] have been deprecated. Use now [{}xxx.account] and [{}xxx.key] where xxx is any name", 109 | - Storage.ACCOUNT, Storage.KEY, Storage.PREFIX, Storage.PREFIX); 110 | - primaryStorage = new AzureStorageSettings(null, account, key); 111 | + Storage.ACCOUNT_DEPRECATED, Storage.KEY_DEPRECATED, Storage.PREFIX, Storage.PREFIX); 112 | + primaryStorage = new AzureStorageSettings(null, account, key, globalTimeout); 113 | } else { 114 | Settings storageSettings = settings.getByPrefix(Storage.PREFIX); 115 | if (storageSettings != null) { 116 | @@ -87,7 +100,8 @@ 117 | if (storage.getValue() instanceof Map) { 118 | @SuppressWarnings("unchecked") 119 | Map map = (Map) storage.getValue(); 120 | - AzureStorageSettings current = new AzureStorageSettings(storage.getKey(), map.get("account"), map.get("key")); 121 | + TimeValue timeout = TimeValue.parseTimeValue(map.get("timeout"), globalTimeout, Storage.PREFIX + storage.getKey() + ".timeout"); 122 | + AzureStorageSettings current = new AzureStorageSettings(storage.getKey(), map.get("account"), map.get("key"), timeout); 123 | String activeStr = map.get("default"); 124 | boolean activeByDefault = activeStr == null ? false : Boolean.parseBoolean(activeStr); 125 | if (activeByDefault) { 126 | Index: src/test/java/org/elasticsearch/cloud/azure/storage/AzureStorageServiceTest.java 127 | IDEA additional info: 128 | Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP 129 | <+>UTF-8 130 | =================================================================== 131 | --- src/test/java/org/elasticsearch/cloud/azure/storage/AzureStorageServiceTest.java (revision e3d8015487617c36e92b7f9262cea446beea476e) 132 | +++ src/test/java/org/elasticsearch/cloud/azure/storage/AzureStorageServiceTest.java (revision 2bbba3f48fa91b2d6d7fc0546c7d0f9eedc6cb66) 133 | @@ -37,6 +37,7 @@ 134 | .put("cloud.azure.storage.azure2.key", "mykey2") 135 | .put("cloud.azure.storage.azure3.account", "myaccount3") 136 | .put("cloud.azure.storage.azure3.key", "mykey3") 137 | + .put("cloud.azure.storage.azure3.timeout", "30s") 138 | .build(); 139 | 140 | public void testGetSelectedClientWithNoPrimaryAndSecondary() { 141 | @@ -89,6 +90,28 @@ 142 | assertThat(client.getEndpoint(), is(URI.create("https://azure1"))); 143 | } 144 | 145 | + public void testGetSelectedClientGlobalTimeout() { 146 | + Settings timeoutSettings = Settings.builder() 147 | + .put(settings) 148 | + .put("cloud.azure.storage.timeout", "10s") 149 | + .build(); 150 | + 151 | + AzureStorageServiceImpl azureStorageService = new AzureStorageServiceMock(timeoutSettings); 152 | + azureStorageService.doStart(); 153 | + CloudBlobClient client1 = azureStorageService.getSelectedClient("azure1", LocationMode.PRIMARY_ONLY); 154 | + assertThat(client1.getDefaultRequestOptions().getTimeoutIntervalInMs(), is(10 * 1000)); 155 | + CloudBlobClient client3 = azureStorageService.getSelectedClient("azure3", LocationMode.PRIMARY_ONLY); 156 | + assertThat(client3.getDefaultRequestOptions().getTimeoutIntervalInMs(), is(30 * 1000)); 157 | + } 158 | + 159 | + public void testGetSelectedClientDefaultTimeout() { 160 | + AzureStorageServiceImpl azureStorageService = new AzureStorageServiceMock(settings); 161 | + azureStorageService.doStart(); 162 | + CloudBlobClient client1 = azureStorageService.getSelectedClient("azure1", LocationMode.PRIMARY_ONLY); 163 | + assertThat(client1.getDefaultRequestOptions().getTimeoutIntervalInMs(), is(5 * 60 * 1000)); 164 | + CloudBlobClient client3 = azureStorageService.getSelectedClient("azure3", LocationMode.PRIMARY_ONLY); 165 | + assertThat(client3.getDefaultRequestOptions().getTimeoutIntervalInMs(), is(30 * 1000)); 166 | + } 167 | 168 | /** 169 | * This internal class just overload createClient method which is called by AzureStorageServiceImpl.doStart() 170 | -------------------------------------------------------------------------------- /NOTICE.txt: -------------------------------------------------------------------------------- 1 | ElasticSearch 2 | Copyright 2009-2013 ElasticSearch 3 | 4 | This product includes software developed by The Apache Software 5 | Foundation (http://www.apache.org/). 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | **IMPORTANT: Project MOVED!** 2 | 3 | From elasticsearch 2.0 you need to look at the following links: 4 | 5 | * [Source code](https://github.com/elastic/elasticsearch/tree/master/plugins/). 6 | * [Documentation](https://www.elastic.co/guide/en/elasticsearch/plugins/current/index.html). 7 | * [Question? Bugs?](https://discuss.elastic.co/c/elasticsearch) 8 | 9 | For older versions, look at the following documentation. 10 | 11 | In order to install the plugin, run: 12 | 13 | ```sh 14 | bin/plugin install elasticsearch/elasticsearch-cloud-azure/VERSION 15 | ``` 16 | 17 | Where `VERSION` is the one you want to install. 18 | 19 | | Elasticsearch | Azure Cloud Plugin| Docs | 20 | |------------------------|-------------------|------------------------------------------------------------------------------------------------------------------------------------| 21 | | es-1.7 | 2.8.3 | [2.8.3](https://github.com/elastic/elasticsearch-cloud-azure/tree/v2.8.3/#version-283-for-elasticsearch-17) | 22 | | es-1.6 | 2.7.1 | [2.7.1](https://github.com/elastic/elasticsearch-cloud-azure/tree/v2.7.1/#version-271-for-elasticsearch-16) | 23 | | es-1.5 | 2.6.1 | [2.6.1](https://github.com/elastic/elasticsearch-cloud-azure/tree/v2.6.1/#version-261-for-elasticsearch-15) | 24 | | es-1.4 | 2.5.2 | [2.5.2](https://github.com/elastic/elasticsearch-cloud-azure/tree/v2.5.2/#version-252-for-elasticsearch-14) | 25 | | es-1.3 | 2.4.0 | [2.4.0](https://github.com/elasticsearch/elasticsearch-cloud-azure/tree/v2.4.0/#version-240-for-elasticsearch-13) | 26 | | es-1.2 | 2.3.0 | [2.3.0](https://github.com/elasticsearch/elasticsearch-cloud-azure/tree/v2.3.0/#azure-cloud-plugin-for-elasticsearch) | 27 | | es-1.1 | 2.2.0 | [2.2.0](https://github.com/elasticsearch/elasticsearch-cloud-azure/tree/v2.2.0/#azure-cloud-plugin-for-elasticsearch) | 28 | | es-1.0 | 2.1.0 | [2.1.0](https://github.com/elasticsearch/elasticsearch-cloud-azure/tree/v2.1.0/#azure-cloud-plugin-for-elasticsearch) | 29 | | es-0.90 | 1.0.0.alpha1 | [1.0.0.alpha1](https://github.com/elasticsearch/elasticsearch-cloud-azure/tree/v1.0.0.alpha1/#azure-cloud-plugin-for-elasticsearch)| 30 | 31 | 32 | License 33 | ------- 34 | 35 | This software is licensed under the Apache 2 license, quoted below. 36 | 37 | Copyright 2009-2014 Elasticsearch 38 | 39 | Licensed under the Apache License, Version 2.0 (the "License"); you may not 40 | use this file except in compliance with the License. You may obtain a copy of 41 | the License at 42 | 43 | http://www.apache.org/licenses/LICENSE-2.0 44 | 45 | Unless required by applicable law or agreed to in writing, software 46 | distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 47 | WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 48 | License for the specific language governing permissions and limitations under 49 | the License. 50 | --------------------------------------------------------------------------------