Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Indices API: Fixed backward compatibility issue #8387

Merged
merged 1 commit into from
Nov 7, 2014
Merged

Indices API: Fixed backward compatibility issue #8387

merged 1 commit into from
Nov 7, 2014

Conversation

colings86
Copy link
Contributor

If a 1.4 node needs to forward a GET index API call to a <1.4 master it cannot use the GET index API endpoints as the master has no knowledge of it. This change detects that the master does not understand the initial request and instead tries it again using the old APIs. If these calls also do not work, an error is returned

Closes #8364

@Override
public void onFailure(Throwable e) {
Throwable rootCause = e;
if (rootCause instanceof RemoteTransportException) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe use ExceptionsHelper#unwrapCause?

@javanna javanna removed the review label Nov 7, 2014
@javanna
Copy link
Member

javanna commented Nov 7, 2014

Left a few comments, nice work @colings86 !

assertThat(settingsMap.size(), equalTo(1));
Settings settings = settingsMap.get("test");
assertThat(settings, notNullValue());
assertThat(settings.get("index.number_of_shards"), equalTo("1"));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI if you want (not that it is a problem as it works now) you can leave the randomized number of shards when creating the index and retrieve it through getNumShards("test").numShards which you can use for the comparison.

@javanna javanna removed the review label Nov 7, 2014
}
}
GetIndexResponse response = new GetIndexResponse(indices.toArray(new String[indices.size()]), warmers, mappings,
aliases, indexToSettings);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all good to pass in null here as parameter I guess?

@javanna
Copy link
Member

javanna commented Nov 7, 2014

LGTM

If a 1.4 node needs to forward a GET index API call to a <1.4 master it cannot use the GET index API endpoints as the master has no knowledge of it. This change detects that the master does not understand the initial request and instead tries it again using the old APIs. If these calls also do not work, an error is returned

Closes #8364
@colings86 colings86 merged commit 100a7af into elastic:1.4 Nov 7, 2014
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
import static org.hamcrest.Matchers.*;

public class GetIndexBackwardsCompatibilityTests extends ElasticsearchBackwardsCompatIntegrationTest {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we have this test on master as well please?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added to master in d0da605

@colings86 colings86 deleted the fix/getIndexBWC branch November 18, 2014 17:02
@clintongormley clintongormley added the :Data Management/Indices APIs APIs to create and manage indices and templates label Mar 19, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Data Management/Indices APIs APIs to create and manage indices and templates >regression v1.4.1 v1.5.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants