Skip to content

Commit

Permalink
Commit both PR and internal code review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
yuslepukhin committed Jul 7, 2015
1 parent e25ee32 commit ef4b87f
Show file tree
Hide file tree
Showing 34 changed files with 254 additions and 338 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# This cmake build is for Windows only.
#
# Prerequisites:
# You must have Visual Studio 2013 installed. Start the Developer Command Prompt window that is a part of Visual Studio installation.
# You must have Visual Studio 2013 Update 4 installed. Start the Developer Command Prompt window that is a part of Visual Studio installation.
# Run the build commands from within the Developer Command Prompt window to have paths to the compiler and runtime libraries set.
# Make sure that Git is in your PATH
#
# To build Rocksdb for Windows is as easy as 1-2-3-4-5:
#
Expand Down
3 changes: 3 additions & 0 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,6 @@ your make commands, like this: `PORTABLE=1 make static_lib`

* **iOS**:
* Run: `TARGET_OS=IOS make static_lib`. When building the project which uses rocksdb iOS library, make sure to define two important pre-processing macros: `ROCKSDB_LITE` and `IOS_CROSS_COMPILE`.

* **Windows**:
* Read the follow the instructions at CMakeLists.txt
4 changes: 3 additions & 1 deletion WINDOWS_PORT.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ These notes describe some decisions and changes we had to make with regards to p
We are open for comments and improvements.

## OS specifics
All of the porting, testing and benchmarking was done on Windows Server 2012 R2 Datacenter but to the best of our knowledge there is not a specific API we used during porting that is unsupported on other Windows OS after Vista.
All of the porting, testing and benchmarking was done on Windows Server 2012 R2 Datacenter 64-bit but to the best of our knowledge there is not a specific API we used during porting that is unsupported on other Windows OS after Vista.

## Porting goals
We strive to achieve the following goals:
Expand All @@ -34,6 +34,8 @@ At the same time it generates Visual Studio projects that are both usable from a
The top-level CMakeLists.txt file contains description of all targets and build rules. It also provides brief instructions on how to build the software for Windows. One more build related file is thirdparty.inc that also resides on the top level. This file must be edited to point to actual third party libraries location.
We think that it would be beneficial to merge the existing make-based build system and the new cmake-based build system into a single one to use on all platforms.

All building and testing was done for 64-bit. We have not conducted any testing for 32-bit and early reports indicate that it will not run on 32-bit.

## C++ and STL notes
We had to make some minimum changes within the portable files that either account for OS differences or the shortcomings of C++11 support in the current version of the MS compiler. Most or all of them are expected to be fixed in the upcoming compiler releases.

Expand Down
24 changes: 0 additions & 24 deletions build_tools/build_detect_version.bat

This file was deleted.

99 changes: 0 additions & 99 deletions build_tools/runall.bat

This file was deleted.

2 changes: 1 addition & 1 deletion db/c.cc
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ static bool SaveError(char** errptr, const Status& s) {
*errptr = strdup(s.ToString().c_str());
} else {
// TODO(sanjay): Merge with existing error?
// This is a bug if *errptr is not create by malloc()
// This is a bug if *errptr is not created by malloc()
free(*errptr);
*errptr = strdup(s.ToString().c_str());
}
Expand Down
3 changes: 2 additions & 1 deletion db/file_indexer.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <functional>
#include <limits>
#include <vector>
#include "port/port.h"
#include "util/arena.h"
#include "util/autovector.h"

Expand Down Expand Up @@ -59,7 +60,7 @@ class FileIndexer {

enum {
// MSVC version 1800 still does not have constexpr for ::max()
kLevelMaxIndex = INT32_MAX
kLevelMaxIndex = rocksdb::port::LevelMaxIndex
};

private:
Expand Down
14 changes: 7 additions & 7 deletions include/rocksdb/c.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,13 +192,13 @@ extern ROCKSDB_LIBRARY_API rocksdb_t* rocksdb_open_for_read_only_column_families
unsigned char error_if_log_file_exist,
char** errptr);

ROCKSDB_LIBRARY_API char** rocksdb_list_column_families(
extern ROCKSDB_LIBRARY_API char** rocksdb_list_column_families(
const rocksdb_options_t* options,
const char* name,
size_t* lencf,
char** errptr);

ROCKSDB_LIBRARY_API void rocksdb_list_column_families_destroy(char** list, size_t len);
extern ROCKSDB_LIBRARY_API void rocksdb_list_column_families_destroy(char** list, size_t len);

extern ROCKSDB_LIBRARY_API rocksdb_column_family_handle_t* rocksdb_create_column_family(
rocksdb_t* db,
Expand Down Expand Up @@ -236,7 +236,7 @@ extern ROCKSDB_LIBRARY_API void rocksdb_delete(
const char* key, size_t keylen,
char** errptr);

void ROCKSDB_LIBRARY_API rocksdb_delete_cf(
extern ROCKSDB_LIBRARY_API void rocksdb_delete_cf(
rocksdb_t* db,
const rocksdb_writeoptions_t* options,
rocksdb_column_family_handle_t* column_family,
Expand Down Expand Up @@ -467,16 +467,16 @@ extern ROCKSDB_LIBRARY_API void rocksdb_writebatch_delete_cf(
rocksdb_writebatch_t*,
rocksdb_column_family_handle_t* column_family,
const char* key, size_t klen);
ROCKSDB_LIBRARY_API void rocksdb_writebatch_deletev(
extern ROCKSDB_LIBRARY_API void rocksdb_writebatch_deletev(
rocksdb_writebatch_t* b,
int num_keys, const char* const* keys_list,
const size_t* keys_list_sizes);
ROCKSDB_LIBRARY_API void rocksdb_writebatch_deletev_cf(
extern ROCKSDB_LIBRARY_API void rocksdb_writebatch_deletev_cf(
rocksdb_writebatch_t* b,
rocksdb_column_family_handle_t* column_family,
int num_keys, const char* const* keys_list,
const size_t* keys_list_sizes);
ROCKSDB_LIBRARY_API extern void rocksdb_writebatch_put_log_data(
extern ROCKSDB_LIBRARY_API void rocksdb_writebatch_put_log_data(
rocksdb_writebatch_t*,
const char* blob, size_t len);
extern ROCKSDB_LIBRARY_API void rocksdb_writebatch_iterate(
Expand Down Expand Up @@ -986,7 +986,7 @@ extern ROCKSDB_LIBRARY_API void rocksdb_get_options_from_string(
rocksdb_options_t* new_options,
char** errptr);

// refering to convention (3), this should be used by client
// referring to convention (3), this should be used by client
// to free memory that was malloc()ed
extern ROCKSDB_LIBRARY_API void rocksdb_free(
void* ptr);
Expand Down
20 changes: 1 addition & 19 deletions include/rocksdb/slice.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,6 @@
#include <stddef.h>
#include <string.h>
#include <string>
#include <stdio.h>

// Do not want to include the whole /port/port.h here for one define
#ifdef OS_WIN
# define snprintf _snprintf
#endif

namespace rocksdb {

Expand Down Expand Up @@ -80,19 +74,7 @@ class Slice {
}

// Return a string that contains the copy of the referenced data.
std::string ToString(bool hex = false) const {
if (hex) {
std::string result;
char buf[10];
for (size_t i = 0; i < size_; i++) {
snprintf(buf, 10, "%02X", (unsigned char)data_[i]);
result += buf;
}
return result;
} else {
return std::string(data_, size_);
}
}
std::string ToString(bool hex = false) const;

// Three-way comparison. Returns value:
// < 0 iff "*this" < "b",
Expand Down
8 changes: 0 additions & 8 deletions include/rocksdb/thread_status.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,11 @@ namespace rocksdb {

// TODO(yhchiang): remove this function once c++14 is available
// as std::max will be able to cover this.
#ifndef OS_WIN
constexpr int constexpr_max(int a, int b) { return a > b ? a : b; }
#else
// Current MS compiler does not support constexpr
template<int A, int B>
struct constexpr_max {
static const int result = (A > B) ? A : B;
};
#endif

// A structure that describes the current status of a thread.
// The status of active threads can be fetched using
Expand Down Expand Up @@ -100,11 +96,7 @@ struct ThreadStatus {
// The maximum number of properties of an operation.
// This number should be set to the biggest NUM_XXX_PROPERTIES.
static const int kNumOperationProperties =
#ifndef OS_WIN
constexpr_max(NUM_COMPACTION_PROPERTIES, NUM_FLUSH_PROPERTIES);
#else
constexpr_max<NUM_COMPACTION_PROPERTIES, NUM_FLUSH_PROPERTIES>::result;
#endif

// The type used to refer to a thread state.
// A state describes lower-level action of a thread
Expand Down
2 changes: 1 addition & 1 deletion include/rocksdb/utilities/spatial_db.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ struct Variant {
const std::string& get_string() const { return *GetStringPtr(data_); }

bool operator==(const Variant& other) const;
bool operator!=(const Variant& rhs) const { return !(*this == rhs); }
bool operator!=(const Variant& other) const { return !(*this == other); }

private:

Expand Down
6 changes: 5 additions & 1 deletion include/utilities/document_db.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,9 @@
// of patent rights can be found in the PATENTS file in the same directory.

#pragma once
#warning This file was moved to rocksdb/utilities/document_db.h

#include "pragma_error.h"

ROCKSDB_WARNING("This file was moved to rocksdb/utilities/document_db.h")

#include "rocksdb/utilities/document_db.h"
6 changes: 5 additions & 1 deletion include/utilities/geo_db.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,9 @@
// of patent rights can be found in the PATENTS file in the same directory.

#pragma once
#warning This file was moved to rocksdb/utilities/geo_db.h

#include "pragma_error.h"

ROCKSDB_WARNING("This file was moved to rocksdb/utilities/geo_db.h")

#include "rocksdb/utilities/geo_db.h"
6 changes: 5 additions & 1 deletion include/utilities/json_document.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,9 @@
// LICENSE file in the root directory of this source tree. An additional grant
// of patent rights can be found in the PATENTS file in the same directory.
#pragma once
#warning This file was moved to rocksdb/utilities/json_document.h

#include "pragma_error.h"

ROCKSDB_WARNING("This file was moved to rocksdb/utilities/json_document.h")

#include "rocksdb/utilities/json_document.h"
5 changes: 4 additions & 1 deletion include/utilities/stackable_db.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@
// found in the LICENSE file. See the AUTHORS file for names of contributors.

#pragma once
#warning This file was moved to rocksdb/utilities/stackable_db.h
#include "pragma_error.h"

ROCKSDB_WARNING("This file was moved to rocksdb/utilities/stackable_db.h")

#include "rocksdb/utilities/stackable_db.h"
5 changes: 5 additions & 0 deletions port/port_posix.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,14 @@
#define fdatasync fsync
#endif

#include <limits>

namespace rocksdb {
namespace port {

// For use at db/file_indexer.h kLevelMaxIndex
const int LevelMaxIndex = std::numeric_limits<int32_t>::max();

static const bool kLittleEndian = PLATFORM_IS_LITTLE_ENDIAN;
#undef PLATFORM_IS_LITTLE_ENDIAN

Expand Down
2 changes: 1 addition & 1 deletion port/sys_time.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#ifndef STORAGE_LEVELDB_PORT_SYS_TIME_H_
#define STORAGE_LEVELDB_PORT_SYS_TIME_H_

#if defined(_WIN32) && defined(_MSC_VER)
#if defined(OS_WIN) && defined(_MSC_VER)

#include <time.h>

Expand Down
Loading

0 comments on commit ef4b87f

Please sign in to comment.