dbms: improvement [#METR-13153].

This commit is contained in:
Alexey Milovidov 2014-10-10 03:14:06 +04:00
parent 0d4390c176
commit a76db2ba78
3 changed files with 6 additions and 6 deletions

View File

@ -211,7 +211,7 @@ inline bool likePatternIsStrstr(const String & pattern, String & res)
{ {
res = ""; res = "";
if (pattern.size() < 2 || *pattern.begin() != '%' || *pattern.rbegin() != '%') if (pattern.size() < 2 || pattern.front() != '%' || pattern.back() != '%')
return false; return false;
res.reserve(pattern.size() * 2); res.reserve(pattern.size() * 2);

View File

@ -249,7 +249,7 @@ static size_t checkColumn(const String & path, const String & name, DataTypePtr
void MergeTreePartChecker::checkDataPart(String path, const Settings & settings, const DataTypeFactory & data_type_factory, void MergeTreePartChecker::checkDataPart(String path, const Settings & settings, const DataTypeFactory & data_type_factory,
MergeTreeData::DataPart::Checksums * out_checksums) MergeTreeData::DataPart::Checksums * out_checksums)
{ {
if (!path.empty() && *path.rbegin() != '/') if (!path.empty() && path.back() != '/')
path += "/"; path += "/";
NamesAndTypesList columns; NamesAndTypesList columns;

View File

@ -66,8 +66,8 @@ StorageReplicatedMergeTree::StorageReplicatedMergeTree(
log(&Logger::get(database_name_ + "." + table_name + " (StorageReplicatedMergeTree)")), log(&Logger::get(database_name_ + "." + table_name + " (StorageReplicatedMergeTree)")),
shutdown_event(false) shutdown_event(false)
{ {
if (!zookeeper_path.empty() && *zookeeper_path.rbegin() == '/') if (!zookeeper_path.empty() && zookeeper_path.back() == '/')
zookeeper_path.erase(zookeeper_path.end() - 1); zookeeper_path.resize(zookeeper_path.size() - 1);
replica_path = zookeeper_path + "/replicas/" + replica_name; replica_path = zookeeper_path + "/replicas/" + replica_name;
bool skip_sanity_checks = false; bool skip_sanity_checks = false;
@ -2837,8 +2837,8 @@ void StorageReplicatedMergeTree::getStatus(Status & res, bool with_zk_fields)
void StorageReplicatedMergeTree::fetchPartition(const Field & partition, bool unreplicated, const String & from_) void StorageReplicatedMergeTree::fetchPartition(const Field & partition, bool unreplicated, const String & from_)
{ {
String from = from_; String from = from_;
if (*from.rbegin() == '/') if (from.back() == '/')
from.erase(from.end() - 1); from.resize(from.size() - 1);
if (unreplicated) if (unreplicated)
throw Exception("Not implemented", ErrorCodes::NOT_IMPLEMENTED); /// TODO throw Exception("Not implemented", ErrorCodes::NOT_IMPLEMENTED); /// TODO