Skip to content

Commit

Permalink
[java] Remove async replication
Browse files Browse the repository at this point in the history
Follow up for PR elastic#10171.

As we discussed elastic#10114 (comment), we should also mark the code as deprecated so plugin developers know in advance that they need to adapt their code.

I also added a `log` when using `replication` parameter in REST APIs but as `info` Level. I wonder if I should better log that as a `WARN` if `debug` level is set? So people in debug mode will see this information as a `WARN` while it won't pollute logs for each call when in default `INFO` log level.
  • Loading branch information
dadoonet committed Apr 17, 2015
1 parent 03e42af commit d61f0d2
Show file tree
Hide file tree
Showing 12 changed files with 34 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main/java/org/elasticsearch/action/bulk/BulkRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -410,12 +410,18 @@ public boolean refresh() {

/**
* Set the replication type for this operation.
* @deprecated will be removed in 2.0.0. See https://github.com/elastic/elasticsearch/pull/10171
*/
@Deprecated
public BulkRequest replicationType(ReplicationType replicationType) {
this.replicationType = replicationType;
return this;
}

/**
* @deprecated will be removed in 2.0.0. See https://github.com/elastic/elasticsearch/pull/10171
*/
@Deprecated
public ReplicationType replicationType() {
return this.replicationType;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,9 @@ public BulkRequestBuilder add(byte[] data, int from, int length, @Nullable Strin

/**
* Set the replication type for this operation.
* @deprecated will be removed in 2.0.0. See https://github.com/elastic/elasticsearch/pull/10171
*/
@Deprecated
public BulkRequestBuilder setReplicationType(ReplicationType replicationType) {
request.replicationType(replicationType);
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ public RequestBuilder setIndicesOptions(IndicesOptions indicesOptions) {

/**
* Sets the replication type.
* @deprecated will be removed in 2.0.0. See https://github.com/elastic/elasticsearch/pull/10171
*/
@Deprecated
@SuppressWarnings("unchecked")
public RequestBuilder setReplicationType(ReplicationType replicationType) {
request.replicationType(replicationType);
Expand All @@ -80,7 +82,9 @@ public RequestBuilder setReplicationType(ReplicationType replicationType) {

/**
* Sets the replication type.
* @deprecated will be removed in 2.0.0. See https://github.com/elastic/elasticsearch/pull/10171
*/
@Deprecated
@SuppressWarnings("unchecked")
public RequestBuilder setReplicationType(String replicationType) {
request.replicationType(replicationType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@

/**
* The type of replication to perform.
* @deprecated will be removed in 2.0.0. See https://github.com/elastic/elasticsearch/pull/10171
*/
@Deprecated
public enum ReplicationType {
/**
* Sync replication, wait till all replicas have performed the operation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,18 @@ public IndicesOptions indicesOptions() {

/**
* The replication type.
* @deprecated will be removed in 2.0.0. See https://github.com/elastic/elasticsearch/pull/10171
*/
@Deprecated
public ReplicationType replicationType() {
return this.replicationType;
}

/**
* Sets the replication type.
* @deprecated will be removed in 2.0.0. See https://github.com/elastic/elasticsearch/pull/10171
*/
@Deprecated
@SuppressWarnings("unchecked")
public final T replicationType(ReplicationType replicationType) {
this.replicationType = replicationType;
Expand All @@ -167,7 +171,9 @@ public final T replicationType(ReplicationType replicationType) {

/**
* Sets the replication type.
* @deprecated will be removed in 2.0.0. See https://github.com/elastic/elasticsearch/pull/10171
*/
@Deprecated
public final T replicationType(String replicationType) {
return replicationType(ReplicationType.fromString(replicationType));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ public final RequestBuilder setIndex(String index) {

/**
* Sets the replication type.
* @deprecated will be removed in 2.0.0. See https://github.com/elastic/elasticsearch/pull/10171
*/
@Deprecated
@SuppressWarnings("unchecked")
public RequestBuilder setReplicationType(ReplicationType replicationType) {
request.replicationType(replicationType);
Expand All @@ -79,7 +81,9 @@ public RequestBuilder setReplicationType(ReplicationType replicationType) {

/**
* Sets the replication type.
* @deprecated will be removed in 2.0.0. See https://github.com/elastic/elasticsearch/pull/10171
*/
@Deprecated
@SuppressWarnings("unchecked")
public RequestBuilder setReplicationType(String replicationType) {
request.replicationType(replicationType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,14 +375,18 @@ public boolean refresh() {

/**
* The replication type.
* @deprecated will be removed in 2.0.0. See https://github.com/elastic/elasticsearch/pull/10171
*/
@Deprecated
public ReplicationType replicationType() {
return this.replicationType;
}

/**
* Sets the replication type.
* @deprecated will be removed in 2.0.0. See https://github.com/elastic/elasticsearch/pull/10171
*/
@Deprecated
public UpdateRequest replicationType(ReplicationType replicationType) {
this.replicationType = replicationType;
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,9 @@ public UpdateRequestBuilder setRefresh(boolean refresh) {

/**
* Sets the replication type.
* @deprecated will be removed in 2.0.0. See https://github.com/elastic/elasticsearch/pull/10171
*/
@Deprecated
public UpdateRequestBuilder setReplicationType(ReplicationType replicationType) {
request.replicationType(replicationType);
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ public void handleRequest(final RestRequest request, final RestChannel channel,
String replicationType = request.param("replication");
if (replicationType != null) {
bulkRequest.replicationType(ReplicationType.fromString(replicationType));
logger.info("replication param has been deprecated and will be removed in 2.0");
}
String consistencyLevel = request.param("consistency");
if (consistencyLevel != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ public void handleRequest(final RestRequest request, final RestChannel channel,
String replicationType = request.param("replication");
if (replicationType != null) {
deleteByQueryRequest.replicationType(ReplicationType.fromString(replicationType));
logger.info("replication param has been deprecated and will be removed in 2.0");
}
String consistencyLevel = request.param("consistency");
if (consistencyLevel != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ public void handleRequest(final RestRequest request, final RestChannel channel,
String replicationType = request.param("replication");
if (replicationType != null) {
indexRequest.replicationType(ReplicationType.fromString(replicationType));
logger.info("replication param has been deprecated and will be removed in 2.0");
}
String consistencyLevel = request.param("consistency");
if (consistencyLevel != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public void handleRequest(final RestRequest request, final RestChannel channel,
String replicationType = request.param("replication");
if (replicationType != null) {
updateRequest.replicationType(ReplicationType.fromString(replicationType));
logger.info("replication param has been deprecated and will be removed in 2.0");
}
String consistencyLevel = request.param("consistency");
if (consistencyLevel != null) {
Expand Down

0 comments on commit d61f0d2

Please sign in to comment.