Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move rocksdb to a git submodule #80

Closed
filoozom opened this issue Oct 31, 2018 · 12 comments
Closed

Move rocksdb to a git submodule #80

filoozom opened this issue Oct 31, 2018 · 12 comments

Comments

@filoozom
Copy link
Contributor

So, I'm working on moving all dependencies to Git Submodules (as discussed in Level/leveldown#522), but I'm not quite able to figure out what the exact version of RocksDB is.

So, I know it's somewhere in ^5.3.0, but no upstream tag (v5.3.3 to v5.3.6) exactly matches the code in the deps/leveldb/leveldb-rocksdb folder.

I guess I could try to find out the exact commit by digging into this a bit deeper (without 08fd9a3 I suppose), but would it be fine to upgrade to the latest 5.3 version (v5.3.6) instead if tests pass?

@filoozom
Copy link
Contributor Author

@filoozom filoozom changed the title What version of RocksDB does this library use? Move rocksdb to a git submodule Oct 31, 2018
@filoozom
Copy link
Contributor Author

Now, I've never really used node-gyp before, but it looks like this should be executed before compiling: https://github.com/facebook/rocksdb/blob/4e0065015d3dab1d94ef7cb2b4b1d1fecfa0e926/Makefile#L263-L269. More specifically:

date := $(shell date +%F)
git_sha := $(shell git rev-parse HEAD 2>/dev/null)
gen_build_version = sed -e s/@@GIT_SHA@@/$(git_sha)/ -e s/@@GIT_DATE_TIME@@/$(date)/ util/build_version.cc.in

Does anyone know how to do this? Without forgetting that it also needs to work on Windows.

@ralphtheninja
Copy link
Member

ralphtheninja commented Oct 31, 2018

Does anyone know how to do this? Without forgetting that it also needs to work on Windows.

Umm, not really. But if it needs to be run before compiling and given it should work on windows. How does rocksdb itself solve it for windows?

@vweevers
Copy link
Member

What's the benefit of defining these?

How does rocksdb itself solve it for windows?

With CMake it seems: https://github.com/facebook/rocksdb/blob/50895e5f0dd293602b7ccb5d284e6143715a27e5/CMakeLists.txt#L124-L138

@filoozom
Copy link
Contributor Author

Yes, with make (#80 (comment)) and cmake (#80 (comment)). Actually I'm thinking about compiling rocksdb as a shared lib directly with make and/or cmake and linking that in our bindings.gyp, instead of trying to replicate the Makefile in node-gyp.

Do you think that would make sense? On linux I think it wouldn't be a problem as we already have make and all dependencies, but for Windows we'd need to install cmake somehow. I've been having a look at cmake-js since I don't think that windows-build-tools ships it.

@vweevers
Copy link
Member

BTW, what does the use of submodules mean for npm-installed github dependencies? E.g. npm i Level/rocksdb. Does that work?

@ralphtheninja
Copy link
Member

@vweevers It seems to work well. I tried with npm i Level/leveldown#master though. Interestingly, I made a diff:

lms@nuc ~/tmp/node_modules/leveldown/deps/snappy/snappy                                        
$ diff . ~/src/level/leveldown/deps/snappy/snappy                                              
Only in /home/lms/src/level/leveldown/deps/snappy/snappy: AUTHORS                              
Common subdirectories: ./cmake and /home/lms/src/level/leveldown/deps/snappy/snappy/cmake      
Only in /home/lms/src/level/leveldown/deps/snappy/snappy: NEWS                                 
Common subdirectories: ./testdata and /home/lms/src/level/leveldown/deps/snappy/snappy/testdata

At first I couldn't figure out why AUTHORS and NEWS wasn't there but they seem to be filtered out due to .npmignore inside leveldown:

$ cat .npmignore
*.tar.gz
build/
build-pre-gyp/
test-data.tar
test-data.db.tar
deps/leveldb/leveldb-basho/
deps/leveldb/leveldb-hyper/
deps/leveldb/leveldb-rocksdb/
deps/snappy/snappy-*/testdata/
leakydb
bench/
test/
deps/leveldb/leveldb-*/doc/
README
INSTALL
NEWS
AUTHORS
.nyc_output/

Also, just noticed when typing this that deps/snappy/snappy-*/testdata/ above should probably be deps/snappy/snappy/testdata/ now.

@vweevers
Copy link
Member

@ralphtheninja why does it work though? leveldown has no postinstall step to initialize submodules; so is it a builtin behavior of npm?

@ralphtheninja
Copy link
Member

@ralphtheninja why does it work though? leveldown has no postinstall step to initialize submodules; so is it a builtin behavior of npm?

Good question. It must be imo.

@vweevers
Copy link
Member

Yup, that's the case for npm 3.10, which logs:

npm info git [ 'submodule', '-q', 'update', '--init', '--recursive' ]

npm 5.3 and 6.4 don't log this (or any other line containing submodule) but do seem to work.

@vweevers
Copy link
Member

OK, it's officially supported, see npm/npm#1876.

It's not supported by yarn, however: yarnpkg/yarn#1488

@vweevers
Copy link
Member

vweevers commented Jun 9, 2021

Done in #141.

@vweevers vweevers closed this as completed Jun 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants