Skip to content

Commit

Permalink
Windows compilation fix (#568)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuval-Ariel authored and udi-speedb committed Dec 5, 2023
1 parent d34e3cd commit 5564ddb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion db/db_impl/db_spdb_impl_write.cc
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ void SpdbWriteImpl::SwitchAndWriteBatchGroup(WritesBatchList* batch_group) {
io_s = db_->SpdbWriteToWAL(wal_batch, 1, to_be_cached_state,
batch_group->need_sync_, &offset, &size);
} else {
uint64_t progress_batch_seq;
uint64_t progress_batch_seq = 0;
size_t wal_writes = 0;
WriteBatch* merged_batch = &tmp_batch_;
for (const WriteBatch* batch : batch_group->wal_writes_) {
Expand Down
4 changes: 2 additions & 2 deletions include/rocksdb/write_buffer_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -308,11 +308,11 @@ class WriteBufferManager final {
return ParseCodedUsageState(GetCodedUsageState());
}

void UpdateUsageState(size_t new_memory_used, ssize_t mem_changed_size,
void UpdateUsageState(size_t new_memory_used, int64_t mem_changed_size,
size_t quota);

uint64_t CalcNewCodedUsageState(size_t new_memory_used,
ssize_t memory_changed_size, size_t quota,
int64_t memory_changed_size, size_t quota,
uint64_t old_coded_usage_state);

uint64_t GetCodedUsageState() const {
Expand Down
14 changes: 7 additions & 7 deletions memtable/write_buffer_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ void WriteBufferManager::ReserveMem(size_t mem) {
new_memory_used = old_memory_used + mem;
}
if (is_enabled) {
UpdateUsageState(new_memory_used, mem, buffer_size());
UpdateUsageState(new_memory_used, static_cast<int64_t>(mem), buffer_size());
// Checking outside the locks is not reliable, but avoids locking
// unnecessarily which is expensive
if (UNLIKELY(ShouldInitiateAnotherFlushMemOnly(new_memory_used))) {
Expand Down Expand Up @@ -172,7 +172,8 @@ void WriteBufferManager::FreeMem(size_t mem) {
assert(curr_memory_inactive >= mem);
assert(curr_memory_being_freed >= mem);

UpdateUsageState(new_memory_used, -mem, buffer_size());
UpdateUsageState(new_memory_used, static_cast<int64_t>(-mem),
buffer_size());
}

// Check if stall is active and can be ended.
Expand Down Expand Up @@ -431,15 +432,14 @@ void WriteBufferManager::UpdateControllerDelayState() {
}

uint64_t WriteBufferManager::CalcNewCodedUsageState(
size_t new_memory_used, ssize_t memory_changed_size, size_t quota,
size_t new_memory_used, int64_t memory_changed_size, size_t quota,
uint64_t old_coded_usage_state) {
auto [old_usage_state, old_delay_factor] =
ParseCodedUsageState(old_coded_usage_state);

auto new_usage_state = old_usage_state;
auto new_delay_factor = old_delay_factor;
size_t usage_start_delay_threshold =
(static_cast<double>(start_delay_percent_) / 100) * quota;
size_t usage_start_delay_threshold = (start_delay_percent_ / 100.0) * quota;
auto step_size =
(quota - usage_start_delay_threshold) / kMaxDelayedWriteFactor;

Expand Down Expand Up @@ -513,7 +513,7 @@ auto WriteBufferManager::ParseCodedUsageState(uint64_t coded_usage_state)
}

void WriteBufferManager::UpdateUsageState(size_t new_memory_used,
ssize_t memory_changed_size,
int64_t memory_changed_size,
size_t quota) {
assert(enabled());
if (allow_stall_.load(std::memory_order_relaxed) == false ||
Expand All @@ -540,7 +540,7 @@ void WriteBufferManager::UpdateUsageState(size_t new_memory_used,
if (done == false) {
// Retry. However,
new_memory_used = memory_usage();
memory_changed_size = 0U;
memory_changed_size = 0;
} else {
// WBM state has changed. need to update the WCs.
UpdateControllerDelayState();
Expand Down

0 comments on commit 5564ddb

Please sign in to comment.