ClickHouse/dbms/programs/copier/ShardPartitionPiece.h

87 lines
2.4 KiB
C++
Raw Normal View History

2020-02-13 10:52:46 +00:00
#pragma once
#include "Internals.h"
namespace DB {
struct ShardPartitionPiece {
ShardPartitionPiece(ShardPartition &parent, size_t current_piece_number_, bool is_absent_piece_)
: is_absent_piece(is_absent_piece_), current_piece_number(current_piece_number_),
shard_partition(parent) {}
[[maybe_unused]] String getPartitionPiecePath() const;
[[maybe_unused]] String getPartitionPieceCleanStartPath() const;
[[maybe_unused]] String getPartitionPieceIsDirtyPath() const;
[[maybe_unused]] String getPartitionPieceIsCleanedPath() const;
[[maybe_unused]] String getPartitionPieceActiveWorkersPath() const;
[[maybe_unused]] String getActiveWorkerPath() const ;
/// On what shards do we have current partition.
[[maybe_unused]] String getPartitionPieceShardsPath() const;
[[maybe_unused]] String getShardStatusPath() const;
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
}