Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
T
titan
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fangzongwu
titan
Commits
f80342b8
Unverified
Commit
f80342b8
authored
Jul 11, 2019
by
Connor
Committed by
GitHub
Jul 11, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
print git hash (#40)
Signed-off-by:
Connor1996
<
zbk602423539@gmail.com
>
parent
397b6d22
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
1 deletion
+28
-1
CMakeLists.txt
CMakeLists.txt
+20
-1
db_impl.cc
src/db_impl.cc
+3
-0
titan_build_version.cc.in
util/titan_build_version.cc.in
+2
-0
titan_build_version.h
util/titan_build_version.h
+3
-0
No files found.
CMakeLists.txt
View file @
f80342b8
...
...
@@ -14,12 +14,13 @@ include_directories(${ROCKSDB_DIR})
include_directories
(
${
ROCKSDB_DIR
}
/include
)
include_directories
(
${
PROJECT_SOURCE_DIR
}
/include
)
include_directories
(
${
PROJECT_SOURCE_DIR
}
/src
)
include_directories
(
${
PROJECT_SOURCE_DIR
}
/util
)
file
(
GLOB SOURCES src/*.cc
)
file
(
GLOB TEST_SOURCES src/*test.cc
)
list
(
REMOVE_ITEM SOURCES
${
TEST_SOURCES
}
)
add_library
(
titan STATIC
${
SOURCES
}
)
add_library
(
titan STATIC
${
SOURCES
}
$<TARGET_OBJECTS:titan_build_version>
)
option
(
WITH_TITAN_TESTS
"Build with tests."
ON
)
option
(
WITH_TITAN_TOOLS
"Build with tools."
ON
)
...
...
@@ -30,6 +31,24 @@ if (CMAKE_BUILD_TYPE STREQUAL "Release")
set
(
WITH_TITAN_TESTS OFF
)
endif
()
find_package
(
Git
)
if
(
GIT_FOUND AND EXISTS
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/.git"
)
if
(
WIN32
)
execute_process
(
COMMAND $ENV{COMSPEC} /C
${
GIT_EXECUTABLE
}
rev-parse HEAD OUTPUT_VARIABLE GIT_SHA
)
else
()
execute_process
(
COMMAND
${
GIT_EXECUTABLE
}
rev-parse HEAD OUTPUT_VARIABLE GIT_SHA
)
endif
()
else
()
set
(
GIT_SHA 0
)
endif
()
string
(
REGEX REPLACE
"[^0-9a-f]+"
""
GIT_SHA
"
${
GIT_SHA
}
"
)
set
(
TITAN_BUILD_VERSION_CC
${
CMAKE_BINARY_DIR
}
/titan_build_version.cc
)
configure_file
(
util/titan_build_version.cc.in
${
TITAN_BUILD_VERSION_CC
}
@ONLY
)
add_library
(
titan_build_version OBJECT
${
TITAN_BUILD_VERSION_CC
}
)
target_include_directories
(
titan_build_version PRIVATE
${
CMAKE_CURRENT_SOURCE_DIR
}
/util
)
if
(
CODE_COVERAGE
)
target_compile_options
(
titan PRIVATE
"--coverage"
)
set
(
CMAKE_EXE_LINKER_FLAGS
"
${
CMAKE_EXE_LINKER_FLAGS
}
--coverage"
)
...
...
src/db_impl.cc
View file @
f80342b8
...
...
@@ -15,6 +15,7 @@
#include "blob_gc.h"
#include "db_iter.h"
#include "table_factory.h"
#include "titan_build_version.h"
namespace
rocksdb
{
namespace
titandb
{
...
...
@@ -244,6 +245,8 @@ Status TitanDBImpl::Open(const std::vector<TitanCFDescriptor>& descs,
stats_
->
Initialize
(
column_families
,
db_
->
DefaultColumnFamily
()
->
GetID
());
}
ROCKS_LOG_INFO
(
db_options_
.
info_log
,
"Titan DB open."
);
ROCKS_LOG_HEADER
(
db_options_
.
info_log
,
"Titan git sha: %s"
,
titan_build_git_sha
);
db_options_
.
Dump
(
db_options_
.
info_log
.
get
());
for
(
auto
&
desc
:
descs
)
{
ROCKS_LOG_HEADER
(
db_options_
.
info_log
,
...
...
util/titan_build_version.cc.in
0 → 100644
View file @
f80342b8
#include "titan_build_version.h"
const char* titan_build_git_sha = "titan_build_git_sha:@@GIT_SHA@@";
util/titan_build_version.h
0 → 100644
View file @
f80342b8
#pragma once
extern
const
char
*
titan_build_git_sha
;
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment