mirror of
https://github.com/scylladb/scylladb.git
synced 2026-06-05 22:43:15 +00:00
Merge "Fixes for gcc 7" from Avi
"gcc 7 doesn't like some of our code, so adjust to make it happy." * 'gcc7' of http://github.com/avikivity/scylla: Remove exception specifications commitlog: handle noexcept conflict between unlink and function object thrift: change generated code namespace
This commit is contained in:
@@ -331,14 +331,13 @@ future<bool> auth::auth::is_super_user(const sstring& username) {
|
||||
});
|
||||
}
|
||||
|
||||
future<> auth::auth::insert_user(const sstring& username, bool is_super)
|
||||
throw (exceptions::request_execution_exception) {
|
||||
future<> auth::auth::insert_user(const sstring& username, bool is_super) {
|
||||
return cql3::get_local_query_processor().process(sprint("INSERT INTO %s.%s (%s, %s) VALUES (?, ?)",
|
||||
AUTH_KS, USERS_CF, USER_NAME, SUPER),
|
||||
consistency_for_user(username), { username, is_super }).discard_result();
|
||||
}
|
||||
|
||||
future<> auth::auth::delete_user(const sstring& username) throw(exceptions::request_execution_exception) {
|
||||
future<> auth::auth::delete_user(const sstring& username) {
|
||||
return cql3::get_local_query_processor().process(sprint("DELETE FROM %s.%s WHERE %s = ?",
|
||||
AUTH_KS, USERS_CF, USER_NAME),
|
||||
consistency_for_user(username), { username }).discard_result();
|
||||
|
||||
@@ -91,7 +91,7 @@ public:
|
||||
* @param isSuper User's new status.
|
||||
* @throws RequestExecutionException
|
||||
*/
|
||||
static future<> insert_user(const sstring& username, bool is_super) throw(exceptions::request_execution_exception);
|
||||
static future<> insert_user(const sstring& username, bool is_super);
|
||||
|
||||
/**
|
||||
* Deletes the user from AUTH_KS.USERS_CF.
|
||||
@@ -99,7 +99,7 @@ public:
|
||||
* @param username Username to delete.
|
||||
* @throws RequestExecutionException
|
||||
*/
|
||||
static future<> delete_user(const sstring& username) throw(exceptions::request_execution_exception);
|
||||
static future<> delete_user(const sstring& username);
|
||||
|
||||
/**
|
||||
* Sets up Authenticator and Authorizer.
|
||||
|
||||
@@ -72,7 +72,7 @@ sstring auth::authenticator::option_to_string(option opt) {
|
||||
static std::unique_ptr<auth::authenticator> global_authenticator;
|
||||
|
||||
future<>
|
||||
auth::authenticator::setup(const sstring& type) throw (exceptions::configuration_exception) {
|
||||
auth::authenticator::setup(const sstring& type) {
|
||||
if (auth::auth::is_class_type(type, ALLOW_ALL_AUTHENTICATOR_NAME)) {
|
||||
class allow_all_authenticator : public authenticator {
|
||||
public:
|
||||
@@ -88,16 +88,16 @@ auth::authenticator::setup(const sstring& type) throw (exceptions::configuration
|
||||
option_set alterable_options() const override {
|
||||
return option_set();
|
||||
}
|
||||
future<::shared_ptr<authenticated_user>> authenticate(const credentials_map& credentials) const throw(exceptions::authentication_exception) override {
|
||||
future<::shared_ptr<authenticated_user>> authenticate(const credentials_map& credentials) const override {
|
||||
return make_ready_future<::shared_ptr<authenticated_user>>(::make_shared<authenticated_user>());
|
||||
}
|
||||
future<> create(sstring username, const option_map& options) throw(exceptions::request_validation_exception, exceptions::request_execution_exception) override {
|
||||
future<> create(sstring username, const option_map& options) override {
|
||||
return make_ready_future();
|
||||
}
|
||||
future<> alter(sstring username, const option_map& options) throw(exceptions::request_validation_exception, exceptions::request_execution_exception) override {
|
||||
future<> alter(sstring username, const option_map& options) override {
|
||||
return make_ready_future();
|
||||
}
|
||||
future<> drop(sstring username) throw(exceptions::request_validation_exception, exceptions::request_execution_exception) override {
|
||||
future<> drop(sstring username) override {
|
||||
return make_ready_future();
|
||||
}
|
||||
const resource_ids& protected_resources() const override {
|
||||
|
||||
@@ -92,7 +92,7 @@ public:
|
||||
* For example, use this method to create any required keyspaces/column families.
|
||||
* Note: Only call from main thread.
|
||||
*/
|
||||
static future<> setup(const sstring& type) throw(exceptions::configuration_exception);
|
||||
static future<> setup(const sstring& type);
|
||||
|
||||
/**
|
||||
* Returns the system authenticator. Must have called setup before calling this.
|
||||
@@ -129,7 +129,7 @@ public:
|
||||
*
|
||||
* @throws authentication_exception if credentials don't match any known user.
|
||||
*/
|
||||
virtual future<::shared_ptr<authenticated_user>> authenticate(const credentials_map& credentials) const throw(exceptions::authentication_exception) = 0;
|
||||
virtual future<::shared_ptr<authenticated_user>> authenticate(const credentials_map& credentials) const = 0;
|
||||
|
||||
/**
|
||||
* Called during execution of CREATE USER query (also may be called on startup, see seedSuperuserOptions method).
|
||||
@@ -141,7 +141,7 @@ public:
|
||||
* @throws exceptions::request_validation_exception
|
||||
* @throws exceptions::request_execution_exception
|
||||
*/
|
||||
virtual future<> create(sstring username, const option_map& options) throw(exceptions::request_validation_exception, exceptions::request_execution_exception) = 0;
|
||||
virtual future<> create(sstring username, const option_map& options) = 0;
|
||||
|
||||
/**
|
||||
* Called during execution of ALTER USER query.
|
||||
@@ -154,7 +154,7 @@ public:
|
||||
* @throws exceptions::request_validation_exception
|
||||
* @throws exceptions::request_execution_exception
|
||||
*/
|
||||
virtual future<> alter(sstring username, const option_map& options) throw(exceptions::request_validation_exception, exceptions::request_execution_exception) = 0;
|
||||
virtual future<> alter(sstring username, const option_map& options) = 0;
|
||||
|
||||
|
||||
/**
|
||||
@@ -164,7 +164,7 @@ public:
|
||||
* @throws exceptions::request_validation_exception
|
||||
* @throws exceptions::request_execution_exception
|
||||
*/
|
||||
virtual future<> drop(sstring username) throw(exceptions::request_validation_exception, exceptions::request_execution_exception) = 0;
|
||||
virtual future<> drop(sstring username) = 0;
|
||||
|
||||
/**
|
||||
* Set of resources that should be made inaccessible to users and only accessible internally.
|
||||
@@ -177,9 +177,9 @@ public:
|
||||
class sasl_challenge {
|
||||
public:
|
||||
virtual ~sasl_challenge() {}
|
||||
virtual bytes evaluate_response(bytes_view client_response) throw(exceptions::authentication_exception) = 0;
|
||||
virtual bytes evaluate_response(bytes_view client_response) = 0;
|
||||
virtual bool is_complete() const = 0;
|
||||
virtual future<::shared_ptr<authenticated_user>> get_authenticated_user() const throw(exceptions::authentication_exception) = 0;
|
||||
virtual future<::shared_ptr<authenticated_user>> get_authenticated_user() const = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -115,16 +115,14 @@ auth::data_resource auth::data_resource::get_parent() const {
|
||||
}
|
||||
}
|
||||
|
||||
const sstring& auth::data_resource::keyspace() const
|
||||
throw (std::invalid_argument) {
|
||||
const sstring& auth::data_resource::keyspace() const {
|
||||
if (is_root_level()) {
|
||||
throw std::invalid_argument("ROOT data resource has no keyspace");
|
||||
}
|
||||
return _ks;
|
||||
}
|
||||
|
||||
const sstring& auth::data_resource::column_family() const
|
||||
throw (std::invalid_argument) {
|
||||
const sstring& auth::data_resource::column_family() const {
|
||||
if (!is_column_family_level()) {
|
||||
throw std::invalid_argument(sprint("%s data resource has no column family", name()));
|
||||
}
|
||||
|
||||
@@ -117,13 +117,13 @@ public:
|
||||
* @return keyspace of the resource.
|
||||
* @throws std::invalid_argument if it's the root-level resource.
|
||||
*/
|
||||
const sstring& keyspace() const throw(std::invalid_argument);
|
||||
const sstring& keyspace() const;
|
||||
|
||||
/**
|
||||
* @return column family of the resource.
|
||||
* @throws std::invalid_argument if it's not a cf-level resource.
|
||||
*/
|
||||
const sstring& column_family() const throw(std::invalid_argument);
|
||||
const sstring& column_family() const;
|
||||
|
||||
/**
|
||||
* @return Whether or not the resource has a parent in the hierarchy.
|
||||
|
||||
@@ -201,8 +201,7 @@ auth::authenticator::option_set auth::password_authenticator::alterable_options(
|
||||
}
|
||||
|
||||
future<::shared_ptr<auth::authenticated_user> > auth::password_authenticator::authenticate(
|
||||
const credentials_map& credentials) const
|
||||
throw (exceptions::authentication_exception) {
|
||||
const credentials_map& credentials) const {
|
||||
if (!credentials.count(USERNAME_KEY)) {
|
||||
throw exceptions::authentication_exception(sprint("Required key '%s' is missing", USERNAME_KEY));
|
||||
}
|
||||
@@ -241,9 +240,7 @@ future<::shared_ptr<auth::authenticated_user> > auth::password_authenticator::au
|
||||
}
|
||||
|
||||
future<> auth::password_authenticator::create(sstring username,
|
||||
const option_map& options)
|
||||
throw (exceptions::request_validation_exception,
|
||||
exceptions::request_execution_exception) {
|
||||
const option_map& options) {
|
||||
try {
|
||||
auto password = boost::any_cast<sstring>(options.at(option::PASSWORD));
|
||||
auto query = sprint("INSERT INTO %s.%s (%s, %s) VALUES (?, ?)",
|
||||
@@ -256,9 +253,7 @@ future<> auth::password_authenticator::create(sstring username,
|
||||
}
|
||||
|
||||
future<> auth::password_authenticator::alter(sstring username,
|
||||
const option_map& options)
|
||||
throw (exceptions::request_validation_exception,
|
||||
exceptions::request_execution_exception) {
|
||||
const option_map& options) {
|
||||
try {
|
||||
auto password = boost::any_cast<sstring>(options.at(option::PASSWORD));
|
||||
auto query = sprint("UPDATE %s.%s SET %s = ? WHERE %s = ?",
|
||||
@@ -270,9 +265,7 @@ future<> auth::password_authenticator::alter(sstring username,
|
||||
}
|
||||
}
|
||||
|
||||
future<> auth::password_authenticator::drop(sstring username)
|
||||
throw (exceptions::request_validation_exception,
|
||||
exceptions::request_execution_exception) {
|
||||
future<> auth::password_authenticator::drop(sstring username) {
|
||||
try {
|
||||
auto query = sprint("DELETE FROM %s.%s WHERE %s = ?",
|
||||
auth::AUTH_KS, CREDENTIALS_CF, USER_NAME);
|
||||
@@ -308,8 +301,7 @@ const auth::resource_ids& auth::password_authenticator::protected_resources() co
|
||||
* would expect
|
||||
* @throws javax.security.sasl.SaslException
|
||||
*/
|
||||
bytes evaluate_response(bytes_view client_response)
|
||||
throw (exceptions::authentication_exception) override {
|
||||
bytes evaluate_response(bytes_view client_response) override {
|
||||
logger.debug("Decoding credentials from client token");
|
||||
|
||||
sstring username, password;
|
||||
@@ -347,8 +339,7 @@ const auth::resource_ids& auth::password_authenticator::protected_resources() co
|
||||
bool is_complete() const override {
|
||||
return _complete;
|
||||
}
|
||||
future<::shared_ptr<authenticated_user>> get_authenticated_user() const
|
||||
throw (exceptions::authentication_exception) override {
|
||||
future<::shared_ptr<authenticated_user>> get_authenticated_user() const override {
|
||||
return _authenticator.authenticate(_credentials);
|
||||
}
|
||||
private:
|
||||
|
||||
@@ -58,10 +58,10 @@ public:
|
||||
bool require_authentication() const override;
|
||||
option_set supported_options() const override;
|
||||
option_set alterable_options() const override;
|
||||
future<::shared_ptr<authenticated_user>> authenticate(const credentials_map& credentials) const throw(exceptions::authentication_exception) override;
|
||||
future<> create(sstring username, const option_map& options) throw(exceptions::request_validation_exception, exceptions::request_execution_exception) override;
|
||||
future<> alter(sstring username, const option_map& options) throw(exceptions::request_validation_exception, exceptions::request_execution_exception) override;
|
||||
future<> drop(sstring username) throw(exceptions::request_validation_exception, exceptions::request_execution_exception) override;
|
||||
future<::shared_ptr<authenticated_user>> authenticate(const credentials_map& credentials) const override;
|
||||
future<> create(sstring username, const option_map& options) override;
|
||||
future<> alter(sstring username, const option_map& options) override;
|
||||
future<> drop(sstring username) override;
|
||||
const resource_ids& protected_resources() const override;
|
||||
::shared_ptr<sasl_challenge> new_sasl_challenge() const override;
|
||||
|
||||
|
||||
@@ -436,7 +436,8 @@ public:
|
||||
_segment_manager->totals.total_size_on_disk -= size_on_disk();
|
||||
_segment_manager->totals.total_size -= (size_on_disk() + _buffer.size());
|
||||
try {
|
||||
commit_io_check(::unlink, _file_name.c_str());
|
||||
commit_io_check([] (const char* fname) { ::unlink(fname); },
|
||||
_file_name.c_str());
|
||||
} catch (...) {
|
||||
logger.error("Could not delete segment {}: {}", *this, std::current_exception());
|
||||
}
|
||||
|
||||
@@ -446,7 +446,7 @@ static future<> setup_version() {
|
||||
sstring(db::system_keyspace::LOCAL),
|
||||
version::release(),
|
||||
cql3::query_processor::CQL_VERSION,
|
||||
org::apache::cassandra::thrift_version,
|
||||
::cassandra::thrift_version,
|
||||
to_sstring(cql_serialization_format::latest_version),
|
||||
snitch->get_datacenter(utils::fb_utilities::get_broadcast_address()),
|
||||
snitch->get_rack(utils::fb_utilities::get_broadcast_address()),
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#
|
||||
|
||||
namespace java org.apache.cassandra.thrift
|
||||
namespace cpp org.apache.cassandra
|
||||
namespace cpp cassandra
|
||||
namespace csharp Apache.Cassandra
|
||||
namespace py cassandra
|
||||
namespace php cassandra
|
||||
|
||||
@@ -56,27 +56,28 @@ public:
|
||||
bool has(const sstring& column_name) const {
|
||||
return _cells.count(column_name) > 0;
|
||||
}
|
||||
// Look up a deserialized row cell value by column name.
|
||||
// Look up a deserialized row cell value by column name; throws no_such_column on error
|
||||
const data_value&
|
||||
get_data_value(const sstring& column_name) const throw (no_such_column) {
|
||||
get_data_value(const sstring& column_name) const {
|
||||
auto it = _cells.find(column_name);
|
||||
if (it == _cells.end()) {
|
||||
throw no_such_column(column_name);
|
||||
}
|
||||
return it->second;
|
||||
}
|
||||
// Look up a deserialized row cell value by column name.
|
||||
// Look up a deserialized row cell value by column name; throws no_such_column on error.
|
||||
template<typename T>
|
||||
std::experimental::optional<T>
|
||||
get(const sstring& column_name) const throw (no_such_column) {
|
||||
get(const sstring& column_name) const {
|
||||
auto&& value = get_data_value(column_name);
|
||||
if (value.is_null()) {
|
||||
return std::experimental::nullopt;
|
||||
}
|
||||
return std::experimental::optional<T>{value_cast<T>(value)};
|
||||
}
|
||||
// throws no_such_column or null_column_value on error
|
||||
template<typename T>
|
||||
T get_nonnull(const sstring& column_name) const throw (no_such_column, null_column_value) {
|
||||
T get_nonnull(const sstring& column_name) const {
|
||||
auto v = get<T>(column_name);
|
||||
if (v) {
|
||||
return *v;
|
||||
@@ -112,7 +113,8 @@ public:
|
||||
bool empty() const {
|
||||
return _rows.empty();
|
||||
}
|
||||
const result_set_row& row(size_t idx) const throw (std::out_of_range) {
|
||||
// throws std::out_of_range on error
|
||||
const result_set_row& row(size_t idx) const {
|
||||
if (idx >= _rows.size()) {
|
||||
throw std::out_of_range("no such row in result set: " + std::to_string(idx));
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ void service::client_state::validate_login() const {
|
||||
}
|
||||
}
|
||||
|
||||
void service::client_state::ensure_not_anonymous() const throw(exceptions::unauthorized_exception) {
|
||||
void service::client_state::ensure_not_anonymous() const {
|
||||
validate_login();
|
||||
if (_user->is_anonymous()) {
|
||||
throw exceptions::unauthorized_exception("You have to be logged in and not anonymous to perform this request");
|
||||
|
||||
@@ -247,7 +247,7 @@ public:
|
||||
future<> ensure_has_permission(auth::permission, auth::data_resource) const;
|
||||
|
||||
void validate_login() const;
|
||||
void ensure_not_anonymous() const throw(exceptions::unauthorized_exception);
|
||||
void ensure_not_anonymous() const; // unauthorized_exception on error
|
||||
|
||||
#if 0
|
||||
public void ensureIsSuper(String message) throws UnauthorizedException
|
||||
|
||||
@@ -250,7 +250,7 @@ public:
|
||||
*
|
||||
* @exception std::invalid_argument number of registers doesn't match.
|
||||
*/
|
||||
void merge(const HyperLogLog& other) throw (std::invalid_argument) {
|
||||
void merge(const HyperLogLog& other) {
|
||||
if (m_ != other.m_) {
|
||||
std::stringstream ss;
|
||||
ss << "number of registers doesn't match: " << m_ << " != " << other.m_;
|
||||
@@ -298,7 +298,7 @@ public:
|
||||
*
|
||||
* @exception std::runtime_error When failed to dump.
|
||||
*/
|
||||
void dump(std::ostream& os) const throw(std::runtime_error){
|
||||
void dump(std::ostream& os) const {
|
||||
os.write((char*)&b_, sizeof(b_));
|
||||
os.write((char*)&M_[0], sizeof(M_[0]) * M_.size());
|
||||
if(os.fail()){
|
||||
@@ -313,7 +313,7 @@ public:
|
||||
*
|
||||
* @exception std::runtime_error When failed to restore.
|
||||
*/
|
||||
void restore(std::istream& is) throw(std::runtime_error){
|
||||
void restore(std::istream& is) {
|
||||
uint8_t b = 0;
|
||||
is.read((char*)&b, sizeof(b));
|
||||
HyperLogLog tempHLL(b);
|
||||
|
||||
@@ -58,7 +58,7 @@ using namespace ::apache::thrift::protocol;
|
||||
using namespace ::apache::thrift::transport;
|
||||
using namespace ::apache::thrift::async;
|
||||
|
||||
using namespace ::org::apache::cassandra;
|
||||
using namespace ::cassandra;
|
||||
|
||||
using namespace thrift;
|
||||
|
||||
@@ -687,7 +687,7 @@ public:
|
||||
}
|
||||
|
||||
void describe_version(tcxx::function<void(std::string const& _return)> cob) {
|
||||
cob(org::apache::cassandra::thrift_version);
|
||||
cob(::cassandra::thrift_version);
|
||||
}
|
||||
|
||||
void do_describe_ring(tcxx::function<void(std::vector<TokenRange> const& _return)> cob, tcxx::function<void(::apache::thrift::TDelayedException* _throw)> exn_cob, const std::string& keyspace, bool local) {
|
||||
|
||||
@@ -28,6 +28,6 @@
|
||||
#include "cql3/query_processor.hh"
|
||||
#include <memory>
|
||||
|
||||
std::unique_ptr<org::apache::cassandra::CassandraCobSvIfFactory> create_handler_factory(distributed<database>& db, distributed<cql3::query_processor>& qp);
|
||||
std::unique_ptr<::cassandra::CassandraCobSvIfFactory> create_handler_factory(distributed<database>& db, distributed<cql3::query_processor>& qp);
|
||||
|
||||
#endif /* APPS_SEASTAR_THRIFT_HANDLER_HH_ */
|
||||
|
||||
@@ -48,7 +48,7 @@ using namespace apache::thrift;
|
||||
using namespace apache::thrift::transport;
|
||||
using namespace apache::thrift::protocol;
|
||||
using namespace apache::thrift::async;
|
||||
using namespace org::apache::cassandra;
|
||||
using namespace ::cassandra;
|
||||
|
||||
class thrift_stats {
|
||||
seastar::metrics::metric_groups _metrics;
|
||||
|
||||
@@ -32,13 +32,13 @@ class thrift_server;
|
||||
class thrift_stats;
|
||||
class database;
|
||||
|
||||
namespace org { namespace apache { namespace cassandra {
|
||||
namespace cassandra {
|
||||
|
||||
static const sstring thrift_version = "20.1.0";
|
||||
|
||||
class CassandraCobSvIfFactory;
|
||||
|
||||
}}}
|
||||
}
|
||||
|
||||
namespace apache { namespace thrift { namespace protocol {
|
||||
|
||||
@@ -56,7 +56,7 @@ class TAsyncProcessorFactory;
|
||||
class thrift_server {
|
||||
std::vector<server_socket> _listeners;
|
||||
std::unique_ptr<thrift_stats> _stats;
|
||||
boost::shared_ptr<org::apache::cassandra::CassandraCobSvIfFactory> _handler_factory;
|
||||
boost::shared_ptr<::cassandra::CassandraCobSvIfFactory> _handler_factory;
|
||||
std::unique_ptr<apache::thrift::protocol::TProtocolFactory> _protocol_factory;
|
||||
boost::shared_ptr<apache::thrift::async::TAsyncProcessorFactory> _processor_factory;
|
||||
uint64_t _total_connections = 0;
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
#include "bytes.hh"
|
||||
#include "Cassandra.h"
|
||||
|
||||
using namespace ::org::apache::cassandra;
|
||||
using namespace ::cassandra;
|
||||
|
||||
#if 0
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
Reference in New Issue
Block a user