Skip to content

Commit 5c5d89d

Browse files
author
wuxianrong
committed
code format
1 parent 08f1a85 commit 5c5d89d

6 files changed

Lines changed: 13 additions & 26 deletions

File tree

src/pika_client_conn.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ std::shared_ptr<Cmd> PikaClientConn::DoCmd(const PikaCmdArgsType& argv, const st
5050
}
5151
return tmp_ptr;
5252
}
53-
5453
c_ptr->SetCacheMissedInRtc(cache_miss_in_rtc);
5554
c_ptr->SetConn(shared_from_this());
5655
c_ptr->SetResp(resp_ptr);
@@ -219,7 +218,6 @@ std::shared_ptr<Cmd> PikaClientConn::DoCmd(const PikaCmdArgsType& argv, const st
219218
rocksdb::get_perf_context()->Reset();
220219
// Process Command
221220
c_ptr->Execute();
222-
223221
time_stat_->process_done_ts_ = pstd::NowMicros();
224222
auto cmdstat_map = g_pika_cmd_table_manager->GetCommandStatMap();
225223
(*cmdstat_map)[opt].cmd_count.fetch_add(1);

src/pika_kv.cc

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,7 @@ void DelCmd::DoInitial() {
206206
}
207207

208208
void DelCmd::Do() {
209-
210209
int64_t count = db_->storage()->Del(keys_);
211-
212210
if (count >= 0) {
213211
res_.AppendInteger(count);
214212
s_ = rocksdb::Status::OK();
@@ -228,11 +226,7 @@ void DelCmd::DoThroughDB() {
228226

229227
void DelCmd::DoUpdateCache() {
230228
if (s_.ok()) {
231-
std::vector<std::string> v;
232-
for (auto key : keys_) {
233-
v.emplace_back(key);
234-
}
235-
db_->cache()->Del(v);
229+
db_->cache()->Del(keys_);
236230
}
237231
}
238232

@@ -1228,7 +1222,6 @@ void SetrangeCmd::DoThroughDB() {
12281222

12291223
void SetrangeCmd::DoUpdateCache() {
12301224
if (s_.ok()) {
1231-
12321225
STAGE_TIMER_GUARD(cache_duration_ms, true);
12331226
db_->cache()->SetRangeIfKeyExist(key_, offset_, value_);
12341227
}
@@ -1341,7 +1334,7 @@ void ExpireCmd::DoInitial() {
13411334
}
13421335

13431336
void ExpireCmd::Do() {
1344-
int64_t res = db_->storage()->Expire(key_, ttl_sec_ * 1000);
1337+
int32_t res = db_->storage()->Expire(key_, ttl_sec_ * 1000);
13451338
if (res != -1) {
13461339
res_.AppendInteger(res);
13471340
s_ = rocksdb::Status::OK();
@@ -1396,7 +1389,6 @@ void PexpireCmd::DoInitial() {
13961389
}
13971390

13981391
void PexpireCmd::Do() {
1399-
14001392
int64_t res = db_->storage()->Expire(key_, ttl_millsec);
14011393
if (res != -1) {
14021394
res_.AppendInteger(res);
@@ -1452,7 +1444,7 @@ void ExpireatCmd::DoInitial() {
14521444
}
14531445

14541446
void ExpireatCmd::Do() {
1455-
int32_t res = db_->storage()->Expireat(key_, time_stamp_sec_ * 100);
1447+
int32_t res = db_->storage()->Expireat(key_, time_stamp_sec_ * 1000);
14561448
if (res != -1) {
14571449
res_.AppendInteger(res);
14581450
s_ = rocksdb::Status::OK();
@@ -1527,7 +1519,7 @@ void TtlCmd::ReadCache() {
15271519
if (timestamp == -3) {
15281520
res_.SetRes(CmdRes::kErrOther, "ttl internal error");
15291521
} else if (timestamp != -2) {
1530-
res_.AppendInteger(timestamp);
1522+
res_.AppendInteger(timestamp);
15311523
} else {
15321524
res_.SetRes(CmdRes::kCacheMiss);
15331525
}
@@ -1551,12 +1543,12 @@ void PttlCmd::Do() {
15511543
if (ttl_millsec == -3) {
15521544
res_.SetRes(CmdRes::kErrOther, "ttl internal error");
15531545
} else {
1554-
// mean this key not exist
1555-
res_.AppendInteger(-2);
1546+
res_.AppendInteger(ttl_millsec);
15561547
}
15571548
}
15581549

15591550
void PttlCmd::ReadCache() {
1551+
// redis cache don't support pttl cache, so read directly from db
15601552
DoThroughDB();
15611553
}
15621554

@@ -1602,7 +1594,8 @@ void TypeCmd::DoInitial() {
16021594
key_ = argv_[1];
16031595
}
16041596

1605-
void TypeCmd::Do() { enum storage::DataType type = storage::DataType::kNones;
1597+
void TypeCmd::Do() {
1598+
enum storage::DataType type = storage::DataType::kNones;
16061599
std::string key_type;
16071600
rocksdb::Status s = db_->storage()->GetType(key_, type);
16081601
if (s.ok()) {

src/pika_list.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ void LLenCmd::ReadCache() {
138138
uint64_t llen = 0;
139139
STAGE_TIMER_GUARD(cache_duration_ms, true);
140140
auto s = db_->cache()->LLen(key_, &llen);
141-
if (s.ok()){
141+
if (s.ok()) {
142142
res_.AppendInteger(llen);
143143
} else if (s.IsNotFound()) {
144144
res_.SetRes(CmdRes::kCacheMiss);

src/pika_set.cc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,6 @@ void SRemCmd::DoUpdateCache() {
333333
}
334334
}
335335

336-
337336
void SUnionCmd::DoInitial() {
338337
if (!CheckArg(argv_.size())) {
339338
res_.SetRes(CmdRes::kWrongNum, kCmdNameSUnion);
@@ -526,7 +525,6 @@ void SIsmemberCmd::Do() {
526525
}
527526

528527
void SIsmemberCmd::ReadCache() {
529-
530528
STAGE_TIMER_GUARD(cache_duration_ms, true);
531529
auto s = db_->cache()->SIsmember(key_, member_);
532530
if (s.ok()) {
@@ -730,7 +728,6 @@ void SRandmemberCmd::Do() {
730728

731729
void SRandmemberCmd::ReadCache() {
732730
std::vector<std::string> members;
733-
734731
STAGE_TIMER_GUARD(cache_duration_ms, true);
735732
auto s = db_->cache()->SRandmember(key_, count_, &members);
736733
if (s.ok()) {

src/pika_zset.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1441,8 +1441,7 @@ void ZRemrangebyrankCmd::DoThroughDB() {
14411441
}
14421442

14431443
void ZRemrangebyrankCmd::DoUpdateCache() {
1444-
if (s_.ok()) {
1445-
1444+
if (s_.ok()) {
14461445
STAGE_TIMER_GUARD(cache_duration_ms, true);
14471446
db_->cache()->ZRemrangebyrank(key_, min_, max_, ele_deleted_, db_);
14481447
}

tools/pika_exporter/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ GITREV := $(shell git rev-parse HEAD)
88
BUILDTIME := $(shell date '+%F %T %Z')
99
COMPILERVERSION := $(subst go version ,,$(shell go version))
1010
PROJNAME := pika_exporter
11-
PIKA_EXPORTER_MAJOR := 3
12-
PIKA_EXPORTER_MINOR := 5
13-
PIKA_EXPORTER_PATCH := 5
11+
PIKA_EXPORTER_MAJOR := 4
12+
PIKA_EXPORTER_MINOR := 0
13+
PIKA_EXPORTER_PATCH := 2
1414

1515
define GENERATE_VERSION_CODE
1616
cat << EOF | gofmt > version.go

0 commit comments

Comments
 (0)