Compare commits
3 Commits
master
...
branch-0.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b2eb0810a2 | ||
|
|
14d029bf71 | ||
|
|
38470b4d28 |
@@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
VERSION=666.development
|
||||
VERSION=0.17
|
||||
|
||||
if test -f version
|
||||
then
|
||||
|
||||
31
configure.py
31
configure.py
@@ -556,16 +556,31 @@ else:
|
||||
args.pie = ''
|
||||
args.fpie = ''
|
||||
|
||||
optional_packages = ['libsystemd']
|
||||
# a list element means a list of alternative packages to consider
|
||||
# the first element becomes the HAVE_pkg define
|
||||
# a string element is a package name with no alternatives
|
||||
optional_packages = [['libsystemd', 'libsystemd-daemon']]
|
||||
pkgs = []
|
||||
|
||||
for pkg in optional_packages:
|
||||
if have_pkg(pkg):
|
||||
pkgs.append(pkg)
|
||||
upkg = pkg.upper().replace('-', '_')
|
||||
defines.append('HAVE_{}=1'.format(upkg))
|
||||
else:
|
||||
print('Missing optional package {pkg}'.format(**locals()))
|
||||
def setup_first_pkg_of_list(pkglist):
|
||||
# The HAVE_pkg symbol is taken from the first alternative
|
||||
upkg = pkglist[0].upper().replace('-', '_')
|
||||
for pkg in pkglist:
|
||||
if have_pkg(pkg):
|
||||
pkgs.append(pkg)
|
||||
defines.append('HAVE_{}=1'.format(upkg))
|
||||
return True
|
||||
return False
|
||||
|
||||
for pkglist in optional_packages:
|
||||
if isinstance(pkglist, str):
|
||||
pkglist = [pkglist]
|
||||
if not setup_first_pkg_of_list(pkglist):
|
||||
if len(pkglist) == 1:
|
||||
print('Missing optional package {pkglist[0]}'.format(**locals()))
|
||||
else:
|
||||
alternatives = ':'.join(pkglist[1:])
|
||||
print('Missing optional package {pkglist[0]} (or alteratives {alternatives})'.format(**locals()))
|
||||
|
||||
defines = ' '.join(['-D' + d for d in defines])
|
||||
|
||||
|
||||
10
database.cc
10
database.cc
@@ -474,7 +474,15 @@ future<sstables::entry_descriptor> column_family::probe_file(sstring sstdir, sst
|
||||
}
|
||||
|
||||
update_sstables_known_generation(comps.generation);
|
||||
assert(_sstables->count(comps.generation) == 0);
|
||||
|
||||
{
|
||||
auto i = _sstables->find(comps.generation);
|
||||
if (i != _sstables->end()) {
|
||||
auto new_toc = sstdir + "/" + fname;
|
||||
throw std::runtime_error(sprint("Attempted to add sstable generation %d twice: new=%s existing=%s",
|
||||
comps.generation, new_toc, i->second->toc_filename()));
|
||||
}
|
||||
}
|
||||
|
||||
auto fut = sstable::get_sstable_key_range(*_schema, _schema->ks_name(), _schema->cf_name(), sstdir, comps.generation, comps.version, comps.format);
|
||||
return std::move(fut).then([this, sstdir = std::move(sstdir), comps] (range<partition_key> r) {
|
||||
|
||||
2
main.cc
2
main.cc
@@ -359,6 +359,8 @@ int main(int ac, char** av) {
|
||||
// call stop on each db instance, but leave the shareded<database> pointers alive.
|
||||
return db.invoke_on_all([](auto& db) {
|
||||
return db.stop();
|
||||
}).then([] {
|
||||
return sstables::await_background_jobs_on_all_shards();
|
||||
}).then([] {
|
||||
::_exit(0);
|
||||
});
|
||||
|
||||
@@ -55,12 +55,8 @@ logging::logger sstlog("sstable");
|
||||
thread_local std::unordered_map<sstring, unsigned> sstable::_shards_agreeing_to_remove_sstable;
|
||||
|
||||
static utils::phased_barrier& background_jobs() {
|
||||
static thread_local lw_shared_ptr<utils::phased_barrier> gate = [] {
|
||||
auto g = make_lw_shared<utils::phased_barrier>();
|
||||
engine().at_exit([] { return await_background_jobs(); });
|
||||
return g;
|
||||
}();
|
||||
return *gate;
|
||||
static thread_local utils::phased_barrier gate;
|
||||
return gate;
|
||||
}
|
||||
|
||||
future<> await_background_jobs() {
|
||||
@@ -128,18 +124,21 @@ std::unordered_map<sstable::format_types, sstring, enum_hash<sstable::format_typ
|
||||
{ sstable::format_types::big , "big" }
|
||||
};
|
||||
|
||||
static const sstring TOC_SUFFIX = "TOC.txt";
|
||||
static const sstring TEMPORARY_TOC_SUFFIX = "TOC.txt.tmp";
|
||||
|
||||
// FIXME: this should be version-dependent
|
||||
std::unordered_map<sstable::component_type, sstring, enum_hash<sstable::component_type>> sstable::_component_map = {
|
||||
{ component_type::Index, "Index.db"},
|
||||
{ component_type::CompressionInfo, "CompressionInfo.db" },
|
||||
{ component_type::Data, "Data.db" },
|
||||
{ component_type::TOC, "TOC.txt" },
|
||||
{ component_type::TOC, TOC_SUFFIX },
|
||||
{ component_type::Summary, "Summary.db" },
|
||||
{ component_type::Digest, "Digest.sha1" },
|
||||
{ component_type::CRC, "CRC.db" },
|
||||
{ component_type::Filter, "Filter.db" },
|
||||
{ component_type::Statistics, "Statistics.db" },
|
||||
{ component_type::TemporaryTOC, "TOC.txt.tmp" },
|
||||
{ component_type::TemporaryTOC, TEMPORARY_TOC_SUFFIX },
|
||||
};
|
||||
|
||||
// This assumes that the mappings are small enough, and called unfrequent
|
||||
@@ -1746,25 +1745,26 @@ remove_by_toc_name(sstring sstable_toc_name) {
|
||||
auto size = toc_file.size().get0();
|
||||
auto text = in.read_exactly(size).get0();
|
||||
in.close().get();
|
||||
remove_file(sstable_toc_name).get();
|
||||
sstring prefix = sstable_toc_name.substr(0, sstable_toc_name.size() - TOC_SUFFIX.size());
|
||||
auto new_toc_name = prefix + TEMPORARY_TOC_SUFFIX;
|
||||
rename_file(sstable_toc_name, new_toc_name).get();
|
||||
fsync_directory(dir).get();
|
||||
std::vector<sstring> components;
|
||||
sstring all(text.begin(), text.end());
|
||||
boost::split(components, all, boost::is_any_of("\n"));
|
||||
auto toc_txt = sstring("TOC.txt");
|
||||
sstring prefix = sstable_toc_name.substr(0, sstable_toc_name.size() - toc_txt.size());
|
||||
parallel_for_each(components, [prefix, toc_txt] (sstring component) {
|
||||
parallel_for_each(components, [prefix] (sstring component) {
|
||||
if (component.empty()) {
|
||||
// eof
|
||||
return make_ready_future<>();
|
||||
}
|
||||
if (component == toc_txt) {
|
||||
if (component == TOC_SUFFIX) {
|
||||
// already deleted
|
||||
return make_ready_future<>();
|
||||
}
|
||||
return remove_file(prefix + component);
|
||||
}).get();
|
||||
fsync_directory(dir).get();
|
||||
remove_file(new_toc_name).get();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -343,6 +343,9 @@ public:
|
||||
service::get_pending_range_calculator_service().stop().get();
|
||||
|
||||
locator::i_endpoint_snitch::stop_snitch().get();
|
||||
|
||||
sstables::await_background_jobs_on_all_shards().get();
|
||||
|
||||
bool old_active = true;
|
||||
assert(active.compare_exchange_strong(old_active, false));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user