This is an automated email from the ASF dual-hosted git repository. ctubbsii pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/accumulo-proxy.git
The following commit(s) were added to refs/heads/main by this push: new 52bb2bc Update compaction techniques (#60) 52bb2bc is described below commit 52bb2bc7259b1b86aeebdfc2e8b95a3f109bfa2f Author: Dom G <domgargu...@apache.org> AuthorDate: Tue Jan 17 23:43:27 2023 -0500 Update compaction techniques (#60) Co-authored-by: Christopher Tubbs <ctubb...@apache.org> --- pom.xml | 6 - src/main/cpp/AccumuloProxy.cpp | 48 ++-- src/main/cpp/AccumuloProxy.h | 37 +-- src/main/cpp/AccumuloProxy_server.skeleton.cpp | 2 +- src/main/cpp/proxy_types.cpp | 24 +- src/main/cpp/proxy_types.h | 32 +-- .../org/apache/accumulo/proxy/ProxyServer.java | 33 ++- src/main/python/accumulo/AccumuloProxy-remote | 8 +- src/main/python/accumulo/AccumuloProxy.py | 50 ++-- src/main/python/accumulo/ttypes.py | 8 +- src/main/ruby/accumulo/lib/accumulo_proxy.rb | 16 +- src/main/ruby/accumulo/lib/proxy_types.rb | 4 +- .../accumulo/proxy/thrift/AccumuloProxy.java | 264 +++++++++++++++------ ...actionStrategyConfig.java => PluginConfig.java} | 58 ++--- src/main/thrift/proxy.thrift | 5 +- .../accumulo/proxy/its/SelectHalfSelector.java | 45 ++++ .../apache/accumulo/proxy/its/SimpleProxyBase.java | 57 ++--- src/test/resources/TestCompactionStrat.jar | Bin 2530 -> 0 bytes 18 files changed, 446 insertions(+), 251 deletions(-) diff --git a/pom.xml b/pom.xml index 5850d58..73cf074 100644 --- a/pom.xml +++ b/pom.xml @@ -188,12 +188,6 @@ <version>${hadoop.version}</version> <scope>runtime</scope> </dependency> - <dependency> - <groupId>commons-io</groupId> - <artifactId>commons-io</artifactId> - <version>2.11.0</version> - <scope>test</scope> - </dependency> <dependency> <groupId>org.apache.accumulo</groupId> <artifactId>accumulo-test</artifactId> diff --git a/src/main/cpp/AccumuloProxy.cpp b/src/main/cpp/AccumuloProxy.cpp index 6faadd9..0bc8bc5 100644 --- a/src/main/cpp/AccumuloProxy.cpp +++ b/src/main/cpp/AccumuloProxy.cpp @@ -2149,8 +2149,16 @@ uint32_t AccumuloProxy_compactTable_args::read(::apache::thrift::protocol::TProt break; case 8: if (ftype == ::apache::thrift::protocol::T_STRUCT) { - xfer += this->compactionStrategy.read(iprot); - this->__isset.compactionStrategy = true; + xfer += this->selectorConfig.read(iprot); + this->__isset.selectorConfig = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 9: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->configurerConfig.read(iprot); + this->__isset.configurerConfig = true; } else { xfer += iprot->skip(ftype); } @@ -2208,8 +2216,12 @@ uint32_t AccumuloProxy_compactTable_args::write(::apache::thrift::protocol::TPro xfer += oprot->writeBool(this->wait); xfer += oprot->writeFieldEnd(); - xfer += oprot->writeFieldBegin("compactionStrategy", ::apache::thrift::protocol::T_STRUCT, 8); - xfer += this->compactionStrategy.write(oprot); + xfer += oprot->writeFieldBegin("selectorConfig", ::apache::thrift::protocol::T_STRUCT, 8); + xfer += this->selectorConfig.write(oprot); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldBegin("configurerConfig", ::apache::thrift::protocol::T_STRUCT, 9); + xfer += this->configurerConfig.write(oprot); xfer += oprot->writeFieldEnd(); xfer += oprot->writeFieldStop(); @@ -2263,8 +2275,12 @@ uint32_t AccumuloProxy_compactTable_pargs::write(::apache::thrift::protocol::TPr xfer += oprot->writeBool((*(this->wait))); xfer += oprot->writeFieldEnd(); - xfer += oprot->writeFieldBegin("compactionStrategy", ::apache::thrift::protocol::T_STRUCT, 8); - xfer += (*(this->compactionStrategy)).write(oprot); + xfer += oprot->writeFieldBegin("selectorConfig", ::apache::thrift::protocol::T_STRUCT, 8); + xfer += (*(this->selectorConfig)).write(oprot); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldBegin("configurerConfig", ::apache::thrift::protocol::T_STRUCT, 9); + xfer += (*(this->configurerConfig)).write(oprot); xfer += oprot->writeFieldEnd(); xfer += oprot->writeFieldStop(); @@ -27334,13 +27350,13 @@ void AccumuloProxyClient::recv_cloneTable() return; } -void AccumuloProxyClient::compactTable(const std::string& login, const std::string& tableName, const std::string& startRow, const std::string& endRow, const std::vector<IteratorSetting> & iterators, const bool flush, const bool wait, const CompactionStrategyConfig& compactionStrategy) +void AccumuloProxyClient::compactTable(const std::string& login, const std::string& tableName, const std::string& startRow, const std::string& endRow, const std::vector<IteratorSetting> & iterators, const bool flush, const bool wait, const PluginConfig& selectorConfig, const PluginConfig& configurerConfig) { - send_compactTable(login, tableName, startRow, endRow, iterators, flush, wait, compactionStrategy); + send_compactTable(login, tableName, startRow, endRow, iterators, flush, wait, selectorConfig, configurerConfig); recv_compactTable(); } -void AccumuloProxyClient::send_compactTable(const std::string& login, const std::string& tableName, const std::string& startRow, const std::string& endRow, const std::vector<IteratorSetting> & iterators, const bool flush, const bool wait, const CompactionStrategyConfig& compactionStrategy) +void AccumuloProxyClient::send_compactTable(const std::string& login, const std::string& tableName, const std::string& startRow, const std::string& endRow, const std::vector<IteratorSetting> & iterators, const bool flush, const bool wait, const PluginConfig& selectorConfig, const PluginConfig& configurerConfig) { int32_t cseqid = 0; oprot_->writeMessageBegin("compactTable", ::apache::thrift::protocol::T_CALL, cseqid); @@ -27353,7 +27369,8 @@ void AccumuloProxyClient::send_compactTable(const std::string& login, const std: args.iterators = &iterators; args.flush = &flush; args.wait = &wait; - args.compactionStrategy = &compactionStrategy; + args.selectorConfig = &selectorConfig; + args.configurerConfig = &configurerConfig; args.write(oprot_); oprot_->writeMessageEnd(); @@ -33765,7 +33782,7 @@ void AccumuloProxyProcessor::process_compactTable(int32_t seqid, ::apache::thrif AccumuloProxy_compactTable_result result; try { - iface_->compactTable(args.login, args.tableName, args.startRow, args.endRow, args.iterators, args.flush, args.wait, args.compactionStrategy); + iface_->compactTable(args.login, args.tableName, args.startRow, args.endRow, args.iterators, args.flush, args.wait, args.selectorConfig, args.configurerConfig); } catch (AccumuloSecurityException &ouch1) { result.ouch1 = std::move(ouch1); result.__isset.ouch1 = true; @@ -40028,13 +40045,13 @@ void AccumuloProxyConcurrentClient::recv_cloneTable(const int32_t seqid) } // end while(true) } -void AccumuloProxyConcurrentClient::compactTable(const std::string& login, const std::string& tableName, const std::string& startRow, const std::string& endRow, const std::vector<IteratorSetting> & iterators, const bool flush, const bool wait, const CompactionStrategyConfig& compactionStrategy) +void AccumuloProxyConcurrentClient::compactTable(const std::string& login, const std::string& tableName, const std::string& startRow, const std::string& endRow, const std::vector<IteratorSetting> & iterators, const bool flush, const bool wait, const PluginConfig& selectorConfig, const PluginConfig& configurerConfig) { - int32_t seqid = send_compactTable(login, tableName, startRow, endRow, iterators, flush, wait, compactionStrategy); + int32_t seqid = send_compactTable(login, tableName, startRow, endRow, iterators, flush, wait, selectorConfig, configurerConfig); recv_compactTable(seqid); } -int32_t AccumuloProxyConcurrentClient::send_compactTable(const std::string& login, const std::string& tableName, const std::string& startRow, const std::string& endRow, const std::vector<IteratorSetting> & iterators, const bool flush, const bool wait, const CompactionStrategyConfig& compactionStrategy) +int32_t AccumuloProxyConcurrentClient::send_compactTable(const std::string& login, const std::string& tableName, const std::string& startRow, const std::string& endRow, const std::vector<IteratorSetting> & iterators, const bool flush, const bool wait, const PluginConfig& selectorConfig, const PluginConfig& configurerConfig) { int32_t cseqid = this->sync_->generateSeqId(); ::apache::thrift::async::TConcurrentSendSentry sentry(this->sync_.get()); @@ -40048,7 +40065,8 @@ int32_t AccumuloProxyConcurrentClient::send_compactTable(const std::string& logi args.iterators = &iterators; args.flush = &flush; args.wait = &wait; - args.compactionStrategy = &compactionStrategy; + args.selectorConfig = &selectorConfig; + args.configurerConfig = &configurerConfig; args.write(oprot_); oprot_->writeMessageEnd(); diff --git a/src/main/cpp/AccumuloProxy.h b/src/main/cpp/AccumuloProxy.h index 7ce9e32..5d1f420 100644 --- a/src/main/cpp/AccumuloProxy.h +++ b/src/main/cpp/AccumuloProxy.h @@ -47,7 +47,7 @@ class AccumuloProxyIf { virtual void checkIteratorConflicts(const std::string& login, const std::string& tableName, const IteratorSetting& setting, const std::set<IteratorScope::type> & scopes) = 0; virtual void clearLocatorCache(const std::string& login, const std::string& tableName) = 0; virtual void cloneTable(const std::string& login, const std::string& tableName, const std::string& newTableName, const bool flush, const std::map<std::string, std::string> & propertiesToSet, const std::set<std::string> & propertiesToExclude) = 0; - virtual void compactTable(const std::string& login, const std::string& tableName, const std::string& startRow, const std::string& endRow, const std::vector<IteratorSetting> & iterators, const bool flush, const bool wait, const CompactionStrategyConfig& compactionStrategy) = 0; + virtual void compactTable(const std::string& login, const std::string& tableName, const std::string& startRow, const std::string& endRow, const std::vector<IteratorSetting> & iterators, const bool flush, const bool wait, const PluginConfig& selectorConfig, const PluginConfig& configurerConfig) = 0; virtual void cancelCompaction(const std::string& login, const std::string& tableName) = 0; virtual void createTable(const std::string& login, const std::string& tableName, const bool versioningIter, const TimeType::type type) = 0; virtual void deleteTable(const std::string& login, const std::string& tableName) = 0; @@ -191,7 +191,7 @@ class AccumuloProxyNull : virtual public AccumuloProxyIf { void cloneTable(const std::string& /* login */, const std::string& /* tableName */, const std::string& /* newTableName */, const bool /* flush */, const std::map<std::string, std::string> & /* propertiesToSet */, const std::set<std::string> & /* propertiesToExclude */) override { return; } - void compactTable(const std::string& /* login */, const std::string& /* tableName */, const std::string& /* startRow */, const std::string& /* endRow */, const std::vector<IteratorSetting> & /* iterators */, const bool /* flush */, const bool /* wait */, const CompactionStrategyConfig& /* compactionStrategy */) override { + void compactTable(const std::string& /* login */, const std::string& /* tableName */, const std::string& /* startRow */, const std::string& /* endRow */, const std::vector<IteratorSetting> & /* iterators */, const bool /* flush */, const bool /* wait */, const PluginConfig& /* selectorConfig */, const PluginConfig& /* configurerConfig */) override { return; } void cancelCompaction(const std::string& /* login */, const std::string& /* tableName */) override { @@ -1454,7 +1454,7 @@ class AccumuloProxy_cloneTable_presult { }; typedef struct _AccumuloProxy_compactTable_args__isset { - _AccumuloProxy_compactTable_args__isset() : login(false), tableName(false), startRow(false), endRow(false), iterators(false), flush(false), wait(false), compactionStrategy(false) {} + _AccumuloProxy_compactTable_args__isset() : login(false), tableName(false), startRow(false), endRow(false), iterators(false), flush(false), wait(false), selectorConfig(false), configurerConfig(false) {} bool login :1; bool tableName :1; bool startRow :1; @@ -1462,7 +1462,8 @@ typedef struct _AccumuloProxy_compactTable_args__isset { bool iterators :1; bool flush :1; bool wait :1; - bool compactionStrategy :1; + bool selectorConfig :1; + bool configurerConfig :1; } _AccumuloProxy_compactTable_args__isset; class AccumuloProxy_compactTable_args { @@ -1487,7 +1488,8 @@ class AccumuloProxy_compactTable_args { std::vector<IteratorSetting> iterators; bool flush; bool wait; - CompactionStrategyConfig compactionStrategy; + PluginConfig selectorConfig; + PluginConfig configurerConfig; _AccumuloProxy_compactTable_args__isset __isset; @@ -1505,7 +1507,9 @@ class AccumuloProxy_compactTable_args { void __set_wait(const bool val); - void __set_compactionStrategy(const CompactionStrategyConfig& val); + void __set_selectorConfig(const PluginConfig& val); + + void __set_configurerConfig(const PluginConfig& val); bool operator == (const AccumuloProxy_compactTable_args & rhs) const { @@ -1523,7 +1527,9 @@ class AccumuloProxy_compactTable_args { return false; if (!(wait == rhs.wait)) return false; - if (!(compactionStrategy == rhs.compactionStrategy)) + if (!(selectorConfig == rhs.selectorConfig)) + return false; + if (!(configurerConfig == rhs.configurerConfig)) return false; return true; } @@ -1551,7 +1557,8 @@ class AccumuloProxy_compactTable_pargs { const std::vector<IteratorSetting> * iterators; const bool* flush; const bool* wait; - const CompactionStrategyConfig* compactionStrategy; + const PluginConfig* selectorConfig; + const PluginConfig* configurerConfig; uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; @@ -14009,8 +14016,8 @@ class AccumuloProxyClient : virtual public AccumuloProxyIf { void cloneTable(const std::string& login, const std::string& tableName, const std::string& newTableName, const bool flush, const std::map<std::string, std::string> & propertiesToSet, const std::set<std::string> & propertiesToExclude) override; void send_cloneTable(const std::string& login, const std::string& tableName, const std::string& newTableName, const bool flush, const std::map<std::string, std::string> & propertiesToSet, const std::set<std::string> & propertiesToExclude); void recv_cloneTable(); - void compactTable(const std::string& login, const std::string& tableName, const std::string& startRow, const std::string& endRow, const std::vector<IteratorSetting> & iterators, const bool flush, const bool wait, const CompactionStrategyConfig& compactionStrategy) override; - void send_compactTable(const std::string& login, const std::string& tableName, const std::string& startRow, const std::string& endRow, const std::vector<IteratorSetting> & iterators, const bool flush, const bool wait, const CompactionStrategyConfig& compactionStrategy); + void compactTable(const std::string& login, const std::string& tableName, const std::string& startRow, const std::string& endRow, const std::vector<IteratorSetting> & iterators, const bool flush, const bool wait, const PluginConfig& selectorConfig, const PluginConfig& configurerConfig) override; + void send_compactTable(const std::string& login, const std::string& tableName, const std::string& startRow, const std::string& endRow, const std::vector<IteratorSetting> & iterators, const bool flush, const bool wait, const PluginConfig& selectorConfig, const PluginConfig& configurerConfig); void recv_compactTable(); void cancelCompaction(const std::string& login, const std::string& tableName) override; void send_cancelCompaction(const std::string& login, const std::string& tableName); @@ -14597,13 +14604,13 @@ class AccumuloProxyMultiface : virtual public AccumuloProxyIf { ifaces_[i]->cloneTable(login, tableName, newTableName, flush, propertiesToSet, propertiesToExclude); } - void compactTable(const std::string& login, const std::string& tableName, const std::string& startRow, const std::string& endRow, const std::vector<IteratorSetting> & iterators, const bool flush, const bool wait, const CompactionStrategyConfig& compactionStrategy) override { + void compactTable(const std::string& login, const std::string& tableName, const std::string& startRow, const std::string& endRow, const std::vector<IteratorSetting> & iterators, const bool flush, const bool wait, const PluginConfig& selectorConfig, const PluginConfig& configurerConfig) override { size_t sz = ifaces_.size(); size_t i = 0; for (; i < (sz - 1); ++i) { - ifaces_[i]->compactTable(login, tableName, startRow, endRow, iterators, flush, wait, compactionStrategy); + ifaces_[i]->compactTable(login, tableName, startRow, endRow, iterators, flush, wait, selectorConfig, configurerConfig); } - ifaces_[i]->compactTable(login, tableName, startRow, endRow, iterators, flush, wait, compactionStrategy); + ifaces_[i]->compactTable(login, tableName, startRow, endRow, iterators, flush, wait, selectorConfig, configurerConfig); } void cancelCompaction(const std::string& login, const std::string& tableName) override { @@ -15522,8 +15529,8 @@ class AccumuloProxyConcurrentClient : virtual public AccumuloProxyIf { void cloneTable(const std::string& login, const std::string& tableName, const std::string& newTableName, const bool flush, const std::map<std::string, std::string> & propertiesToSet, const std::set<std::string> & propertiesToExclude) override; int32_t send_cloneTable(const std::string& login, const std::string& tableName, const std::string& newTableName, const bool flush, const std::map<std::string, std::string> & propertiesToSet, const std::set<std::string> & propertiesToExclude); void recv_cloneTable(const int32_t seqid); - void compactTable(const std::string& login, const std::string& tableName, const std::string& startRow, const std::string& endRow, const std::vector<IteratorSetting> & iterators, const bool flush, const bool wait, const CompactionStrategyConfig& compactionStrategy) override; - int32_t send_compactTable(const std::string& login, const std::string& tableName, const std::string& startRow, const std::string& endRow, const std::vector<IteratorSetting> & iterators, const bool flush, const bool wait, const CompactionStrategyConfig& compactionStrategy); + void compactTable(const std::string& login, const std::string& tableName, const std::string& startRow, const std::string& endRow, const std::vector<IteratorSetting> & iterators, const bool flush, const bool wait, const PluginConfig& selectorConfig, const PluginConfig& configurerConfig) override; + int32_t send_compactTable(const std::string& login, const std::string& tableName, const std::string& startRow, const std::string& endRow, const std::vector<IteratorSetting> & iterators, const bool flush, const bool wait, const PluginConfig& selectorConfig, const PluginConfig& configurerConfig); void recv_compactTable(const int32_t seqid); void cancelCompaction(const std::string& login, const std::string& tableName) override; int32_t send_cancelCompaction(const std::string& login, const std::string& tableName); diff --git a/src/main/cpp/AccumuloProxy_server.skeleton.cpp b/src/main/cpp/AccumuloProxy_server.skeleton.cpp index 55aff1f..b1e83fd 100644 --- a/src/main/cpp/AccumuloProxy_server.skeleton.cpp +++ b/src/main/cpp/AccumuloProxy_server.skeleton.cpp @@ -73,7 +73,7 @@ class AccumuloProxyHandler : virtual public AccumuloProxyIf { printf("cloneTable\n"); } - void compactTable(const std::string& login, const std::string& tableName, const std::string& startRow, const std::string& endRow, const std::vector<IteratorSetting> & iterators, const bool flush, const bool wait, const CompactionStrategyConfig& compactionStrategy) { + void compactTable(const std::string& login, const std::string& tableName, const std::string& startRow, const std::string& endRow, const std::vector<IteratorSetting> & iterators, const bool flush, const bool wait, const PluginConfig& selectorConfig, const PluginConfig& configurerConfig) { // Your implementation goes here printf("compactTable\n"); } diff --git a/src/main/cpp/proxy_types.cpp b/src/main/cpp/proxy_types.cpp index e93bf1d..c1e5d0c 100644 --- a/src/main/cpp/proxy_types.cpp +++ b/src/main/cpp/proxy_types.cpp @@ -3913,25 +3913,25 @@ void WriterOptions::printTo(std::ostream& out) const { } -CompactionStrategyConfig::~CompactionStrategyConfig() noexcept { +PluginConfig::~PluginConfig() noexcept { } -void CompactionStrategyConfig::__set_className(const std::string& val) { +void PluginConfig::__set_className(const std::string& val) { this->className = val; } -void CompactionStrategyConfig::__set_options(const std::map<std::string, std::string> & val) { +void PluginConfig::__set_options(const std::map<std::string, std::string> & val) { this->options = val; } -std::ostream& operator<<(std::ostream& out, const CompactionStrategyConfig& obj) +std::ostream& operator<<(std::ostream& out, const PluginConfig& obj) { obj.printTo(out); return out; } -uint32_t CompactionStrategyConfig::read(::apache::thrift::protocol::TProtocol* iprot) { +uint32_t PluginConfig::read(::apache::thrift::protocol::TProtocol* iprot) { ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); uint32_t xfer = 0; @@ -3995,10 +3995,10 @@ uint32_t CompactionStrategyConfig::read(::apache::thrift::protocol::TProtocol* i return xfer; } -uint32_t CompactionStrategyConfig::write(::apache::thrift::protocol::TProtocol* oprot) const { +uint32_t PluginConfig::write(::apache::thrift::protocol::TProtocol* oprot) const { uint32_t xfer = 0; ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); - xfer += oprot->writeStructBegin("CompactionStrategyConfig"); + xfer += oprot->writeStructBegin("PluginConfig"); xfer += oprot->writeFieldBegin("className", ::apache::thrift::protocol::T_STRING, 1); xfer += oprot->writeString(this->className); @@ -4022,27 +4022,27 @@ uint32_t CompactionStrategyConfig::write(::apache::thrift::protocol::TProtocol* return xfer; } -void swap(CompactionStrategyConfig &a, CompactionStrategyConfig &b) { +void swap(PluginConfig &a, PluginConfig &b) { using ::std::swap; swap(a.className, b.className); swap(a.options, b.options); swap(a.__isset, b.__isset); } -CompactionStrategyConfig::CompactionStrategyConfig(const CompactionStrategyConfig& other171) { +PluginConfig::PluginConfig(const PluginConfig& other171) { className = other171.className; options = other171.options; __isset = other171.__isset; } -CompactionStrategyConfig& CompactionStrategyConfig::operator=(const CompactionStrategyConfig& other172) { +PluginConfig& PluginConfig::operator=(const PluginConfig& other172) { className = other172.className; options = other172.options; __isset = other172.__isset; return *this; } -void CompactionStrategyConfig::printTo(std::ostream& out) const { +void PluginConfig::printTo(std::ostream& out) const { using ::apache::thrift::to_string; - out << "CompactionStrategyConfig("; + out << "PluginConfig("; out << "className=" << to_string(className); out << ", " << "options=" << to_string(options); out << ")"; diff --git a/src/main/cpp/proxy_types.h b/src/main/cpp/proxy_types.h index 47ab92e..d580bd3 100644 --- a/src/main/cpp/proxy_types.h +++ b/src/main/cpp/proxy_types.h @@ -271,7 +271,7 @@ class ActiveCompaction; class WriterOptions; -class CompactionStrategyConfig; +class PluginConfig; class UnknownScanner; @@ -1600,32 +1600,32 @@ void swap(WriterOptions &a, WriterOptions &b); std::ostream& operator<<(std::ostream& out, const WriterOptions& obj); -typedef struct _CompactionStrategyConfig__isset { - _CompactionStrategyConfig__isset() : className(false), options(false) {} +typedef struct _PluginConfig__isset { + _PluginConfig__isset() : className(false), options(false) {} bool className :1; bool options :1; -} _CompactionStrategyConfig__isset; +} _PluginConfig__isset; -class CompactionStrategyConfig : public virtual ::apache::thrift::TBase { +class PluginConfig : public virtual ::apache::thrift::TBase { public: - CompactionStrategyConfig(const CompactionStrategyConfig&); - CompactionStrategyConfig& operator=(const CompactionStrategyConfig&); - CompactionStrategyConfig() noexcept - : className() { + PluginConfig(const PluginConfig&); + PluginConfig& operator=(const PluginConfig&); + PluginConfig() noexcept + : className() { } - virtual ~CompactionStrategyConfig() noexcept; + virtual ~PluginConfig() noexcept; std::string className; std::map<std::string, std::string> options; - _CompactionStrategyConfig__isset __isset; + _PluginConfig__isset __isset; void __set_className(const std::string& val); void __set_options(const std::map<std::string, std::string> & val); - bool operator == (const CompactionStrategyConfig & rhs) const + bool operator == (const PluginConfig & rhs) const { if (!(className == rhs.className)) return false; @@ -1633,11 +1633,11 @@ class CompactionStrategyConfig : public virtual ::apache::thrift::TBase { return false; return true; } - bool operator != (const CompactionStrategyConfig &rhs) const { + bool operator != (const PluginConfig &rhs) const { return !(*this == rhs); } - bool operator < (const CompactionStrategyConfig & ) const; + bool operator < (const PluginConfig & ) const; uint32_t read(::apache::thrift::protocol::TProtocol* iprot) override; uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const override; @@ -1645,9 +1645,9 @@ class CompactionStrategyConfig : public virtual ::apache::thrift::TBase { virtual void printTo(std::ostream& out) const; }; -void swap(CompactionStrategyConfig &a, CompactionStrategyConfig &b); +void swap(PluginConfig &a, PluginConfig &b); -std::ostream& operator<<(std::ostream& out, const CompactionStrategyConfig& obj); +std::ostream& operator<<(std::ostream& out, const PluginConfig& obj); typedef struct _UnknownScanner__isset { _UnknownScanner__isset() : msg(false) {} diff --git a/src/main/java/org/apache/accumulo/proxy/ProxyServer.java b/src/main/java/org/apache/accumulo/proxy/ProxyServer.java index ce9a4e8..c36c362 100644 --- a/src/main/java/org/apache/accumulo/proxy/ProxyServer.java +++ b/src/main/java/org/apache/accumulo/proxy/ProxyServer.java @@ -60,6 +60,7 @@ import org.apache.accumulo.core.client.admin.ActiveCompaction; import org.apache.accumulo.core.client.admin.ActiveScan; import org.apache.accumulo.core.client.admin.CompactionConfig; import org.apache.accumulo.core.client.admin.NewTableConfiguration; +import org.apache.accumulo.core.client.admin.PluginConfig; import org.apache.accumulo.core.client.admin.TimeType; import org.apache.accumulo.core.client.security.SecurityErrorCode; import org.apache.accumulo.core.client.security.tokens.AuthenticationToken; @@ -89,7 +90,6 @@ import org.apache.accumulo.proxy.thrift.AccumuloProxy; import org.apache.accumulo.proxy.thrift.BatchScanOptions; import org.apache.accumulo.proxy.thrift.ColumnUpdate; import org.apache.accumulo.proxy.thrift.CompactionReason; -import org.apache.accumulo.proxy.thrift.CompactionStrategyConfig; import org.apache.accumulo.proxy.thrift.CompactionType; import org.apache.accumulo.proxy.thrift.Condition; import org.apache.accumulo.proxy.thrift.ConditionalStatus; @@ -396,7 +396,8 @@ public class ProxyServer implements AccumuloProxy.Iface { @Override public void compactTable(ByteBuffer login, String tableName, ByteBuffer startRow, ByteBuffer endRow, List<org.apache.accumulo.proxy.thrift.IteratorSetting> iterators, - boolean flush, boolean wait, CompactionStrategyConfig compactionStrategy) + boolean flush, boolean wait, org.apache.accumulo.proxy.thrift.PluginConfig selectorConfig, + org.apache.accumulo.proxy.thrift.PluginConfig configurerConfig) throws org.apache.accumulo.proxy.thrift.AccumuloSecurityException, org.apache.accumulo.proxy.thrift.TableNotFoundException, org.apache.accumulo.proxy.thrift.AccumuloException, TException { @@ -405,14 +406,26 @@ public class ProxyServer implements AccumuloProxy.Iface { .setStartRow(ByteBufferUtil.toText(startRow)).setEndRow(ByteBufferUtil.toText(endRow)) .setIterators(getIteratorSettings(iterators)).setFlush(flush).setWait(wait); - if (compactionStrategy != null) { - org.apache.accumulo.core.client.admin.CompactionStrategyConfig ccc = - new org.apache.accumulo.core.client.admin.CompactionStrategyConfig( - compactionStrategy.getClassName()); - if (compactionStrategy.options != null) { - ccc.setOptions(compactionStrategy.options); - } - compactionConfig.setCompactionStrategy(ccc); + if (selectorConfig != null) { + Map<String,String> options = + selectorConfig.options == null ? Map.of() : selectorConfig.options; + + org.apache.accumulo.core.client.admin.PluginConfig spc = + new org.apache.accumulo.core.client.admin.PluginConfig(selectorConfig.getClassName(), + options); + + compactionConfig.setSelector(spc); + } + + if (configurerConfig != null) { + Map<String,String> options = + configurerConfig.options == null ? Map.of() : configurerConfig.options; + + org.apache.accumulo.core.client.admin.PluginConfig cpc = + new org.apache.accumulo.core.client.admin.PluginConfig(configurerConfig.getClassName(), + options); + + compactionConfig.setConfigurer(cpc); } getConnector(login).tableOperations().compact(tableName, compactionConfig); diff --git a/src/main/python/accumulo/AccumuloProxy-remote b/src/main/python/accumulo/AccumuloProxy-remote index 2aa979b..096b058 100644 --- a/src/main/python/accumulo/AccumuloProxy-remote +++ b/src/main/python/accumulo/AccumuloProxy-remote @@ -47,7 +47,7 @@ if len(sys.argv) <= 1 or sys.argv[1] == '--help': print(' void checkIteratorConflicts(string login, string tableName, IteratorSetting setting, scopes)') print(' void clearLocatorCache(string login, string tableName)') print(' void cloneTable(string login, string tableName, string newTableName, bool flush, propertiesToSet, propertiesToExclude)') - print(' void compactTable(string login, string tableName, string startRow, string endRow, iterators, bool flush, bool wait, CompactionStrategyConfig compactionStrategy)') + print(' void compactTable(string login, string tableName, string startRow, string endRow, iterators, bool flush, bool wait, PluginConfig selectorConfig, PluginConfig configurerConfig)') print(' void cancelCompaction(string login, string tableName)') print(' void createTable(string login, string tableName, bool versioningIter, TimeType type)') print(' void deleteTable(string login, string tableName)') @@ -262,10 +262,10 @@ elif cmd == 'cloneTable': pp.pprint(client.cloneTable(args[0], args[1], args[2], eval(args[3]), eval(args[4]), eval(args[5]),)) elif cmd == 'compactTable': - if len(args) != 8: - print('compactTable requires 8 args') + if len(args) != 9: + print('compactTable requires 9 args') sys.exit(1) - pp.pprint(client.compactTable(args[0], args[1], args[2], args[3], eval(args[4]), eval(args[5]), eval(args[6]), eval(args[7]),)) + pp.pprint(client.compactTable(args[0], args[1], args[2], args[3], eval(args[4]), eval(args[5]), eval(args[6]), eval(args[7]), eval(args[8]),)) elif cmd == 'cancelCompaction': if len(args) != 2: diff --git a/src/main/python/accumulo/AccumuloProxy.py b/src/main/python/accumulo/AccumuloProxy.py index bbf1680..3961993 100644 --- a/src/main/python/accumulo/AccumuloProxy.py +++ b/src/main/python/accumulo/AccumuloProxy.py @@ -108,7 +108,7 @@ class Iface(object): """ pass - def compactTable(self, login, tableName, startRow, endRow, iterators, flush, wait, compactionStrategy): + def compactTable(self, login, tableName, startRow, endRow, iterators, flush, wait, selectorConfig, configurerConfig): """ Parameters: - login @@ -118,7 +118,8 @@ class Iface(object): - iterators - flush - wait - - compactionStrategy + - selectorConfig + - configurerConfig """ pass @@ -1296,7 +1297,7 @@ class Client(Iface): raise result.ouch4 return - def compactTable(self, login, tableName, startRow, endRow, iterators, flush, wait, compactionStrategy): + def compactTable(self, login, tableName, startRow, endRow, iterators, flush, wait, selectorConfig, configurerConfig): """ Parameters: - login @@ -1306,13 +1307,14 @@ class Client(Iface): - iterators - flush - wait - - compactionStrategy + - selectorConfig + - configurerConfig """ - self.send_compactTable(login, tableName, startRow, endRow, iterators, flush, wait, compactionStrategy) + self.send_compactTable(login, tableName, startRow, endRow, iterators, flush, wait, selectorConfig, configurerConfig) self.recv_compactTable() - def send_compactTable(self, login, tableName, startRow, endRow, iterators, flush, wait, compactionStrategy): + def send_compactTable(self, login, tableName, startRow, endRow, iterators, flush, wait, selectorConfig, configurerConfig): self._oprot.writeMessageBegin('compactTable', TMessageType.CALL, self._seqid) args = compactTable_args() args.login = login @@ -1322,7 +1324,8 @@ class Client(Iface): args.iterators = iterators args.flush = flush args.wait = wait - args.compactionStrategy = compactionStrategy + args.selectorConfig = selectorConfig + args.configurerConfig = configurerConfig args.write(self._oprot) self._oprot.writeMessageEnd() self._oprot.trans.flush() @@ -5274,7 +5277,7 @@ class Processor(Iface, TProcessor): iprot.readMessageEnd() result = compactTable_result() try: - self._handler.compactTable(args.login, args.tableName, args.startRow, args.endRow, args.iterators, args.flush, args.wait, args.compactionStrategy) + self._handler.compactTable(args.login, args.tableName, args.startRow, args.endRow, args.iterators, args.flush, args.wait, args.selectorConfig, args.configurerConfig) msg_type = TMessageType.REPLY except TTransport.TTransportException: raise @@ -9360,12 +9363,13 @@ class compactTable_args(object): - iterators - flush - wait - - compactionStrategy + - selectorConfig + - configurerConfig """ - def __init__(self, login=None, tableName=None, startRow=None, endRow=None, iterators=None, flush=None, wait=None, compactionStrategy=None,): + def __init__(self, login=None, tableName=None, startRow=None, endRow=None, iterators=None, flush=None, wait=None, selectorConfig=None, configurerConfig=None,): self.login = login self.tableName = tableName self.startRow = startRow @@ -9373,7 +9377,8 @@ class compactTable_args(object): self.iterators = iterators self.flush = flush self.wait = wait - self.compactionStrategy = compactionStrategy + self.selectorConfig = selectorConfig + self.configurerConfig = configurerConfig def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: @@ -9427,8 +9432,14 @@ class compactTable_args(object): iprot.skip(ftype) elif fid == 8: if ftype == TType.STRUCT: - self.compactionStrategy = CompactionStrategyConfig() - self.compactionStrategy.read(iprot) + self.selectorConfig = PluginConfig() + self.selectorConfig.read(iprot) + else: + iprot.skip(ftype) + elif fid == 9: + if ftype == TType.STRUCT: + self.configurerConfig = PluginConfig() + self.configurerConfig.read(iprot) else: iprot.skip(ftype) else: @@ -9472,9 +9483,13 @@ class compactTable_args(object): oprot.writeFieldBegin('wait', TType.BOOL, 7) oprot.writeBool(self.wait) oprot.writeFieldEnd() - if self.compactionStrategy is not None: - oprot.writeFieldBegin('compactionStrategy', TType.STRUCT, 8) - self.compactionStrategy.write(oprot) + if self.selectorConfig is not None: + oprot.writeFieldBegin('selectorConfig', TType.STRUCT, 8) + self.selectorConfig.write(oprot) + oprot.writeFieldEnd() + if self.configurerConfig is not None: + oprot.writeFieldBegin('configurerConfig', TType.STRUCT, 9) + self.configurerConfig.write(oprot) oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() @@ -9502,7 +9517,8 @@ compactTable_args.thrift_spec = ( (5, TType.LIST, 'iterators', (TType.STRUCT, [IteratorSetting, None], False), None, ), # 5 (6, TType.BOOL, 'flush', None, None, ), # 6 (7, TType.BOOL, 'wait', None, None, ), # 7 - (8, TType.STRUCT, 'compactionStrategy', [CompactionStrategyConfig, None], None, ), # 8 + (8, TType.STRUCT, 'selectorConfig', [PluginConfig, None], None, ), # 8 + (9, TType.STRUCT, 'configurerConfig', [PluginConfig, None], None, ), # 9 ) diff --git a/src/main/python/accumulo/ttypes.py b/src/main/python/accumulo/ttypes.py index 486318f..df49b4e 100644 --- a/src/main/python/accumulo/ttypes.py +++ b/src/main/python/accumulo/ttypes.py @@ -2276,7 +2276,7 @@ class WriterOptions(object): return not (self == other) -class CompactionStrategyConfig(object): +class PluginConfig(object): """ Attributes: - className @@ -2323,7 +2323,7 @@ class CompactionStrategyConfig(object): if oprot._fast_encode is not None and self.thrift_spec is not None: oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return - oprot.writeStructBegin('CompactionStrategyConfig') + oprot.writeStructBegin('PluginConfig') if self.className is not None: oprot.writeFieldBegin('className', TType.STRING, 1) oprot.writeString(self.className.encode('utf-8') if sys.version_info[0] == 2 else self.className) @@ -3314,8 +3314,8 @@ WriterOptions.thrift_spec = ( (4, TType.I32, 'threads', None, None, ), # 4 (5, TType.I32, 'durability', None, None, ), # 5 ) -all_structs.append(CompactionStrategyConfig) -CompactionStrategyConfig.thrift_spec = ( +all_structs.append(PluginConfig) +PluginConfig.thrift_spec = ( None, # 0 (1, TType.STRING, 'className', 'UTF8', None, ), # 1 (2, TType.MAP, 'options', (TType.STRING, 'UTF8', TType.STRING, 'UTF8', False), None, ), # 2 diff --git a/src/main/ruby/accumulo/lib/accumulo_proxy.rb b/src/main/ruby/accumulo/lib/accumulo_proxy.rb index a09c77e..43731f7 100644 --- a/src/main/ruby/accumulo/lib/accumulo_proxy.rb +++ b/src/main/ruby/accumulo/lib/accumulo_proxy.rb @@ -146,13 +146,13 @@ module Accumulo return end - def compactTable(login, tableName, startRow, endRow, iterators, flush, wait, compactionStrategy) - send_compactTable(login, tableName, startRow, endRow, iterators, flush, wait, compactionStrategy) + def compactTable(login, tableName, startRow, endRow, iterators, flush, wait, selectorConfig, configurerConfig) + send_compactTable(login, tableName, startRow, endRow, iterators, flush, wait, selectorConfig, configurerConfig) recv_compactTable() end - def send_compactTable(login, tableName, startRow, endRow, iterators, flush, wait, compactionStrategy) - send_message('compactTable', CompactTable_args, :login => login, :tableName => tableName, :startRow => startRow, :endRow => endRow, :iterators => iterators, :flush => flush, :wait => wait, :compactionStrategy => compactionStrategy) + def send_compactTable(login, tableName, startRow, endRow, iterators, flush, wait, selectorConfig, configurerConfig) + send_message('compactTable', CompactTable_args, :login => login, :tableName => tableName, :startRow => startRow, :endRow => endRow, :iterators => iterators, :flush => flush, :wait => wait, :selectorConfig => selectorConfig, :configurerConfig => configurerConfig) end def recv_compactTable() @@ -1820,7 +1820,7 @@ module Accumulo args = read_args(iprot, CompactTable_args) result = CompactTable_result.new() begin - @handler.compactTable(args.login, args.tableName, args.startRow, args.endRow, args.iterators, args.flush, args.wait, args.compactionStrategy) + @handler.compactTable(args.login, args.tableName, args.startRow, args.endRow, args.iterators, args.flush, args.wait, args.selectorConfig, args.configurerConfig) rescue ::Accumulo::AccumuloSecurityException => ouch1 result.ouch1 = ouch1 rescue ::Accumulo::TableNotFoundException => ouch2 @@ -3377,7 +3377,8 @@ module Accumulo ITERATORS = 5 FLUSH = 6 WAIT = 7 - COMPACTIONSTRATEGY = 8 + SELECTORCONFIG = 8 + CONFIGURERCONFIG = 9 FIELDS = { LOGIN => {:type => ::Thrift::Types::STRING, :name => 'login', :binary => true}, @@ -3387,7 +3388,8 @@ module Accumulo ITERATORS => {:type => ::Thrift::Types::LIST, :name => 'iterators', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Accumulo::IteratorSetting}}, FLUSH => {:type => ::Thrift::Types::BOOL, :name => 'flush'}, WAIT => {:type => ::Thrift::Types::BOOL, :name => 'wait'}, - COMPACTIONSTRATEGY => {:type => ::Thrift::Types::STRUCT, :name => 'compactionStrategy', :class => ::Accumulo::CompactionStrategyConfig} + SELECTORCONFIG => {:type => ::Thrift::Types::STRUCT, :name => 'selectorConfig', :class => ::Accumulo::PluginConfig}, + CONFIGURERCONFIG => {:type => ::Thrift::Types::STRUCT, :name => 'configurerConfig', :class => ::Accumulo::PluginConfig} } def struct_fields; FIELDS; end diff --git a/src/main/ruby/accumulo/lib/proxy_types.rb b/src/main/ruby/accumulo/lib/proxy_types.rb index 22f9b46..018b457 100644 --- a/src/main/ruby/accumulo/lib/proxy_types.rb +++ b/src/main/ruby/accumulo/lib/proxy_types.rb @@ -183,7 +183,7 @@ module Accumulo class WriterOptions; end - class CompactionStrategyConfig; end + class PluginConfig; end class UnknownScanner < ::Thrift::Exception; end @@ -655,7 +655,7 @@ module Accumulo ::Thrift::Struct.generate_accessors self end - class CompactionStrategyConfig + class PluginConfig include ::Thrift::Struct, ::Thrift::Struct_Union CLASSNAME = 1 OPTIONS = 2 diff --git a/src/main/thrift-gen-java/org/apache/accumulo/proxy/thrift/AccumuloProxy.java b/src/main/thrift-gen-java/org/apache/accumulo/proxy/thrift/AccumuloProxy.java index 3caf1c8..601f126 100644 --- a/src/main/thrift-gen-java/org/apache/accumulo/proxy/thrift/AccumuloProxy.java +++ b/src/main/thrift-gen-java/org/apache/accumulo/proxy/thrift/AccumuloProxy.java @@ -43,7 +43,7 @@ public class AccumuloProxy { public void cloneTable(java.nio.ByteBuffer login, java.lang.String tableName, java.lang.String newTableName, boolean flush, java.util.Map<java.lang.String,java.lang.String> propertiesToSet, java.util.Set<java.lang.String> propertiesToExclude) throws AccumuloException, AccumuloSecurityException, TableNotFoundException, TableExistsException, org.apache.thrift.TException; - public void compactTable(java.nio.ByteBuffer login, java.lang.String tableName, java.nio.ByteBuffer startRow, java.nio.ByteBuffer endRow, java.util.List<IteratorSetting> iterators, boolean flush, boolean wait, CompactionStrategyConfig compactionStrategy) throws AccumuloSecurityException, TableNotFoundException, AccumuloException, org.apache.thrift.TException; + public void compactTable(java.nio.ByteBuffer login, java.lang.String tableName, java.nio.ByteBuffer startRow, java.nio.ByteBuffer endRow, java.util.List<IteratorSetting> iterators, boolean flush, boolean wait, PluginConfig selectorConfig, PluginConfig configurerConfig) throws AccumuloSecurityException, TableNotFoundException, AccumuloException, org.apache.thrift.TException; public void cancelCompaction(java.nio.ByteBuffer login, java.lang.String tableName) throws AccumuloSecurityException, TableNotFoundException, AccumuloException, org.apache.thrift.TException; @@ -247,7 +247,7 @@ public class AccumuloProxy { public void cloneTable(java.nio.ByteBuffer login, java.lang.String tableName, java.lang.String newTableName, boolean flush, java.util.Map<java.lang.String,java.lang.String> propertiesToSet, java.util.Set<java.lang.String> propertiesToExclude, org.apache.thrift.async.AsyncMethodCallback<Void> resultHandler) throws org.apache.thrift.TException; - public void compactTable(java.nio.ByteBuffer login, java.lang.String tableName, java.nio.ByteBuffer startRow, java.nio.ByteBuffer endRow, java.util.List<IteratorSetting> iterators, boolean flush, boolean wait, CompactionStrategyConfig compactionStrategy, org.apache.thrift.async.AsyncMethodCallback<Void> resultHandler) throws org.apache.thrift.TException; + public void compactTable(java.nio.ByteBuffer login, java.lang.String tableName, java.nio.ByteBuffer startRow, java.nio.ByteBuffer endRow, java.util.List<IteratorSetting> iterators, boolean flush, boolean wait, PluginConfig selectorConfig, PluginConfig configurerConfig, org.apache.thrift.async.AsyncMethodCallback<Void> resultHandler) throws org.apache.thrift.TException; public void cancelCompaction(java.nio.ByteBuffer login, java.lang.String tableName, org.apache.thrift.async.AsyncMethodCallback<Void> resultHandler) throws org.apache.thrift.TException; @@ -682,13 +682,13 @@ public class AccumuloProxy { } @Override - public void compactTable(java.nio.ByteBuffer login, java.lang.String tableName, java.nio.ByteBuffer startRow, java.nio.ByteBuffer endRow, java.util.List<IteratorSetting> iterators, boolean flush, boolean wait, CompactionStrategyConfig compactionStrategy) throws AccumuloSecurityException, TableNotFoundException, AccumuloException, org.apache.thrift.TException + public void compactTable(java.nio.ByteBuffer login, java.lang.String tableName, java.nio.ByteBuffer startRow, java.nio.ByteBuffer endRow, java.util.List<IteratorSetting> iterators, boolean flush, boolean wait, PluginConfig selectorConfig, PluginConfig configurerConfig) throws AccumuloSecurityException, TableNotFoundException, AccumuloException, org.apache.thrift.TException { - send_compactTable(login, tableName, startRow, endRow, iterators, flush, wait, compactionStrategy); + send_compactTable(login, tableName, startRow, endRow, iterators, flush, wait, selectorConfig, configurerConfig); recv_compactTable(); } - public void send_compactTable(java.nio.ByteBuffer login, java.lang.String tableName, java.nio.ByteBuffer startRow, java.nio.ByteBuffer endRow, java.util.List<IteratorSetting> iterators, boolean flush, boolean wait, CompactionStrategyConfig compactionStrategy) throws org.apache.thrift.TException + public void send_compactTable(java.nio.ByteBuffer login, java.lang.String tableName, java.nio.ByteBuffer startRow, java.nio.ByteBuffer endRow, java.util.List<IteratorSetting> iterators, boolean flush, boolean wait, PluginConfig selectorConfig, PluginConfig configurerConfig) throws org.apache.thrift.TException { compactTable_args args = new compactTable_args(); args.setLogin(login); @@ -698,7 +698,8 @@ public class AccumuloProxy { args.setIterators(iterators); args.setFlush(flush); args.setWait(wait); - args.setCompactionStrategy(compactionStrategy); + args.setSelectorConfig(selectorConfig); + args.setConfigurerConfig(configurerConfig); sendBase("compactTable", args); } @@ -3920,9 +3921,9 @@ public class AccumuloProxy { } @Override - public void compactTable(java.nio.ByteBuffer login, java.lang.String tableName, java.nio.ByteBuffer startRow, java.nio.ByteBuffer endRow, java.util.List<IteratorSetting> iterators, boolean flush, boolean wait, CompactionStrategyConfig compactionStrategy, org.apache.thrift.async.AsyncMethodCallback<Void> resultHandler) throws org.apache.thrift.TException { + public void compactTable(java.nio.ByteBuffer login, java.lang.String tableName, java.nio.ByteBuffer startRow, java.nio.ByteBuffer endRow, java.util.List<IteratorSetting> iterators, boolean flush, boolean wait, PluginConfig selectorConfig, PluginConfig configurerConfig, org.apache.thrift.async.AsyncMethodCallback<Void> resultHandler) throws org.apache.thrift.TException { checkReady(); - compactTable_call method_call = new compactTable_call(login, tableName, startRow, endRow, iterators, flush, wait, compactionStrategy, resultHandler, this, ___protocolFactory, ___transport); + compactTable_call method_call = new compactTable_call(login, tableName, startRow, endRow, iterators, flush, wait, selectorConfig, configurerConfig, resultHandler, this, ___protocolFactory, ___transport); this.___currentMethod = method_call; ___manager.call(method_call); } @@ -3935,8 +3936,9 @@ public class AccumuloProxy { private java.util.List<IteratorSetting> iterators; private boolean flush; private boolean wait; - private CompactionStrategyConfig compactionStrategy; - public compactTable_call(java.nio.ByteBuffer login, java.lang.String tableName, java.nio.ByteBuffer startRow, java.nio.ByteBuffer endRow, java.util.List<IteratorSetting> iterators, boolean flush, boolean wait, CompactionStrategyConfig compactionStrategy, org.apache.thrift.async.AsyncMethodCallback<Void> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) [...] + private PluginConfig selectorConfig; + private PluginConfig configurerConfig; + public compactTable_call(java.nio.ByteBuffer login, java.lang.String tableName, java.nio.ByteBuffer startRow, java.nio.ByteBuffer endRow, java.util.List<IteratorSetting> iterators, boolean flush, boolean wait, PluginConfig selectorConfig, PluginConfig configurerConfig, org.apache.thrift.async.AsyncMethodCallback<Void> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTrans [...] super(client, protocolFactory, transport, resultHandler, false); this.login = login; this.tableName = tableName; @@ -3945,7 +3947,8 @@ public class AccumuloProxy { this.iterators = iterators; this.flush = flush; this.wait = wait; - this.compactionStrategy = compactionStrategy; + this.selectorConfig = selectorConfig; + this.configurerConfig = configurerConfig; } @Override @@ -3959,7 +3962,8 @@ public class AccumuloProxy { args.setIterators(iterators); args.setFlush(flush); args.setWait(wait); - args.setCompactionStrategy(compactionStrategy); + args.setSelectorConfig(selectorConfig); + args.setConfigurerConfig(configurerConfig); args.write(prot); prot.writeMessageEnd(); } @@ -8086,7 +8090,7 @@ public class AccumuloProxy { public compactTable_result getResult(I iface, compactTable_args args) throws org.apache.thrift.TException { compactTable_result result = new compactTable_result(); try { - iface.compactTable(args.login, args.tableName, args.startRow, args.endRow, args.iterators, args.flush, args.wait, args.compactionStrategy); + iface.compactTable(args.login, args.tableName, args.startRow, args.endRow, args.iterators, args.flush, args.wait, args.selectorConfig, args.configurerConfig); } catch (AccumuloSecurityException ouch1) { result.ouch1 = ouch1; } catch (TableNotFoundException ouch2) { @@ -12017,7 +12021,7 @@ public class AccumuloProxy { @Override public void start(I iface, compactTable_args args, org.apache.thrift.async.AsyncMethodCallback<Void> resultHandler) throws org.apache.thrift.TException { - iface.compactTable(args.login, args.tableName, args.startRow, args.endRow, args.iterators, args.flush, args.wait, args.compactionStrategy,resultHandler); + iface.compactTable(args.login, args.tableName, args.startRow, args.endRow, args.iterators, args.flush, args.wait, args.selectorConfig, args.configurerConfig,resultHandler); } } @@ -27922,7 +27926,8 @@ public class AccumuloProxy { private static final org.apache.thrift.protocol.TField ITERATORS_FIELD_DESC = new org.apache.thrift.protocol.TField("iterators", org.apache.thrift.protocol.TType.LIST, (short)5); private static final org.apache.thrift.protocol.TField FLUSH_FIELD_DESC = new org.apache.thrift.protocol.TField("flush", org.apache.thrift.protocol.TType.BOOL, (short)6); private static final org.apache.thrift.protocol.TField WAIT_FIELD_DESC = new org.apache.thrift.protocol.TField("wait", org.apache.thrift.protocol.TType.BOOL, (short)7); - private static final org.apache.thrift.protocol.TField COMPACTION_STRATEGY_FIELD_DESC = new org.apache.thrift.protocol.TField("compactionStrategy", org.apache.thrift.protocol.TType.STRUCT, (short)8); + private static final org.apache.thrift.protocol.TField SELECTOR_CONFIG_FIELD_DESC = new org.apache.thrift.protocol.TField("selectorConfig", org.apache.thrift.protocol.TType.STRUCT, (short)8); + private static final org.apache.thrift.protocol.TField CONFIGURER_CONFIG_FIELD_DESC = new org.apache.thrift.protocol.TField("configurerConfig", org.apache.thrift.protocol.TType.STRUCT, (short)9); private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new compactTable_argsStandardSchemeFactory(); private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new compactTable_argsTupleSchemeFactory(); @@ -27934,7 +27939,8 @@ public class AccumuloProxy { public @org.apache.thrift.annotation.Nullable java.util.List<IteratorSetting> iterators; // required public boolean flush; // required public boolean wait; // required - public @org.apache.thrift.annotation.Nullable CompactionStrategyConfig compactionStrategy; // required + public @org.apache.thrift.annotation.Nullable PluginConfig selectorConfig; // required + public @org.apache.thrift.annotation.Nullable PluginConfig configurerConfig; // required /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { @@ -27945,7 +27951,8 @@ public class AccumuloProxy { ITERATORS((short)5, "iterators"), FLUSH((short)6, "flush"), WAIT((short)7, "wait"), - COMPACTION_STRATEGY((short)8, "compactionStrategy"); + SELECTOR_CONFIG((short)8, "selectorConfig"), + CONFIGURER_CONFIG((short)9, "configurerConfig"); private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>(); @@ -27975,8 +27982,10 @@ public class AccumuloProxy { return FLUSH; case 7: // WAIT return WAIT; - case 8: // COMPACTION_STRATEGY - return COMPACTION_STRATEGY; + case 8: // SELECTOR_CONFIG + return SELECTOR_CONFIG; + case 9: // CONFIGURER_CONFIG + return CONFIGURER_CONFIG; default: return null; } @@ -28041,8 +28050,10 @@ public class AccumuloProxy { new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL))); tmpMap.put(_Fields.WAIT, new org.apache.thrift.meta_data.FieldMetaData("wait", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL))); - tmpMap.put(_Fields.COMPACTION_STRATEGY, new org.apache.thrift.meta_data.FieldMetaData("compactionStrategy", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, CompactionStrategyConfig.class))); + tmpMap.put(_Fields.SELECTOR_CONFIG, new org.apache.thrift.meta_data.FieldMetaData("selectorConfig", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, PluginConfig.class))); + tmpMap.put(_Fields.CONFIGURER_CONFIG, new org.apache.thrift.meta_data.FieldMetaData("configurerConfig", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, PluginConfig.class))); metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(compactTable_args.class, metaDataMap); } @@ -28058,7 +28069,8 @@ public class AccumuloProxy { java.util.List<IteratorSetting> iterators, boolean flush, boolean wait, - CompactionStrategyConfig compactionStrategy) + PluginConfig selectorConfig, + PluginConfig configurerConfig) { this(); this.login = org.apache.thrift.TBaseHelper.copyBinary(login); @@ -28070,7 +28082,8 @@ public class AccumuloProxy { setFlushIsSet(true); this.wait = wait; setWaitIsSet(true); - this.compactionStrategy = compactionStrategy; + this.selectorConfig = selectorConfig; + this.configurerConfig = configurerConfig; } /** @@ -28099,8 +28112,11 @@ public class AccumuloProxy { } this.flush = other.flush; this.wait = other.wait; - if (other.isSetCompactionStrategy()) { - this.compactionStrategy = new CompactionStrategyConfig(other.compactionStrategy); + if (other.isSetSelectorConfig()) { + this.selectorConfig = new PluginConfig(other.selectorConfig); + } + if (other.isSetConfigurerConfig()) { + this.configurerConfig = new PluginConfig(other.configurerConfig); } } @@ -28120,7 +28136,8 @@ public class AccumuloProxy { this.flush = false; setWaitIsSet(false); this.wait = false; - this.compactionStrategy = null; + this.selectorConfig = null; + this.configurerConfig = null; } public byte[] getLogin() { @@ -28338,27 +28355,52 @@ public class AccumuloProxy { } @org.apache.thrift.annotation.Nullable - public CompactionStrategyConfig getCompactionStrategy() { - return this.compactionStrategy; + public PluginConfig getSelectorConfig() { + return this.selectorConfig; + } + + public compactTable_args setSelectorConfig(@org.apache.thrift.annotation.Nullable PluginConfig selectorConfig) { + this.selectorConfig = selectorConfig; + return this; + } + + public void unsetSelectorConfig() { + this.selectorConfig = null; + } + + /** Returns true if field selectorConfig is set (has been assigned a value) and false otherwise */ + public boolean isSetSelectorConfig() { + return this.selectorConfig != null; + } + + public void setSelectorConfigIsSet(boolean value) { + if (!value) { + this.selectorConfig = null; + } + } + + @org.apache.thrift.annotation.Nullable + public PluginConfig getConfigurerConfig() { + return this.configurerConfig; } - public compactTable_args setCompactionStrategy(@org.apache.thrift.annotation.Nullable CompactionStrategyConfig compactionStrategy) { - this.compactionStrategy = compactionStrategy; + public compactTable_args setConfigurerConfig(@org.apache.thrift.annotation.Nullable PluginConfig configurerConfig) { + this.configurerConfig = configurerConfig; return this; } - public void unsetCompactionStrategy() { - this.compactionStrategy = null; + public void unsetConfigurerConfig() { + this.configurerConfig = null; } - /** Returns true if field compactionStrategy is set (has been assigned a value) and false otherwise */ - public boolean isSetCompactionStrategy() { - return this.compactionStrategy != null; + /** Returns true if field configurerConfig is set (has been assigned a value) and false otherwise */ + public boolean isSetConfigurerConfig() { + return this.configurerConfig != null; } - public void setCompactionStrategyIsSet(boolean value) { + public void setConfigurerConfigIsSet(boolean value) { if (!value) { - this.compactionStrategy = null; + this.configurerConfig = null; } } @@ -28433,11 +28475,19 @@ public class AccumuloProxy { } break; - case COMPACTION_STRATEGY: + case SELECTOR_CONFIG: + if (value == null) { + unsetSelectorConfig(); + } else { + setSelectorConfig((PluginConfig)value); + } + break; + + case CONFIGURER_CONFIG: if (value == null) { - unsetCompactionStrategy(); + unsetConfigurerConfig(); } else { - setCompactionStrategy((CompactionStrategyConfig)value); + setConfigurerConfig((PluginConfig)value); } break; @@ -28469,8 +28519,11 @@ public class AccumuloProxy { case WAIT: return isWait(); - case COMPACTION_STRATEGY: - return getCompactionStrategy(); + case SELECTOR_CONFIG: + return getSelectorConfig(); + + case CONFIGURER_CONFIG: + return getConfigurerConfig(); } throw new java.lang.IllegalStateException(); @@ -28498,8 +28551,10 @@ public class AccumuloProxy { return isSetFlush(); case WAIT: return isSetWait(); - case COMPACTION_STRATEGY: - return isSetCompactionStrategy(); + case SELECTOR_CONFIG: + return isSetSelectorConfig(); + case CONFIGURER_CONFIG: + return isSetConfigurerConfig(); } throw new java.lang.IllegalStateException(); } @@ -28580,12 +28635,21 @@ public class AccumuloProxy { return false; } - boolean this_present_compactionStrategy = true && this.isSetCompactionStrategy(); - boolean that_present_compactionStrategy = true && that.isSetCompactionStrategy(); - if (this_present_compactionStrategy || that_present_compactionStrategy) { - if (!(this_present_compactionStrategy && that_present_compactionStrategy)) + boolean this_present_selectorConfig = true && this.isSetSelectorConfig(); + boolean that_present_selectorConfig = true && that.isSetSelectorConfig(); + if (this_present_selectorConfig || that_present_selectorConfig) { + if (!(this_present_selectorConfig && that_present_selectorConfig)) + return false; + if (!this.selectorConfig.equals(that.selectorConfig)) + return false; + } + + boolean this_present_configurerConfig = true && this.isSetConfigurerConfig(); + boolean that_present_configurerConfig = true && that.isSetConfigurerConfig(); + if (this_present_configurerConfig || that_present_configurerConfig) { + if (!(this_present_configurerConfig && that_present_configurerConfig)) return false; - if (!this.compactionStrategy.equals(that.compactionStrategy)) + if (!this.configurerConfig.equals(that.configurerConfig)) return false; } @@ -28620,9 +28684,13 @@ public class AccumuloProxy { hashCode = hashCode * 8191 + ((wait) ? 131071 : 524287); - hashCode = hashCode * 8191 + ((isSetCompactionStrategy()) ? 131071 : 524287); - if (isSetCompactionStrategy()) - hashCode = hashCode * 8191 + compactionStrategy.hashCode(); + hashCode = hashCode * 8191 + ((isSetSelectorConfig()) ? 131071 : 524287); + if (isSetSelectorConfig()) + hashCode = hashCode * 8191 + selectorConfig.hashCode(); + + hashCode = hashCode * 8191 + ((isSetConfigurerConfig()) ? 131071 : 524287); + if (isSetConfigurerConfig()) + hashCode = hashCode * 8191 + configurerConfig.hashCode(); return hashCode; } @@ -28705,12 +28773,22 @@ public class AccumuloProxy { return lastComparison; } } - lastComparison = java.lang.Boolean.compare(isSetCompactionStrategy(), other.isSetCompactionStrategy()); + lastComparison = java.lang.Boolean.compare(isSetSelectorConfig(), other.isSetSelectorConfig()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSelectorConfig()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.selectorConfig, other.selectorConfig); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetConfigurerConfig(), other.isSetConfigurerConfig()); if (lastComparison != 0) { return lastComparison; } - if (isSetCompactionStrategy()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.compactionStrategy, other.compactionStrategy); + if (isSetConfigurerConfig()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.configurerConfig, other.configurerConfig); if (lastComparison != 0) { return lastComparison; } @@ -28787,11 +28865,19 @@ public class AccumuloProxy { sb.append(this.wait); first = false; if (!first) sb.append(", "); - sb.append("compactionStrategy:"); - if (this.compactionStrategy == null) { + sb.append("selectorConfig:"); + if (this.selectorConfig == null) { + sb.append("null"); + } else { + sb.append(this.selectorConfig); + } + first = false; + if (!first) sb.append(", "); + sb.append("configurerConfig:"); + if (this.configurerConfig == null) { sb.append("null"); } else { - sb.append(this.compactionStrategy); + sb.append(this.configurerConfig); } first = false; sb.append(")"); @@ -28801,8 +28887,11 @@ public class AccumuloProxy { public void validate() throws org.apache.thrift.TException { // check for required fields // check for sub-struct validity - if (compactionStrategy != null) { - compactionStrategy.validate(); + if (selectorConfig != null) { + selectorConfig.validate(); + } + if (configurerConfig != null) { + configurerConfig.validate(); } } @@ -28911,11 +29000,20 @@ public class AccumuloProxy { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; - case 8: // COMPACTION_STRATEGY + case 8: // SELECTOR_CONFIG + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.selectorConfig = new PluginConfig(); + struct.selectorConfig.read(iprot); + struct.setSelectorConfigIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 9: // CONFIGURER_CONFIG if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { - struct.compactionStrategy = new CompactionStrategyConfig(); - struct.compactionStrategy.read(iprot); - struct.setCompactionStrategyIsSet(true); + struct.configurerConfig = new PluginConfig(); + struct.configurerConfig.read(iprot); + struct.setConfigurerConfigIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } @@ -28974,9 +29072,14 @@ public class AccumuloProxy { oprot.writeFieldBegin(WAIT_FIELD_DESC); oprot.writeBool(struct.wait); oprot.writeFieldEnd(); - if (struct.compactionStrategy != null) { - oprot.writeFieldBegin(COMPACTION_STRATEGY_FIELD_DESC); - struct.compactionStrategy.write(oprot); + if (struct.selectorConfig != null) { + oprot.writeFieldBegin(SELECTOR_CONFIG_FIELD_DESC); + struct.selectorConfig.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.configurerConfig != null) { + oprot.writeFieldBegin(CONFIGURER_CONFIG_FIELD_DESC); + struct.configurerConfig.write(oprot); oprot.writeFieldEnd(); } oprot.writeFieldStop(); @@ -29019,10 +29122,13 @@ public class AccumuloProxy { if (struct.isSetWait()) { optionals.set(6); } - if (struct.isSetCompactionStrategy()) { + if (struct.isSetSelectorConfig()) { optionals.set(7); } - oprot.writeBitSet(optionals, 8); + if (struct.isSetConfigurerConfig()) { + optionals.set(8); + } + oprot.writeBitSet(optionals, 9); if (struct.isSetLogin()) { oprot.writeBinary(struct.login); } @@ -29050,15 +29156,18 @@ public class AccumuloProxy { if (struct.isSetWait()) { oprot.writeBool(struct.wait); } - if (struct.isSetCompactionStrategy()) { - struct.compactionStrategy.write(oprot); + if (struct.isSetSelectorConfig()) { + struct.selectorConfig.write(oprot); + } + if (struct.isSetConfigurerConfig()) { + struct.configurerConfig.write(oprot); } } @Override public void read(org.apache.thrift.protocol.TProtocol prot, compactTable_args struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot; - java.util.BitSet incoming = iprot.readBitSet(8); + java.util.BitSet incoming = iprot.readBitSet(9); if (incoming.get(0)) { struct.login = iprot.readBinary(); struct.setLoginIsSet(true); @@ -29098,9 +29207,14 @@ public class AccumuloProxy { struct.setWaitIsSet(true); } if (incoming.get(7)) { - struct.compactionStrategy = new CompactionStrategyConfig(); - struct.compactionStrategy.read(iprot); - struct.setCompactionStrategyIsSet(true); + struct.selectorConfig = new PluginConfig(); + struct.selectorConfig.read(iprot); + struct.setSelectorConfigIsSet(true); + } + if (incoming.get(8)) { + struct.configurerConfig = new PluginConfig(); + struct.configurerConfig.read(iprot); + struct.setConfigurerConfigIsSet(true); } } } diff --git a/src/main/thrift-gen-java/org/apache/accumulo/proxy/thrift/CompactionStrategyConfig.java b/src/main/thrift-gen-java/org/apache/accumulo/proxy/thrift/PluginConfig.java similarity index 88% rename from src/main/thrift-gen-java/org/apache/accumulo/proxy/thrift/CompactionStrategyConfig.java rename to src/main/thrift-gen-java/org/apache/accumulo/proxy/thrift/PluginConfig.java index d90d270..f2dc815 100644 --- a/src/main/thrift-gen-java/org/apache/accumulo/proxy/thrift/CompactionStrategyConfig.java +++ b/src/main/thrift-gen-java/org/apache/accumulo/proxy/thrift/PluginConfig.java @@ -25,14 +25,14 @@ package org.apache.accumulo.proxy.thrift; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) -public class CompactionStrategyConfig implements org.apache.thrift.TBase<CompactionStrategyConfig, CompactionStrategyConfig._Fields>, java.io.Serializable, Cloneable, Comparable<CompactionStrategyConfig> { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("CompactionStrategyConfig"); +public class PluginConfig implements org.apache.thrift.TBase<PluginConfig, PluginConfig._Fields>, java.io.Serializable, Cloneable, Comparable<PluginConfig> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("PluginConfig"); private static final org.apache.thrift.protocol.TField CLASS_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("className", org.apache.thrift.protocol.TType.STRING, (short)1); private static final org.apache.thrift.protocol.TField OPTIONS_FIELD_DESC = new org.apache.thrift.protocol.TField("options", org.apache.thrift.protocol.TType.MAP, (short)2); - private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new CompactionStrategyConfigStandardSchemeFactory(); - private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new CompactionStrategyConfigTupleSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new PluginConfigStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new PluginConfigTupleSchemeFactory(); public @org.apache.thrift.annotation.Nullable java.lang.String className; // required public @org.apache.thrift.annotation.Nullable java.util.Map<java.lang.String,java.lang.String> options; // required @@ -113,13 +113,13 @@ public class CompactionStrategyConfig implements org.apache.thrift.TBase<Compact new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING), new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)))); metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(CompactionStrategyConfig.class, metaDataMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(PluginConfig.class, metaDataMap); } - public CompactionStrategyConfig() { + public PluginConfig() { } - public CompactionStrategyConfig( + public PluginConfig( java.lang.String className, java.util.Map<java.lang.String,java.lang.String> options) { @@ -131,7 +131,7 @@ public class CompactionStrategyConfig implements org.apache.thrift.TBase<Compact /** * Performs a deep copy on <i>other</i>. */ - public CompactionStrategyConfig(CompactionStrategyConfig other) { + public PluginConfig(PluginConfig other) { if (other.isSetClassName()) { this.className = other.className; } @@ -142,8 +142,8 @@ public class CompactionStrategyConfig implements org.apache.thrift.TBase<Compact } @Override - public CompactionStrategyConfig deepCopy() { - return new CompactionStrategyConfig(this); + public PluginConfig deepCopy() { + return new PluginConfig(this); } @Override @@ -157,7 +157,7 @@ public class CompactionStrategyConfig implements org.apache.thrift.TBase<Compact return this.className; } - public CompactionStrategyConfig setClassName(@org.apache.thrift.annotation.Nullable java.lang.String className) { + public PluginConfig setClassName(@org.apache.thrift.annotation.Nullable java.lang.String className) { this.className = className; return this; } @@ -193,7 +193,7 @@ public class CompactionStrategyConfig implements org.apache.thrift.TBase<Compact return this.options; } - public CompactionStrategyConfig setOptions(@org.apache.thrift.annotation.Nullable java.util.Map<java.lang.String,java.lang.String> options) { + public PluginConfig setOptions(@org.apache.thrift.annotation.Nullable java.util.Map<java.lang.String,java.lang.String> options) { this.options = options; return this; } @@ -267,12 +267,12 @@ public class CompactionStrategyConfig implements org.apache.thrift.TBase<Compact @Override public boolean equals(java.lang.Object that) { - if (that instanceof CompactionStrategyConfig) - return this.equals((CompactionStrategyConfig)that); + if (that instanceof PluginConfig) + return this.equals((PluginConfig)that); return false; } - public boolean equals(CompactionStrategyConfig that) { + public boolean equals(PluginConfig that) { if (that == null) return false; if (this == that) @@ -315,7 +315,7 @@ public class CompactionStrategyConfig implements org.apache.thrift.TBase<Compact } @Override - public int compareTo(CompactionStrategyConfig other) { + public int compareTo(PluginConfig other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } @@ -363,7 +363,7 @@ public class CompactionStrategyConfig implements org.apache.thrift.TBase<Compact @Override public java.lang.String toString() { - java.lang.StringBuilder sb = new java.lang.StringBuilder("CompactionStrategyConfig("); + java.lang.StringBuilder sb = new java.lang.StringBuilder("PluginConfig("); boolean first = true; sb.append("className:"); @@ -406,17 +406,17 @@ public class CompactionStrategyConfig implements org.apache.thrift.TBase<Compact } } - private static class CompactionStrategyConfigStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { + private static class PluginConfigStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { @Override - public CompactionStrategyConfigStandardScheme getScheme() { - return new CompactionStrategyConfigStandardScheme(); + public PluginConfigStandardScheme getScheme() { + return new PluginConfigStandardScheme(); } } - private static class CompactionStrategyConfigStandardScheme extends org.apache.thrift.scheme.StandardScheme<CompactionStrategyConfig> { + private static class PluginConfigStandardScheme extends org.apache.thrift.scheme.StandardScheme<PluginConfig> { @Override - public void read(org.apache.thrift.protocol.TProtocol iprot, CompactionStrategyConfig struct) throws org.apache.thrift.TException { + public void read(org.apache.thrift.protocol.TProtocol iprot, PluginConfig struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TField schemeField; iprot.readStructBegin(); while (true) @@ -466,7 +466,7 @@ public class CompactionStrategyConfig implements org.apache.thrift.TBase<Compact } @Override - public void write(org.apache.thrift.protocol.TProtocol oprot, CompactionStrategyConfig struct) throws org.apache.thrift.TException { + public void write(org.apache.thrift.protocol.TProtocol oprot, PluginConfig struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); @@ -494,17 +494,17 @@ public class CompactionStrategyConfig implements org.apache.thrift.TBase<Compact } - private static class CompactionStrategyConfigTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { + private static class PluginConfigTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { @Override - public CompactionStrategyConfigTupleScheme getScheme() { - return new CompactionStrategyConfigTupleScheme(); + public PluginConfigTupleScheme getScheme() { + return new PluginConfigTupleScheme(); } } - private static class CompactionStrategyConfigTupleScheme extends org.apache.thrift.scheme.TupleScheme<CompactionStrategyConfig> { + private static class PluginConfigTupleScheme extends org.apache.thrift.scheme.TupleScheme<PluginConfig> { @Override - public void write(org.apache.thrift.protocol.TProtocol prot, CompactionStrategyConfig struct) throws org.apache.thrift.TException { + public void write(org.apache.thrift.protocol.TProtocol prot, PluginConfig struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot; java.util.BitSet optionals = new java.util.BitSet(); if (struct.isSetClassName()) { @@ -530,7 +530,7 @@ public class CompactionStrategyConfig implements org.apache.thrift.TBase<Compact } @Override - public void read(org.apache.thrift.protocol.TProtocol prot, CompactionStrategyConfig struct) throws org.apache.thrift.TException { + public void read(org.apache.thrift.protocol.TProtocol prot, PluginConfig struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot; java.util.BitSet incoming = iprot.readBitSet(2); if (incoming.get(0)) { diff --git a/src/main/thrift/proxy.thrift b/src/main/thrift/proxy.thrift index 95fe2fb..563ead9 100644 --- a/src/main/thrift/proxy.thrift +++ b/src/main/thrift/proxy.thrift @@ -264,7 +264,7 @@ struct WriterOptions { 5:optional Durability durability } -struct CompactionStrategyConfig { +struct PluginConfig { 1:string className 2:map<string, string> options } @@ -407,7 +407,8 @@ service AccumuloProxy { 5:list<IteratorSetting> iterators 6:bool flush 7:bool wait - 8:CompactionStrategyConfig compactionStrategy + 8:PluginConfig selectorConfig + 9:PluginConfig configurerConfig ) throws ( 1:AccumuloSecurityException ouch1 2:TableNotFoundException ouch2 diff --git a/src/test/java/org/apache/accumulo/proxy/its/SelectHalfSelector.java b/src/test/java/org/apache/accumulo/proxy/its/SelectHalfSelector.java new file mode 100644 index 0000000..758c618 --- /dev/null +++ b/src/test/java/org/apache/accumulo/proxy/its/SelectHalfSelector.java @@ -0,0 +1,45 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.accumulo.proxy.its; + +import java.util.List; +import java.util.stream.Collectors; + +import org.apache.accumulo.core.client.admin.compaction.CompactableFile; +import org.apache.accumulo.core.client.admin.compaction.CompactionSelector; + +/** + * Select half of the files to compact + */ +public class SelectHalfSelector implements CompactionSelector { + + @Override + public void init(InitParameters iparams) {} + + @Override + public Selection select(SelectionParameters sparams) { + final var totalFiles = sparams.getAvailableFiles(); + + final int halfOfFileCount = totalFiles.size() / 2; + + final List<CompactableFile> toCompact = + totalFiles.stream().limit(halfOfFileCount).collect(Collectors.toList()); + + return new Selection(toCompact); + } + +} diff --git a/src/test/java/org/apache/accumulo/proxy/its/SimpleProxyBase.java b/src/test/java/org/apache/accumulo/proxy/its/SimpleProxyBase.java index 14f6975..ce37a8d 100644 --- a/src/test/java/org/apache/accumulo/proxy/its/SimpleProxyBase.java +++ b/src/test/java/org/apache/accumulo/proxy/its/SimpleProxyBase.java @@ -86,7 +86,6 @@ import org.apache.accumulo.proxy.thrift.BatchScanOptions; import org.apache.accumulo.proxy.thrift.Column; import org.apache.accumulo.proxy.thrift.ColumnUpdate; import org.apache.accumulo.proxy.thrift.CompactionReason; -import org.apache.accumulo.proxy.thrift.CompactionStrategyConfig; import org.apache.accumulo.proxy.thrift.CompactionType; import org.apache.accumulo.proxy.thrift.Condition; import org.apache.accumulo.proxy.thrift.ConditionalStatus; @@ -103,6 +102,7 @@ import org.apache.accumulo.proxy.thrift.NamespaceNotEmptyException; import org.apache.accumulo.proxy.thrift.NamespaceNotFoundException; import org.apache.accumulo.proxy.thrift.NamespacePermission; import org.apache.accumulo.proxy.thrift.PartialKey; +import org.apache.accumulo.proxy.thrift.PluginConfig; import org.apache.accumulo.proxy.thrift.Range; import org.apache.accumulo.proxy.thrift.ScanColumn; import org.apache.accumulo.proxy.thrift.ScanOptions; @@ -122,7 +122,6 @@ import org.apache.accumulo.test.constraints.MaxMutationSize; import org.apache.accumulo.test.constraints.NumericValueConstraint; import org.apache.accumulo.test.functional.SlowIterator; import org.apache.accumulo.test.util.Wait; -import org.apache.commons.io.FileUtils; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.CommonConfigurationKeysPublic; import org.apache.hadoop.fs.FSDataInputStream; @@ -406,7 +405,7 @@ public abstract class SimpleProxyBase extends SharedMiniClusterBase { @Timeout(5) public void compactTableLoginFailure() { assertThrows(AccumuloSecurityException.class, - () -> client.compactTable(badLogin, tableName, null, null, null, true, false, null)); + () -> client.compactTable(badLogin, tableName, null, null, null, true, false, null, null)); } @Test @@ -1005,7 +1004,7 @@ public abstract class SimpleProxyBase extends SharedMiniClusterBase { () -> client.checkIteratorConflicts(creds, doesNotExist, setting, EnumSet.allOf(IteratorScope.class)), () -> client.clearLocatorCache(creds, doesNotExist), () -> client.cloneTable(creds, doesNotExist, newTableName, false, null, null), - () -> client.compactTable(creds, doesNotExist, null, null, null, true, false, null), + () -> client.compactTable(creds, doesNotExist, null, null, null, true, false, null,null), () -> client.createBatchScanner(creds, doesNotExist, new BatchScanOptions()), () -> client.createScanner(creds, doesNotExist, new ScanOptions()), () -> client.createWriter(creds, doesNotExist, new WriterOptions()), @@ -1361,7 +1360,7 @@ public abstract class SimpleProxyBase extends SharedMiniClusterBase { proxyClient2 = new TestProxyClient(hostname, proxyPort, factory); } Client client2 = proxyClient2.proxy(); - client2.compactTable(creds, "slow", null, null, null, true, true, null); + client2.compactTable(creds, "slow", null, null, null, true, true, null, null); } catch (Exception e) { throw new RuntimeException(e); } finally { @@ -1995,7 +1994,7 @@ public abstract class SimpleProxyBase extends SharedMiniClusterBase { assertScan(expected, tableName); // compact - client.compactTable(creds, tableName, null, null, null, true, true, null); + client.compactTable(creds, tableName, null, null, null, true, true, null, null); assertEquals(1, countFiles(tableName)); assertScan(expected, tableName); } @@ -2014,7 +2013,7 @@ public abstract class SimpleProxyBase extends SharedMiniClusterBase { assertScan(expected, tableName); // compact - client.compactTable(creds, tableName, null, null, null, true, true, null); + client.compactTable(creds, tableName, null, null, null, true, true, null, null); assertEquals(1, countFiles(tableName)); assertScan(expected, tableName); @@ -2036,7 +2035,7 @@ public abstract class SimpleProxyBase extends SharedMiniClusterBase { assertEquals(1, diskUsage.get(1).getTables().size()); // Compact the clone so it writes its own files instead of referring to the original - client.compactTable(creds, TABLE_TEST2, null, null, null, true, true, null); + client.compactTable(creds, TABLE_TEST2, null, null, null, true, true, null, null); diskUsage = (client.getDiskUsage(creds, tablesToScan)); assertEquals(3, diskUsage.size()); @@ -2670,40 +2669,26 @@ public abstract class SimpleProxyBase extends SharedMiniClusterBase { } @Test - public void testCompactionStrategy() throws Exception { - File jarDir = new File(System.getProperty("user.dir"), "target"); - assertTrue(jarDir.mkdirs() || jarDir.isDirectory()); - File jarFile = new File(jarDir, "TestCompactionStrat.jar"); - FileUtils.copyInputStreamToFile( - SimpleProxyBase.class.getResourceAsStream("/TestCompactionStrat.jar"), jarFile); - client.setProperty(creds, Property.VFS_CONTEXT_CLASSPATH_PROPERTY.getKey() + "context1", - jarFile.toString()); - client.setTableProperty(creds, tableName, Property.TABLE_CLASSPATH.getKey(), "context1"); + public void testCompactionSelector() throws Exception { - client.addSplits(creds, tableName, Collections.singleton(s2bb("efg"))); + String[] data = "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z".split(" "); + final int expectedFileCount = data.length; - client.updateAndFlush(creds, tableName, mutation("a", "cf", "cq", "v1")); - client.flushTable(creds, tableName, null, null, true); - - client.updateAndFlush(creds, tableName, mutation("b", "cf", "cq", "v2")); - client.flushTable(creds, tableName, null, null, true); - - client.updateAndFlush(creds, tableName, mutation("y", "cf", "cq", "v1")); - client.flushTable(creds, tableName, null, null, true); - - client.updateAndFlush(creds, tableName, mutation("z", "cf", "cq", "v2")); - client.flushTable(creds, tableName, null, null, true); - - assertEquals(4, countFiles(tableName)); + for (String datum : data) { + client.addSplits(creds, tableName, Set.of(s2bb(datum))); + client.updateAndFlush(creds, tableName, mutation(datum, "cf", "cq", datum)); + client.flushTable(creds, tableName, null, null, true); + } - CompactionStrategyConfig csc = new CompactionStrategyConfig(); + assertEquals(expectedFileCount, countFiles(tableName), "Unexpected file count"); - // The EfgCompactionStrat will only compact tablets with and end row of efg - csc.setClassName("org.apache.accumulo.test.EfgCompactionStrat"); + String selectorClassname = SelectHalfSelector.class.getName(); + PluginConfig selector = new PluginConfig(selectorClassname, Map.of()); - client.compactTable(creds, tableName, null, null, null, true, true, csc); + client.compactTable(creds, tableName, null, null, null, true, true, selector, null); - assertEquals(3, countFiles(tableName)); + // SelectHalfSelector should lead to half the files being compacted + Wait.waitFor(() -> countFiles(tableName) == (expectedFileCount / 2)); } @Test diff --git a/src/test/resources/TestCompactionStrat.jar b/src/test/resources/TestCompactionStrat.jar deleted file mode 100644 index 3daa16e..0000000 Binary files a/src/test/resources/TestCompactionStrat.jar and /dev/null differ