2020-02-13 10:52:46 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "Internals.h"
|
|
|
|
|
2020-03-17 18:07:54 +00:00
|
|
|
namespace DB
|
|
|
|
{
|
2020-02-13 10:52:46 +00:00
|
|
|
|
2020-03-17 18:07:54 +00:00
|
|
|
struct ShardPartitionPiece
|
|
|
|
{
|
2020-02-13 10:52:46 +00:00
|
|
|
|
2020-03-10 20:04:08 +00:00
|
|
|
ShardPartitionPiece(ShardPartition &parent, size_t current_piece_number_, bool is_present_piece_)
|
|
|
|
: is_absent_piece(!is_present_piece_), current_piece_number(current_piece_number_),
|
2020-02-13 10:52:46 +00:00
|
|
|
shard_partition(parent) {}
|
|
|
|
|
2020-03-17 18:07:54 +00:00
|
|
|
String getPartitionPiecePath() const;
|
2020-02-13 10:52:46 +00:00
|
|
|
|
2020-03-17 18:07:54 +00:00
|
|
|
String getPartitionPieceCleanStartPath() const;
|
2020-02-13 10:52:46 +00:00
|
|
|
|
2020-03-17 18:07:54 +00:00
|
|
|
String getPartitionPieceIsDirtyPath() const;
|
2020-02-13 10:52:46 +00:00
|
|
|
|
2020-03-17 18:07:54 +00:00
|
|
|
String getPartitionPieceIsCleanedPath() const;
|
2020-02-13 10:52:46 +00:00
|
|
|
|
2020-03-17 18:07:54 +00:00
|
|
|
String getPartitionPieceActiveWorkersPath() const;
|
2020-02-13 10:52:46 +00:00
|
|
|
|
2020-03-17 18:07:54 +00:00
|
|
|
String getActiveWorkerPath() const ;
|
2020-02-13 10:52:46 +00:00
|
|
|
|
|
|
|
/// On what shards do we have current partition.
|
2020-03-17 18:07:54 +00:00
|
|
|
String getPartitionPieceShardsPath() const;
|
2020-02-13 10:52:46 +00:00
|
|
|
|
2020-03-17 18:07:54 +00:00
|
|
|
String getShardStatusPath() const;
|
2020-02-13 10:52:46 +00:00
|
|
|
|
2020-02-20 18:58:00 +00:00
|
|
|
String getPartitionPieceCleanerPath() const;
|
|
|
|
|
2020-02-13 10:52:46 +00:00
|
|
|
bool is_absent_piece;
|
|
|
|
const size_t current_piece_number;
|
|
|
|
|
|
|
|
ShardPartition & shard_partition;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2020-02-20 10:01:02 +00:00
|
|
|
inline String ShardPartitionPiece::getPartitionPiecePath() const
|
2020-02-13 10:52:46 +00:00
|
|
|
{
|
2020-02-21 16:00:50 +00:00
|
|
|
return shard_partition.getPartitionPath() + "/piece_" + toString(current_piece_number);
|
2020-02-13 10:52:46 +00:00
|
|
|
}
|
|
|
|
|
2020-02-20 10:01:02 +00:00
|
|
|
inline String ShardPartitionPiece::getPartitionPieceCleanStartPath() const
|
2020-02-13 10:52:46 +00:00
|
|
|
{
|
|
|
|
return getPartitionPiecePath() + "/clean_start";
|
|
|
|
}
|
|
|
|
|
2020-02-20 10:01:02 +00:00
|
|
|
inline String ShardPartitionPiece::getPartitionPieceIsDirtyPath() const
|
2020-02-13 10:52:46 +00:00
|
|
|
{
|
|
|
|
return getPartitionPiecePath() + "/is_dirty";
|
|
|
|
}
|
|
|
|
|
2020-02-20 10:01:02 +00:00
|
|
|
inline String ShardPartitionPiece::getPartitionPieceIsCleanedPath() const
|
2020-02-13 10:52:46 +00:00
|
|
|
{
|
2020-02-21 16:00:50 +00:00
|
|
|
return getPartitionPieceIsDirtyPath() + "/cleaned";
|
2020-02-13 10:52:46 +00:00
|
|
|
}
|
|
|
|
|
2020-02-20 10:01:02 +00:00
|
|
|
inline String ShardPartitionPiece::getPartitionPieceActiveWorkersPath() const
|
2020-02-13 10:52:46 +00:00
|
|
|
{
|
2020-02-20 17:26:20 +00:00
|
|
|
return getPartitionPiecePath() + "/partition_piece_active_workers";
|
2020-02-13 10:52:46 +00:00
|
|
|
}
|
|
|
|
|
2020-02-20 10:01:02 +00:00
|
|
|
inline String ShardPartitionPiece::getActiveWorkerPath() const
|
2020-02-13 10:52:46 +00:00
|
|
|
{
|
|
|
|
return getPartitionPieceActiveWorkersPath() + "/" + toString(shard_partition.task_shard.numberInCluster());
|
|
|
|
}
|
|
|
|
|
|
|
|
/// On what shards do we have current partition.
|
2020-02-20 10:01:02 +00:00
|
|
|
inline String ShardPartitionPiece::getPartitionPieceShardsPath() const
|
2020-02-13 10:52:46 +00:00
|
|
|
{
|
|
|
|
return getPartitionPiecePath() + "/shards";
|
|
|
|
}
|
|
|
|
|
2020-02-20 10:01:02 +00:00
|
|
|
inline String ShardPartitionPiece::getShardStatusPath() const
|
2020-02-13 10:52:46 +00:00
|
|
|
{
|
|
|
|
return getPartitionPieceShardsPath() + "/" + toString(shard_partition.task_shard.numberInCluster());
|
|
|
|
}
|
|
|
|
|
2020-02-20 18:58:00 +00:00
|
|
|
inline String ShardPartitionPiece::getPartitionPieceCleanerPath() const
|
|
|
|
{
|
|
|
|
return getPartitionPieceIsDirtyPath() + "/cleaner";
|
|
|
|
}
|
|
|
|
|
2020-02-13 10:52:46 +00:00
|
|
|
|
|
|
|
}
|