Skip to content

Conversation

@dakrone
Copy link
Member

@dakrone dakrone commented Feb 17, 2015

These commits add the shadow replicas feature for use on shared filesystems
(it does not include segment replication for non-shared filesystems yet).

If we assume that the data in the index path will already be shared across
multiple nodes, we can create and index with shadow replicas, where each replica
shard simply contains an IndexReader that periodically refreshes to pick up
new segments.

All indexing operations will be executed on the primary shard, and will not be
replicated to each replica, since the data will be replicated in a different
way.

During this phase, creating an index with index.shadow_replicas: true and
number_of_replicas greater than 0 will cause operations not to undergo
replication to replica shards. An index can have either regular replicas or
shadow replicas; they are mutually exclusive for an index. The
index.shadow_replicas setting is set at index creation time and cannot be
changed dynamically.

The Elasticsearch cluster will still detect the loss of a primary shard, and
transform the replica into a primary in this situation. This transformation will
take slightly longer, since no IndexWriter will be maintained for each shadow
replica.

In order to ensure the data is being synchronized in a fast enough manner, The
user will need to tune the flush threshold for the index to a desired number. A
flush is needed to fsync segment files to disk, so they will be visible to all
other replica nodes. Users should test what flush threshold levels they are
comfortable with, as increased flushing can impact indexing performance. This
testing can be performed at any time, there is no need to wait for this feature
to be available first.

Once segments are available on the filesystem where the shadow replica resides,
a regular refresh (governed by the index.refresh_interval) can be used to make
the new data searchable.

See #8976 for the overall shadow replica plan

dakrone and others added 30 commits February 10, 2015 13:10
Conflicts:
	src/main/java/org/elasticsearch/gateway/GatewayMetaState.java
make flush to a refresh
factor our ShadowIndexShard to have IndexShard be idential to the master and least intrusive

cleanup abstractions
Conflicts:
	src/main/java/org/elasticsearch/index/engine/Engine.java
…dler that skip

most phases and enforces shard closing on the soruce before the target opens it's engine
Copy link
Member

Choose a reason for hiding this comment

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

I would clarify this statement? cause mapping updates do get replicated, it just takes longer since it needs to head to the master and then published to the replicas, so there is a delay in mapping introduction.

Copy link
Member Author

Choose a reason for hiding this comment

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

I will clarify this comment

Copy link
Member

Choose a reason for hiding this comment

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

can we use the same method structure between this method and the following? I like isIndex...

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep, I'll rename.

@dakrone
Copy link
Member Author

dakrone commented Feb 18, 2015

@s1monw I added a MockShadowEngine and addressed your other comments

Copy link
Member

Choose a reason for hiding this comment

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

should we use the IndexMetaData#isIndexUsingShadowReplicas help method here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I will change this to use the helper

@kimchy
Copy link
Member

kimchy commented Feb 18, 2015

left really minor comments, it looks great. One note, should we mention in the docs the second phase tasks, like do primary promotion without failing an engine? If so, I would also add a task that on get, we automatically set the "go to primary" flag if shadow replica is used and realtime get is used?

@s1monw
Copy link
Contributor

s1monw commented Feb 18, 2015

left two more comments other than that LGTM

@dakrone
Copy link
Member Author

dakrone commented Feb 18, 2015

Pushed more commits hooking up the MockShadowEngine, moving the engine creation into the ShadowIndexShard and automatically using ?preference=_primary when doing a realtime GET.

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 use org.elasticsearch.cluster.routing.operation.plain.Preference.PRIMARY.type() here instead?

@s1monw
Copy link
Contributor

s1monw commented Feb 18, 2015

left on minor comment! LGTM feel free to push!

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for this!

@dakrone
Copy link
Member Author

dakrone commented Feb 19, 2015

pushed to 1.x and master!

@dakrone dakrone closed this Feb 19, 2015
@clintongormley clintongormley added :Distributed Indexing/Store Issues around managing unopened Lucene indices. If it touches Store.java, this is a likely label. :Engine and removed review :Distributed Indexing/Store Issues around managing unopened Lucene indices. If it touches Store.java, this is a likely label. labels Mar 19, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants