Skip to content

Commit

Permalink
Adapt rocksdb 6.28.2 (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
linxGnu authored Feb 9, 2022
1 parent 675cdaf commit 31065dc
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
uses: actions/cache@v2
with:
path: dist
key: v6.27.3
key: v6.28.2

- name: Build
if: steps.cache-built-rocksdb.outputs.cache-hit != 'true'
Expand Down
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ cd $BUILD_PATH && wget https://github.com/facebook/zstd/archive/v${zstd_version}
-DCMAKE_POSITION_INDEPENDENT_CODE=ON -DZSTD_ZLIB_SUPPORT=ON -DZSTD_LZMA_SUPPORT=OFF -DCMAKE_BUILD_TYPE=Release .. && make -j$(nproc) install && \
cd $BUILD_PATH && rm -rf * && ldconfig

rocksdb_version="6.27.3"
rocksdb_version="6.28.2"
cd $BUILD_PATH && wget https://github.com/facebook/rocksdb/archive/v${rocksdb_version}.tar.gz && tar xzf v${rocksdb_version}.tar.gz && cd rocksdb-${rocksdb_version}/ && \
mkdir -p build_place && cd build_place && cmake -DCMAKE_BUILD_TYPE=Release $CMAKE_REQUIRED_PARAMS -DCMAKE_PREFIX_PATH=$INSTALL_PREFIX -DWITH_TESTS=OFF -DWITH_GFLAGS=OFF \
-DWITH_BENCHMARK_TOOLS=OFF -DWITH_TOOLS=OFF -DWITH_MD_LIBRARY=OFF -DWITH_RUNTIME_DEBUG=OFF -DROCKSDB_BUILD_SHARED=OFF -DWITH_SNAPPY=ON -DWITH_LZ4=ON -DWITH_ZLIB=ON \
Expand Down
2 changes: 2 additions & 0 deletions c.h
Original file line number Diff line number Diff line change
Expand Up @@ -1995,6 +1995,8 @@ extern ROCKSDB_LIBRARY_API void rocksdb_fifo_compaction_options_destroy(

extern ROCKSDB_LIBRARY_API int rocksdb_livefiles_count(
const rocksdb_livefiles_t*);
extern ROCKSDB_LIBRARY_API const char* rocksdb_livefiles_column_family_name(
const rocksdb_livefiles_t*, int index);
extern ROCKSDB_LIBRARY_API const char* rocksdb_livefiles_name(
const rocksdb_livefiles_t*, int index);
extern ROCKSDB_LIBRARY_API int rocksdb_livefiles_level(
Expand Down
23 changes: 12 additions & 11 deletions db.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@ package grocksdb
// #include <stdlib.h>
// #include "rocksdb/c.h"
import "C"

import (
"fmt"
"unsafe"
)

var (
// ErrColumnFamilyMustMatch indicates number of column family names and options must match.
ErrColumnFamilyMustMatch = fmt.Errorf("must provide the same number of column family names and options")
)
// ErrColumnFamilyMustMatch indicates number of column family names and options must match.
var ErrColumnFamilyMustMatch = fmt.Errorf("must provide the same number of column family names and options")

// Range is a range of keys in the database. GetApproximateSizes calls with it
// begin at the key Start and end right before the key Limit.
Expand Down Expand Up @@ -1078,13 +1077,14 @@ func (db *DB) SetOptionsCF(cf *ColumnFamilyHandle, keys, values []string) (err e

// LiveFileMetadata is a metadata which is associated with each SST file.
type LiveFileMetadata struct {
Name string
Level int
Size int64
SmallestKey []byte
LargestKey []byte
Entries uint64 // number of entries
Deletions uint64 // number of deletions
Name string
ColumnFamilyName string
Level int
Size int64
SmallestKey []byte
LargestKey []byte
Entries uint64 // number of entries
Deletions uint64 // number of deletions
}

// GetLiveFilesMetaData returns a list of all table files with their
Expand All @@ -1097,6 +1097,7 @@ func (db *DB) GetLiveFilesMetaData() []LiveFileMetadata {
for i := C.int(0); i < count; i++ {
var liveFile LiveFileMetadata
liveFile.Name = C.GoString(C.rocksdb_livefiles_name(lf, i))
liveFile.ColumnFamilyName = C.GoString(C.rocksdb_livefiles_column_family_name(lf, i))
liveFile.Level = int(C.rocksdb_livefiles_level(lf, i))
liveFile.Size = int64(C.rocksdb_livefiles_size(lf, i))

Expand Down

0 comments on commit 31065dc

Please sign in to comment.