Skip to content

Commit

Permalink
make COMPACT_LOG_MIN_PERIOD 0 as default (#719)
Browse files Browse the repository at this point in the history
Signed-off-by: Tong Zhigao <[email protected]>
  • Loading branch information
solotzg authored May 26, 2020
1 parent 66898e3 commit 4f6adba
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 18 deletions.
8 changes: 4 additions & 4 deletions dbms/src/Storages/Transaction/KVStore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -324,20 +324,20 @@ TiFlashApplyRes KVStore::handleAdminRaftCmd(raft_cmdpb::AdminRequest && request,
case raft_cmdpb::AdminCmdType::CompactLog:
{
if (curr_region.lastCompactLogTime() + REGION_COMPACT_LOG_PERIOD.load(std::memory_order_relaxed) > Clock::now())
{
sync_log = false;
LOG_DEBUG(log, curr_region.toString(false) << " ignore compact log cmd");
}
else
{
curr_region.markCompactLog();
LOG_INFO(log, curr_region.toString(true) << " make proxy compact log");
}
break;
}
case raft_cmdpb::AdminCmdType::VerifyHash:
case raft_cmdpb::AdminCmdType::ComputeHash:
{
static const Seconds REGION_MAX_PERSIST_PERIOD(60 * 20);
if (curr_region.lastPersistTime() + REGION_MAX_PERSIST_PERIOD > Clock::now())
sync_log = false;
sync_log = false;
break;
}
default:
Expand Down
8 changes: 0 additions & 8 deletions dbms/src/Storages/Transaction/Region.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,10 +282,6 @@ void RegionRaftCommandDelegate::handleAdminRaftCmd(const raft_cmdpb::AdminReques
{
case raft_cmdpb::AdminCmdType::ComputeHash:
case raft_cmdpb::AdminCmdType::VerifyHash:
case raft_cmdpb::AdminCmdType::CompactLog:
LOG_INFO(log,
toString(false) << " useless admin command " << raft_cmdpb::AdminCmdType_Name(type) << " at [term: " << term
<< ", index: " << index << "]");
break;
default:
LOG_INFO(log,
Expand Down Expand Up @@ -450,10 +446,6 @@ std::string Region::dataInfo() const
return ss.str();
}

void Region::markPersisted() const { last_persist_time = Clock::now(); }

Timepoint Region::lastPersistTime() const { return last_persist_time; }

void Region::markCompactLog() const { last_compact_log_time = Clock::now(); }

Timepoint Region::lastCompactLogTime() const { return last_compact_log_time; }
Expand Down
3 changes: 0 additions & 3 deletions dbms/src/Storages/Transaction/Region.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,6 @@ class Region : public std::enable_shared_from_this<Region>
size_t writeCFCount() const;
std::string dataInfo() const;

void markPersisted() const;
Timepoint lastPersistTime() const;

void markCompactLog() const;
Timepoint lastCompactLogTime() const;

Expand Down
2 changes: 0 additions & 2 deletions dbms/src/Storages/Transaction/RegionPersister.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ void RegionPersister::doPersist(const Region & region, const RegionTaskLock * lo
doPersist(region_buffer, *lock, region);
else
doPersist(region_buffer, region_manager.genRegionTaskLock(region.id()), region);

region.markPersisted();
}

void RegionPersister::doPersist(RegionCacheWriteElement & region_write_buffer, const RegionTaskLock &, const Region & region)
Expand Down
2 changes: 1 addition & 1 deletion dbms/src/Storages/Transaction/TMTContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ void TMTContext::reloadConfig(const Poco::Util::AbstractConfiguration & config)
static const std::string & COMPACT_LOG_MIN_PERIOD = "flash.compact_log_min_period";

getRegionTable().setTableCheckerThreshold(config.getDouble(TABLE_OVERLAP_THRESHOLD, 0.6));
getKVStore()->setRegionCompactLogPeriod(Seconds{config.getUInt64(COMPACT_LOG_MIN_PERIOD, 200)});
getKVStore()->setRegionCompactLogPeriod(Seconds{config.getUInt64(COMPACT_LOG_MIN_PERIOD, 0)});
}

const std::atomic_bool & TMTContext::getTerminated() const { return terminated; }
Expand Down

0 comments on commit 4f6adba

Please sign in to comment.