Fix compilation under MSVC VS2015 (#6081)

Summary:
**NOTE**: this also needs to be back-ported to 6.4.6 and possibly older branches if further releases from them is envisaged.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/6081

Differential Revision: D18710107

Pulled By: zhichao-cao

fbshipit-source-id: 03260f9316566e2bfc12c7d702d6338bb7941e01
main
Adam Retter 5 years ago committed by Facebook Github Bot
parent 8ae149eba1
commit 6d58ea901d
  1. 17
      tools/block_cache_analyzer/block_cache_trace_analyzer.cc
  2. 2
      tools/block_cache_analyzer/block_cache_trace_analyzer.h
  3. 2
      utilities/transactions/transaction_base.cc
  4. 2
      utilities/transactions/transaction_base.h
  5. 2
      utilities/transactions/write_prepared_txn.cc
  6. 2
      utilities/transactions/write_prepared_txn.h
  7. 2
      utilities/transactions/write_unprepared_txn.cc
  8. 2
      utilities/transactions/write_unprepared_txn.h

@ -14,6 +14,7 @@
#include <fstream> #include <fstream>
#include <iomanip> #include <iomanip>
#include <iostream> #include <iostream>
#include <memory>
#include <random> #include <random>
#include <sstream> #include <sstream>
@ -650,7 +651,7 @@ void BlockCacheTraceAnalyzer::WriteCorrelationFeaturesToFile(
const std::map<std::string, Features>& label_features, const std::map<std::string, Features>& label_features,
const std::map<std::string, Predictions>& label_predictions, const std::map<std::string, Predictions>& label_predictions,
uint32_t max_number_of_values) const { uint32_t max_number_of_values) const {
std::default_random_engine rand_engine(static_cast<unsigned int>(env_->NowMicros())); std::default_random_engine rand_engine(static_cast<std::default_random_engine::result_type>(env_->NowMicros()));
for (auto const& label_feature_vectors : label_features) { for (auto const& label_feature_vectors : label_features) {
const Features& past = label_feature_vectors.second; const Features& past = label_feature_vectors.second;
auto it = label_predictions.find(label_feature_vectors.first); auto it = label_predictions.find(label_feature_vectors.first);
@ -1170,7 +1171,7 @@ void BlockCacheTraceAnalyzer::WriteReuseLifetime(
} }
void BlockCacheTraceAnalyzer::WriteBlockReuseTimeline( void BlockCacheTraceAnalyzer::WriteBlockReuseTimeline(
uint64_t reuse_window, bool user_access_only, TraceType block_type) const { const uint64_t reuse_window, bool user_access_only, TraceType block_type) const {
// A map from block key to an array of bools that states whether a block is // A map from block key to an array of bools that states whether a block is
// accessed in a time window. // accessed in a time window.
std::map<uint64_t, std::vector<bool>> block_accessed; std::map<uint64_t, std::vector<bool>> block_accessed;
@ -1209,11 +1210,11 @@ void BlockCacheTraceAnalyzer::WriteBlockReuseTimeline(
TraverseBlocks(block_callback); TraverseBlocks(block_callback);
// A cell is the number of blocks accessed in a reuse window. // A cell is the number of blocks accessed in a reuse window.
uint64_t reuse_table[reuse_vector_size][reuse_vector_size]; std::unique_ptr<uint64_t[]> reuse_table(new uint64_t[reuse_vector_size * reuse_vector_size]);
for (uint64_t start_time = 0; start_time < reuse_vector_size; start_time++) { for (uint64_t start_time = 0; start_time < reuse_vector_size; start_time++) {
// Initialize the reuse_table. // Initialize the reuse_table.
for (uint64_t i = 0; i < reuse_vector_size; i++) { for (uint64_t i = 0; i < reuse_vector_size; i++) {
reuse_table[start_time][i] = 0; reuse_table[start_time * reuse_vector_size + i] = 0;
} }
// Examine all blocks. // Examine all blocks.
for (auto const& block : block_accessed) { for (auto const& block : block_accessed) {
@ -1222,7 +1223,7 @@ void BlockCacheTraceAnalyzer::WriteBlockReuseTimeline(
// This block is accessed at start time and at the current time. We // This block is accessed at start time and at the current time. We
// increment reuse_table[start_time][i] since it is reused at the ith // increment reuse_table[start_time][i] since it is reused at the ith
// window. // window.
reuse_table[start_time][i]++; reuse_table[start_time * reuse_vector_size + i]++;
} }
} }
} }
@ -1250,8 +1251,8 @@ void BlockCacheTraceAnalyzer::WriteBlockReuseTimeline(
if (j < start_time) { if (j < start_time) {
row += "100.0"; row += "100.0";
} else { } else {
row += std::to_string(percent(reuse_table[start_time][j], row += std::to_string(percent(reuse_table[start_time * reuse_vector_size + j],
reuse_table[start_time][start_time])); reuse_table[start_time * reuse_vector_size + start_time]));
} }
} }
out << row << std::endl; out << row << std::endl;
@ -1673,7 +1674,7 @@ void BlockCacheTraceAnalyzer::PrintAccessCountStats(bool user_access_only,
if (bottom_k_index >= bottom_k) { if (bottom_k_index >= bottom_k) {
break; break;
} }
std::map<TableReaderCaller, uint32_t> caller_naccesses; std::map<TableReaderCaller, uint64_t> caller_naccesses;
uint64_t naccesses = 0; uint64_t naccesses = 0;
for (auto const& block_id : naccess_it->second) { for (auto const& block_id : naccess_it->second) {
BlockAccessInfo* block = block_info_map_.find(block_id)->second; BlockAccessInfo* block = block_info_map_.find(block_id)->second;

@ -289,7 +289,7 @@ class BlockCacheTraceAnalyzer {
// The file is named // The file is named
// "block_type_user_access_only_reuse_window_reuse_timeline". The file format // "block_type_user_access_only_reuse_window_reuse_timeline". The file format
// is start_time,0,1,...,N where N equals trace_duration / reuse_window. // is start_time,0,1,...,N where N equals trace_duration / reuse_window.
void WriteBlockReuseTimeline(uint64_t reuse_window, bool user_access_only, void WriteBlockReuseTimeline(const uint64_t reuse_window, bool user_access_only,
TraceType block_type) const; TraceType block_type) const;
// Write the Get spatical locality into csv files saved in 'output_dir'. // Write the Get spatical locality into csv files saved in 'output_dir'.

@ -323,7 +323,7 @@ void TransactionBaseImpl::MultiGet(const ReadOptions& read_options,
ColumnFamilyHandle* column_family, ColumnFamilyHandle* column_family,
const size_t num_keys, const Slice* keys, const size_t num_keys, const Slice* keys,
PinnableSlice* values, Status* statuses, PinnableSlice* values, Status* statuses,
bool sorted_input) { const bool sorted_input) {
write_batch_.MultiGetFromBatchAndDB(db_, read_options, column_family, write_batch_.MultiGetFromBatchAndDB(db_, read_options, column_family,
num_keys, keys, values, statuses, num_keys, keys, values, statuses,
sorted_input); sorted_input);

@ -98,7 +98,7 @@ class TransactionBaseImpl : public Transaction {
void MultiGet(const ReadOptions& options, ColumnFamilyHandle* column_family, void MultiGet(const ReadOptions& options, ColumnFamilyHandle* column_family,
const size_t num_keys, const Slice* keys, PinnableSlice* values, const size_t num_keys, const Slice* keys, PinnableSlice* values,
Status* statuses, bool sorted_input = false) override; Status* statuses, const bool sorted_input = false) override;
using Transaction::MultiGetForUpdate; using Transaction::MultiGetForUpdate;
std::vector<Status> MultiGetForUpdate( std::vector<Status> MultiGetForUpdate(

@ -44,7 +44,7 @@ void WritePreparedTxn::MultiGet(const ReadOptions& options,
ColumnFamilyHandle* column_family, ColumnFamilyHandle* column_family,
const size_t num_keys, const Slice* keys, const size_t num_keys, const Slice* keys,
PinnableSlice* values, Status* statuses, PinnableSlice* values, Status* statuses,
bool sorted_input) { const bool sorted_input) {
SequenceNumber min_uncommitted, snap_seq; SequenceNumber min_uncommitted, snap_seq;
const SnapshotBackup backed_by_snapshot = const SnapshotBackup backed_by_snapshot =
wpt_db_->AssignMinMaxSeqs(options.snapshot, &min_uncommitted, &snap_seq); wpt_db_->AssignMinMaxSeqs(options.snapshot, &min_uncommitted, &snap_seq);

@ -61,7 +61,7 @@ class WritePreparedTxn : public PessimisticTransaction {
ColumnFamilyHandle* column_family, ColumnFamilyHandle* column_family,
const size_t num_keys, const Slice* keys, const size_t num_keys, const Slice* keys,
PinnableSlice* values, Status* statuses, PinnableSlice* values, Status* statuses,
bool sorted_input = false) override; const bool sorted_input = false) override;
// Note: The behavior is undefined in presence of interleaved writes to the // Note: The behavior is undefined in presence of interleaved writes to the
// same transaction. // same transaction.

@ -837,7 +837,7 @@ void WriteUnpreparedTxn::MultiGet(const ReadOptions& options,
ColumnFamilyHandle* column_family, ColumnFamilyHandle* column_family,
const size_t num_keys, const Slice* keys, const size_t num_keys, const Slice* keys,
PinnableSlice* values, Status* statuses, PinnableSlice* values, Status* statuses,
bool sorted_input) { const bool sorted_input) {
SequenceNumber min_uncommitted, snap_seq; SequenceNumber min_uncommitted, snap_seq;
const SnapshotBackup backed_by_snapshot = const SnapshotBackup backed_by_snapshot =
wupt_db_->AssignMinMaxSeqs(options.snapshot, &min_uncommitted, &snap_seq); wupt_db_->AssignMinMaxSeqs(options.snapshot, &min_uncommitted, &snap_seq);

@ -194,7 +194,7 @@ class WriteUnpreparedTxn : public WritePreparedTxn {
ColumnFamilyHandle* column_family, ColumnFamilyHandle* column_family,
const size_t num_keys, const Slice* keys, const size_t num_keys, const Slice* keys,
PinnableSlice* values, Status* statuses, PinnableSlice* values, Status* statuses,
bool sorted_input = false) override; const bool sorted_input = false) override;
using Transaction::GetIterator; using Transaction::GetIterator;
virtual Iterator* GetIterator(const ReadOptions& options) override; virtual Iterator* GetIterator(const ReadOptions& options) override;

Loading…
Cancel
Save