Skip to content

Commit

Permalink
optimize bulk index creation
Browse files Browse the repository at this point in the history
  • Loading branch information
mfussenegger committed May 20, 2015
1 parent acc34cc commit 6d15c2e
Show file tree
Hide file tree
Showing 12 changed files with 575 additions and 215 deletions.
6 changes: 6 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ unreleased
- Fix: Updated es/upstream to prevent errors caused by too many cluster
state updates when dropping tables with a huge amount of partitions

- Fixed an issue that caused a node stop to always take up at least 10 seconds

- Further improved bulk partition creation which can occur during ``COPY
FROM`` or INSERTS with multi-values into partitioned tables


2015/05/15 0.48.5
=================

Expand Down

This file was deleted.

2 changes: 1 addition & 1 deletion es/upstream
1 change: 0 additions & 1 deletion sql/src/main/java/io/crate/service/SQLService.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ protected void doStart() throws ElasticsearchException {

@Override
protected void doStop() throws ElasticsearchException {

}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,14 @@ public class BulkCreateIndicesRequest extends AcknowledgedRequest<BulkCreateIndi

private List<CreateIndexRequest> createIndexRequests;

private boolean ignoreExisting = false;

/**
* Constructs a new request to create indices with the specified names.
*/
public BulkCreateIndicesRequest(Collection<String> indices) {
// TODO: optimize this request to only serialize collection<string> indices
// and more importantly: The BulkCreateIndices transport doesn't really support the other options
// (like mappings, aliases) within the CreateIndexRequests
// so this is just confusing
this.createIndexRequests = new ArrayList<>(indices.size());
for (String index : indices) {
this.createIndexRequests.add(new CreateIndexRequest(index));
Expand All @@ -58,32 +60,10 @@ public BulkCreateIndicesRequest(Collection<String> indices) {
BulkCreateIndicesRequest() {
}

public boolean ignoreExisting() {
return ignoreExisting;
}

public BulkCreateIndicesRequest ignoreExisting(boolean ignoreExisting) {
this.ignoreExisting = ignoreExisting;
return this;
}

public BulkCreateIndicesRequest requests(List<CreateIndexRequest> requests) {
this.createIndexRequests = requests;
return this;
}

public Collection<CreateIndexRequest> requests() {
return createIndexRequests;
}

public BulkCreateIndicesRequest add(CreateIndexRequest createIndexRequest) {
if (createIndexRequests == null) {
createIndexRequests = Lists.newArrayList();
}
createIndexRequests.add(createIndexRequest);
return this;
}

@Override
public ActionRequestValidationException validate() {
ActionRequestValidationException validationException = null;
Expand Down Expand Up @@ -118,7 +98,7 @@ public IndicesOptions indicesOptions() {
@Override
public void readFrom(StreamInput in) throws IOException {
super.readFrom(in);
ignoreExisting = in.readBoolean();
in.readBoolean();
int numRequests = in.readVInt();
createIndexRequests = new ArrayList<>(numRequests);
for (int i = 0; i < numRequests; i++) {
Expand All @@ -131,7 +111,7 @@ public void readFrom(StreamInput in) throws IOException {
@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
out.writeBoolean(ignoreExisting);
out.writeBoolean(true); // used to be ignoreExisting setting; here for binary compat. - remove for next feature release

if (createIndexRequests == null) {
out.writeVInt(0);
Expand Down
Loading

0 comments on commit 6d15c2e

Please sign in to comment.