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
Move to one data.path per shard #10461
Conversation
FYI this is a first cut at this feature so it's not perfect but it mirrors the direction pretty well.. |
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove empty javadoc?
7385f37
to
c82b8e3
Compare
if (Files.exists(path.resolve(MetaDataStateFormat.STATE_DIR_NAME))) { | ||
numPathsExist++; | ||
} | ||
if (numPathsExist > 1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This if can be moved inside the one above it.
If ES crashes/is killed while a shard is being upgraded that shard is now corrupt right? Because we have moved some but not all files? Maybe in the upgrade release notes we strongly suggest taking snapshot before (maybe we do this already)? |
return dataPaths[i]; | ||
} | ||
} | ||
Path maxUseablePath = dataPaths[0]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extra 'e' here too
that is a great question, the answer is no IMO. Today if you have multiple datapaths and distributor directory you can stop upgradeing in the middle and still being able to open it with 1.x and you distributor dir. The distiributor doesn't care where the files are and we don't delete before we have successfully moved them so I think we are ok here? |
@@ -58,7 +57,7 @@ public DanglingIndicesState(Settings settings, NodeEnvironment nodeEnv, MetaStat | |||
* Process dangling indices based on the provided meta data, handling cleanup, finding | |||
* new dangling indices, and allocating outstanding ones. | |||
*/ | |||
public void processDanglingIndices(MetaData metaData) { | |||
public void processDanglingIndices(MetaData metaData){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lost a space.
I love this change, I love all the stuff that's removed! I left some minor comments... |
Oh I see, because on restart, the distributor will just look around and find where the file resides and just open it there? Good! Hmm but what about the non-atomic move case? Does Files.move behave well if JVM crashes while it's running? E.g. copy to a temp file on the dest file store and then do an atomic rename in the end? |
yeah but when do you remove the source file, there is always a window here I guess? |
@mikemccand I pushed changes according to your comments, and merged with master |
} | ||
|
||
// nocommit - we need something more extensible but this does the job for now... | ||
public static ShardPath findShardPath(NodeEnvironment env, ShardId shardId, @IndexSettings Settings indexSettings) throws IOException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we name this selectNewPathForShard? , to contrast it from loadShardPath
(findShardPath sounds to me like go and find an existing shard path).
I this is good. Left little concerns/comments/suggestions here and there. |
@bleskes I pushed another commit adressing your comments. @mikemccand I moved to a more pessimistic model give your comments too by using atomic move etc. can you take another look |
@mikemccand pushed a new commit |
LGTM, thanks @s1monw! |
logger.info("{} upgrading multi data dir to {}", shard, targetPath.getDataPath()); | ||
final ShardStateMetaData loaded = ShardStateMetaData.FORMAT.loadLatestState(logger, paths); | ||
if (loaded == null) { | ||
throw new IllegalStateException(shard + " no shard state found in any of: [" + Arrays.toString(paths) + "] please check and remove them if possible"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Arrays.toString(paths)
already adds [] , no need to add them
Thx @s1monw looks great. I left some very minor comment and replied to your question about #10461 (comment) |
@bleskes pushed one more commit - would you mind taking a look |
Path[] paths = env.availableShardPaths(shardId); | ||
Path path = randomFrom(paths); | ||
assumeTrue(paths.length > 1); | ||
int id = randomIntBetween(1, 10); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should remove path from paths. otherwise we write only one shard state no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pardon? ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nevermind. Misread the test. It actually writes a shard copy to all paths.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed the second state creation
LGTM. Left one comment we agreed to solve on a follow up issue. |
91488c5
to
3c76333
Compare
This commit moves away from using stripe RAID-0 simumlation across multiple data paths towards using a single path per shard. Multiple data paths are still supported but shards and it's data is not striped across multiple paths / disks. This will for instance prevent to loose all shards if a single disk is corrupted. Indices that are using this features already will automatically upgraded to a single datapath based on a simple diskspace based heuristic. In general there must be enough diskspace to move a single shard at any time otherwise the upgrade will fail. Closes elastic#9498
6b393be
to
5730c06
Compare
This commit moves away from using stripe RAID-0 simumlation across multiple
data paths towards using a single path per shard. Multiple data paths are still
supported but shards and it's data is not striped across multiple paths / disks.
This will for instance prevent to loose all shards if a single disk is corrupted.
Indices that are using this features already will automatically upgraded to a single
datapath based on a simple diskspace based heuristic. In general there must be enough
diskspace to move a single shard at any time otherwise the upgrade will fail.
Closes #9498