chore: adjust verbosity level 1 not be over-verbose in prod (#1974)

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
This commit is contained in:
Roman Gershman 2023-10-01 14:31:39 +03:00 committed by GitHub
parent 43d55fa6d7
commit 4be9551806
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 20 additions and 21 deletions

View file

@ -161,7 +161,8 @@ bool PrimeEvictionPolicy::CanGrow(const PrimeTable& tbl) const {
size_t new_available = (tbl.capacity() - tbl.size()) + PrimeTable::kSegCapacity;
bool res = mem_budget_ >
int64_t(PrimeTable::kSegBytes + db_slice_->bytes_per_object() * new_available * 1.1);
VLOG(1) << "available: " << new_available << ", res: " << res;
VLOG(2) << "available: " << new_available << ", res: " << res;
return res;
}
@ -377,7 +378,7 @@ OpResult<pair<PrimeIterator, unsigned>> DbSlice::FindFirst(const Context& cntx,
return res.status();
}
VLOG(1) << "FindFirst " << args.front() << " not found";
VLOG(2) << "FindFirst " << args.front() << " not found";
return OpStatus::KEY_NOTFOUND;
}
@ -426,7 +427,7 @@ tuple<PrimeIterator, ExpireIterator, bool> DbSlice::AddOrFind2(const Context& cn
// If we are over limit in non-cache scenario, just be conservative and throw.
if (apply_memory_limit && !caching_mode_ && evp.mem_budget() < 0) {
VLOG(1) << "AddOrFind2: over limit, budget: " << evp.mem_budget();
VLOG(2) << "AddOrFind2: over limit, budget: " << evp.mem_budget();
events_.insertion_rejections++;
throw bad_alloc();
}
@ -441,7 +442,7 @@ tuple<PrimeIterator, ExpireIterator, bool> DbSlice::AddOrFind2(const Context& cn
try {
tie(it, inserted) = db.prime.Insert(std::move(co_key), PrimeValue{}, evp);
} catch (bad_alloc& e) {
VLOG(1) << "AddOrFind2: bad alloc exception, budget: " << evp.mem_budget();
VLOG(2) << "AddOrFind2: bad alloc exception, budget: " << evp.mem_budget();
events_.insertion_rejections++;
throw e;

View file

@ -75,9 +75,9 @@ struct TransactionGuard {
};
explicit TransactionGuard(Transaction* t, bool disable_expirations = false) : t(t) {
VLOG(1) << "Transaction guard try schedule";
VLOG(2) << "Transaction guard try schedule";
t->Schedule();
VLOG(1) << "Transaction guard schedule";
VLOG(2) << "Transaction guard schedule";
t->Execute(
[disable_expirations](Transaction* t, EngineShard* shard) {
if (disable_expirations) {
@ -86,11 +86,11 @@ struct TransactionGuard {
return OpStatus::OK;
},
false);
VLOG(1) << "Transaction guard engaged";
VLOG(2) << "Transaction guard engaged";
}
~TransactionGuard() {
VLOG(1) << "Releasing transaction guard";
VLOG(2) << "Releasing transaction guard";
t->Execute(ExitGuardCb, true);
}

View file

@ -110,7 +110,7 @@ void EngineShard::DefragTaskState::ResetScanState() {
// (control by mem_defrag_waste_threshold flag)
bool EngineShard::DefragTaskState::CheckRequired() {
if (cursor > kCursorDoneState || underutilized_found) {
VLOG(1) << "cursor: " << cursor << " and underutilized_found " << underutilized_found;
VLOG(2) << "cursor: " << cursor << " and underutilized_found " << underutilized_found;
return true;
}
@ -209,7 +209,7 @@ uint32_t EngineShard::DefragTask() {
const auto shard_id = db_slice().shard_id();
if (defrag_state_.CheckRequired()) {
VLOG(1) << shard_id << ": need to run defrag memory cursor state: " << defrag_state_.cursor
VLOG(2) << shard_id << ": need to run defrag memory cursor state: " << defrag_state_.cursor
<< ", underutilzation found: " << defrag_state_.underutilized_found;
if (DoDefrag()) {
// we didn't finish the scan
@ -526,7 +526,7 @@ void EngineShard::RunPeriodic(std::chrono::milliseconds period_ms) {
while (true) {
Heartbeat();
if (fiber_periodic_done_.WaitFor(period_ms)) {
VLOG(1) << "finished running engine shard periodic task";
VLOG(2) << "finished running engine shard periodic task";
return;
}
}

View file

@ -2170,7 +2170,7 @@ error_code RdbLoaderBase::HandleJournalBlob(Service* service) {
return RdbError(errc::unsupported_operation);
}
VLOG(1) << "Executing item: " << entry.ToString();
DVLOG(2) << "Executing item: " << entry.ToString();
ex.Execute(entry.dbid, entry.cmd);
}
@ -2333,7 +2333,7 @@ error_code RdbLoader::LoadKeyValPair(int type, ObjSettings* settings) {
* assume to work in an exact keyspace state. */
if (ServerState::tlocal()->is_master && settings->has_expired) {
VLOG(1) << "Expire key: " << item->key;
VLOG(2) << "Expire key: " << item->key;
return kOk;
}

View file

@ -130,10 +130,8 @@ bool AbslParseFlag(std::string_view in, ReplicaOfFlag* flag, std::string* err) {
RETURN_ON_ERROR(ip.length() <= 2, "IPv6 host name is too short");
flag->host = ip.substr(1, ip.length() - 2);
VLOG(1) << "received IP of type IPv6: " << flag->host;
} else {
flag->host = ip;
VLOG(1) << "received IP of type IPv4 (or a host): " << flag->host;
}
VLOG(1) << "--replicaof: Received " << flag->host << " : " << flag->port;
@ -1647,7 +1645,7 @@ void ServerFamily::ReplicaOfInternal(string_view host, string_view port_sv, Conn
// 2. Leave the DB in a consistent state after it is done.
// We have a relatively involved state machine inside Replica itself which handels cancellation
// with those requirements.
VLOG(1) << "Acquire replica lock";
VLOG(2) << "Acquire replica lock";
unique_lock lk(replicaof_mu_);
if (IsReplicatingNoOne(host, port_sv)) {
@ -1705,7 +1703,7 @@ void ServerFamily::ReplicaOfInternal(string_view host, string_view port_sv, Conn
break;
};
VLOG(1) << "Acquire replica lock";
VLOG(2) << "Acquire replica lock";
lk.lock();
// Since we released the replication lock during Start(..), we need to check if this still the
@ -1746,8 +1744,8 @@ void ServerFamily::Replicate(string_view host, string_view port) {
}
void ServerFamily::ReplTakeOver(CmdArgList args, ConnectionContext* cntx) {
VLOG(1) << "Starting take over";
VLOG(1) << "Acquire replica lock";
VLOG(1) << "ReplTakeOver start";
unique_lock lk(replicaof_mu_);
float_t timeout_sec;
@ -1842,11 +1840,11 @@ void ServerFamily::ReplConf(CmdArgList args, ConnectionContext* cntx) {
LOG(ERROR) << "Bad int in REPLCONF ACK command! arg=" << arg;
return;
}
VLOG(1) << "Received client ACK=" << ack;
VLOG(2) << "Received client ACK=" << ack;
cntx->replication_flow->last_acked_lsn = ack;
return;
} else {
VLOG(1) << cmd << " " << arg << " " << args.size();
VLOG(1) << "Error " << cmd << " " << arg << " " << args.size();
goto err;
}
}