From 8590c8acc60dde8c8642932f11bb3d6a430d4b7e Mon Sep 17 00:00:00 2001 From: DomGarguilo Date: Fri, 30 Dec 2022 16:42:38 -0500 Subject: [PATCH 1/8] Update compaction techniques --- .../apache/accumulo/proxy/ProxyServer.java | 29 +- .../java/org/apache/accumulo/proxy/Util.java | 38 ++ .../accumulo/proxy/thrift/AccumuloProxy.java | 264 ++++++--- .../accumulo/proxy/thrift/PluginConfig.java | 561 ++++++++++++++++++ src/main/thrift/proxy.thrift | 5 +- .../accumulo/proxy/its/SimpleProxyBase.java | 60 +- 6 files changed, 836 insertions(+), 121 deletions(-) create mode 100644 src/main/java/org/apache/accumulo/proxy/thrift/PluginConfig.java diff --git a/src/main/java/org/apache/accumulo/proxy/ProxyServer.java b/src/main/java/org/apache/accumulo/proxy/ProxyServer.java index 77e8e201..c3a1d223 100644 --- a/src/main/java/org/apache/accumulo/proxy/ProxyServer.java +++ b/src/main/java/org/apache/accumulo/proxy/ProxyServer.java @@ -59,6 +59,7 @@ 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; @@ -88,7 +89,6 @@ 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; @@ -394,7 +394,8 @@ public void clearLocatorCache(ByteBuffer login, String tableName) @Override public void compactTable(ByteBuffer login, String tableName, ByteBuffer startRow, ByteBuffer endRow, List 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 { @@ -403,12 +404,24 @@ public void compactTable(ByteBuffer login, String tableName, ByteBuffer startRow .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 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 options = configurerConfig.options == null ? Map.of() + : configurerConfig.options; + + org.apache.accumulo.core.client.admin.PluginConfig spc = new org.apache.accumulo.core.client.admin.PluginConfig( + configurerConfig.getClassName(), options); + + compactionConfig.setConfigurer(spc); } getConnector(login).tableOperations().compact(tableName, compactionConfig); diff --git a/src/main/java/org/apache/accumulo/proxy/Util.java b/src/main/java/org/apache/accumulo/proxy/Util.java index 6774d7fd..684ef81f 100644 --- a/src/main/java/org/apache/accumulo/proxy/Util.java +++ b/src/main/java/org/apache/accumulo/proxy/Util.java @@ -21,10 +21,17 @@ import java.math.BigInteger; import java.nio.ByteBuffer; import java.security.SecureRandom; +import java.util.Collection; +import java.util.List; import java.util.Random; +import java.util.stream.Collectors; +import org.apache.accumulo.core.client.admin.compaction.CompactableFile; +import org.apache.accumulo.core.client.admin.compaction.CompactionSelector; import org.apache.accumulo.proxy.thrift.IteratorSetting; import org.apache.accumulo.proxy.thrift.Key; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class Util { @@ -67,4 +74,35 @@ protected static byte[] deNullify(byte[] in) { else return in; } + + /** + * Select half of the files to compact + */ + public static class SelectHalfSelector implements CompactionSelector { + public final Logger log = LoggerFactory.getLogger(SelectHalfSelector.class); + + @Override + public void init(InitParameters iparams) {} + + @Override + public Selection select(SelectionParameters sparams) { + log.info(sparams.getAvailableFiles().toString()); + Collection totalFiles = sparams.getAvailableFiles(); + final int fileCount = totalFiles.size(); + + if (fileCount < 1) { + return new Selection(List.of()); + } + + final int numToCompact = fileCount / 2; + + List toCompact = totalFiles.stream().limit(numToCompact) + .collect(Collectors.toList()); + + log.info("files to select: {}", toCompact); + return new Selection(toCompact); + } + + } + } diff --git a/src/main/java/org/apache/accumulo/proxy/thrift/AccumuloProxy.java b/src/main/java/org/apache/accumulo/proxy/thrift/AccumuloProxy.java index cdbcf0b7..4ae60c73 100644 --- a/src/main/java/org/apache/accumulo/proxy/thrift/AccumuloProxy.java +++ b/src/main/java/org/apache/accumulo/proxy/thrift/AccumuloProxy.java @@ -41,7 +41,7 @@ public interface Iface { public void cloneTable(java.nio.ByteBuffer login, java.lang.String tableName, java.lang.String newTableName, boolean flush, java.util.Map propertiesToSet, java.util.Set 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 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 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; @@ -245,7 +245,7 @@ public interface AsyncIface { public void cloneTable(java.nio.ByteBuffer login, java.lang.String tableName, java.lang.String newTableName, boolean flush, java.util.Map propertiesToSet, java.util.Set propertiesToExclude, org.apache.thrift.async.AsyncMethodCallback 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 iterators, boolean flush, boolean wait, CompactionStrategyConfig compactionStrategy, org.apache.thrift.async.AsyncMethodCallback 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 iterators, boolean flush, boolean wait, PluginConfig selectorConfig, PluginConfig configurerConfig, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; public void cancelCompaction(java.nio.ByteBuffer login, java.lang.String tableName, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; @@ -680,13 +680,13 @@ public void recv_cloneTable() throws AccumuloException, AccumuloSecurityExceptio } @Override - public void compactTable(java.nio.ByteBuffer login, java.lang.String tableName, java.nio.ByteBuffer startRow, java.nio.ByteBuffer endRow, java.util.List 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 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 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 iterators, boolean flush, boolean wait, PluginConfig selectorConfig, PluginConfig configurerConfig) throws org.apache.thrift.TException { compactTable_args args = new compactTable_args(); args.setLogin(login); @@ -696,7 +696,8 @@ public void send_compactTable(java.nio.ByteBuffer login, java.lang.String tableN args.setIterators(iterators); args.setFlush(flush); args.setWait(wait); - args.setCompactionStrategy(compactionStrategy); + args.setSelectorConfig(selectorConfig); + args.setConfigurerConfig(configurerConfig); sendBase("compactTable", args); } @@ -3918,9 +3919,9 @@ public Void getResult() throws AccumuloException, AccumuloSecurityException, Tab } @Override - public void compactTable(java.nio.ByteBuffer login, java.lang.String tableName, java.nio.ByteBuffer startRow, java.nio.ByteBuffer endRow, java.util.List iterators, boolean flush, boolean wait, CompactionStrategyConfig compactionStrategy, org.apache.thrift.async.AsyncMethodCallback 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 iterators, boolean flush, boolean wait, PluginConfig selectorConfig, PluginConfig configurerConfig, org.apache.thrift.async.AsyncMethodCallback 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); } @@ -3933,8 +3934,9 @@ public static class compactTable_call extends org.apache.thrift.async.TAsyncMeth private java.util.List 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 iterators, boolean flush, boolean wait, CompactionStrategyConfig compactionStrategy, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { + 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 iterators, boolean flush, boolean wait, PluginConfig selectorConfig, PluginConfig configurerConfig, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { super(client, protocolFactory, transport, resultHandler, false); this.login = login; this.tableName = tableName; @@ -3943,7 +3945,8 @@ public compactTable_call(java.nio.ByteBuffer login, java.lang.String tableName, this.iterators = iterators; this.flush = flush; this.wait = wait; - this.compactionStrategy = compactionStrategy; + this.selectorConfig = selectorConfig; + this.configurerConfig = configurerConfig; } @Override @@ -3957,7 +3960,8 @@ public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apa args.setIterators(iterators); args.setFlush(flush); args.setWait(wait); - args.setCompactionStrategy(compactionStrategy); + args.setSelectorConfig(selectorConfig); + args.setConfigurerConfig(configurerConfig); args.write(prot); prot.writeMessageEnd(); } @@ -8084,7 +8088,7 @@ protected boolean rethrowUnhandledExceptions() { 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) { @@ -12015,7 +12019,7 @@ protected boolean isOneway() { @Override public void start(I iface, compactTable_args args, org.apache.thrift.async.AsyncMethodCallback 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); } } @@ -27920,7 +27924,8 @@ public static class compactTable_args implements org.apache.thrift.TBase 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 { @@ -27943,7 +27949,8 @@ public enum _Fields implements org.apache.thrift.TFieldIdEnum { 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 byName = new java.util.HashMap(); @@ -27973,8 +27980,10 @@ public static _Fields findByThriftId(int fieldId) { 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; } @@ -28039,8 +28048,10 @@ public java.lang.String getFieldName() { 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); } @@ -28056,7 +28067,8 @@ public compactTable_args( java.util.List iterators, boolean flush, boolean wait, - CompactionStrategyConfig compactionStrategy) + PluginConfig selectorConfig, + PluginConfig configurerConfig) { this(); this.login = org.apache.thrift.TBaseHelper.copyBinary(login); @@ -28068,7 +28080,8 @@ public compactTable_args( setFlushIsSet(true); this.wait = wait; setWaitIsSet(true); - this.compactionStrategy = compactionStrategy; + this.selectorConfig = selectorConfig; + this.configurerConfig = configurerConfig; } /** @@ -28097,8 +28110,11 @@ public compactTable_args(compactTable_args other) { } 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); } } @@ -28118,7 +28134,8 @@ public void clear() { this.flush = false; setWaitIsSet(false); this.wait = false; - this.compactionStrategy = null; + this.selectorConfig = null; + this.configurerConfig = null; } public byte[] getLogin() { @@ -28336,27 +28353,52 @@ public void setWaitIsSet(boolean value) { } @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; } } @@ -28431,11 +28473,19 @@ public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable } 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; @@ -28467,8 +28517,11 @@ public java.lang.Object getFieldValue(_Fields field) { case WAIT: return isWait(); - case COMPACTION_STRATEGY: - return getCompactionStrategy(); + case SELECTOR_CONFIG: + return getSelectorConfig(); + + case CONFIGURER_CONFIG: + return getConfigurerConfig(); } throw new java.lang.IllegalStateException(); @@ -28496,8 +28549,10 @@ public boolean isSet(_Fields field) { 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(); } @@ -28578,12 +28633,21 @@ public boolean equals(compactTable_args that) { 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; } @@ -28618,9 +28682,13 @@ public int hashCode() { 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; } @@ -28703,12 +28771,22 @@ public int compareTo(compactTable_args other) { 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; } @@ -28785,11 +28863,19 @@ public java.lang.String toString() { 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(")"); @@ -28799,8 +28885,11 @@ public java.lang.String toString() { 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(); } } @@ -28909,11 +28998,20 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, compactTable_args s 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); } @@ -28972,9 +29070,14 @@ public void write(org.apache.thrift.protocol.TProtocol oprot, compactTable_args 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(); @@ -29017,10 +29120,13 @@ public void write(org.apache.thrift.protocol.TProtocol prot, compactTable_args s 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); } @@ -29048,15 +29154,18 @@ public void write(org.apache.thrift.protocol.TProtocol prot, compactTable_args s 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); @@ -29096,9 +29205,14 @@ public void read(org.apache.thrift.protocol.TProtocol prot, compactTable_args st 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/java/org/apache/accumulo/proxy/thrift/PluginConfig.java b/src/main/java/org/apache/accumulo/proxy/thrift/PluginConfig.java new file mode 100644 index 00000000..753ce901 --- /dev/null +++ b/src/main/java/org/apache/accumulo/proxy/thrift/PluginConfig.java @@ -0,0 +1,561 @@ +/* + * 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. + */ +/** + * Autogenerated by Thrift Compiler (0.17.0) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.apache.accumulo.proxy.thrift; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) +public class PluginConfig implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { + 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 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 options; // 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 { + CLASS_NAME((short)1, "className"), + OPTIONS((short)2, "options"); + + private static final java.util.Map byName = new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 1: // CLASS_NAME + return CLASS_NAME; + case 2: // OPTIONS + return OPTIONS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.CLASS_NAME, new org.apache.thrift.meta_data.FieldMetaData("className", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.OPTIONS, new org.apache.thrift.meta_data.FieldMetaData("options", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP, + 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(PluginConfig.class, metaDataMap); + } + + public PluginConfig() { + } + + public PluginConfig( + java.lang.String className, + java.util.Map options) + { + this(); + this.className = className; + this.options = options; + } + + /** + * Performs a deep copy on other. + */ + public PluginConfig(PluginConfig other) { + if (other.isSetClassName()) { + this.className = other.className; + } + if (other.isSetOptions()) { + java.util.Map __this__options = new java.util.HashMap(other.options); + this.options = __this__options; + } + } + + @Override + public PluginConfig deepCopy() { + return new PluginConfig(this); + } + + @Override + public void clear() { + this.className = null; + this.options = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getClassName() { + return this.className; + } + + public PluginConfig setClassName(@org.apache.thrift.annotation.Nullable java.lang.String className) { + this.className = className; + return this; + } + + public void unsetClassName() { + this.className = null; + } + + /** Returns true if field className is set (has been assigned a value) and false otherwise */ + public boolean isSetClassName() { + return this.className != null; + } + + public void setClassNameIsSet(boolean value) { + if (!value) { + this.className = null; + } + } + + public int getOptionsSize() { + return (this.options == null) ? 0 : this.options.size(); + } + + public void putToOptions(java.lang.String key, java.lang.String val) { + if (this.options == null) { + this.options = new java.util.HashMap(); + } + this.options.put(key, val); + } + + @org.apache.thrift.annotation.Nullable + public java.util.Map getOptions() { + return this.options; + } + + public PluginConfig setOptions(@org.apache.thrift.annotation.Nullable java.util.Map options) { + this.options = options; + return this; + } + + public void unsetOptions() { + this.options = null; + } + + /** Returns true if field options is set (has been assigned a value) and false otherwise */ + public boolean isSetOptions() { + return this.options != null; + } + + public void setOptionsIsSet(boolean value) { + if (!value) { + this.options = null; + } + } + + @Override + public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case CLASS_NAME: + if (value == null) { + unsetClassName(); + } else { + setClassName((java.lang.String)value); + } + break; + + case OPTIONS: + if (value == null) { + unsetOptions(); + } else { + setOptions((java.util.Map)value); + } + break; + + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case CLASS_NAME: + return getClassName(); + + case OPTIONS: + return getOptions(); + + } + throw new java.lang.IllegalStateException(); + } + + /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case CLASS_NAME: + return isSetClassName(); + case OPTIONS: + return isSetOptions(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof PluginConfig) + return this.equals((PluginConfig)that); + return false; + } + + public boolean equals(PluginConfig that) { + if (that == null) + return false; + if (this == that) + return true; + + boolean this_present_className = true && this.isSetClassName(); + boolean that_present_className = true && that.isSetClassName(); + if (this_present_className || that_present_className) { + if (!(this_present_className && that_present_className)) + return false; + if (!this.className.equals(that.className)) + return false; + } + + boolean this_present_options = true && this.isSetOptions(); + boolean that_present_options = true && that.isSetOptions(); + if (this_present_options || that_present_options) { + if (!(this_present_options && that_present_options)) + return false; + if (!this.options.equals(that.options)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetClassName()) ? 131071 : 524287); + if (isSetClassName()) + hashCode = hashCode * 8191 + className.hashCode(); + + hashCode = hashCode * 8191 + ((isSetOptions()) ? 131071 : 524287); + if (isSetOptions()) + hashCode = hashCode * 8191 + options.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(PluginConfig other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetClassName(), other.isSetClassName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetClassName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.className, other.className); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetOptions(), other.isSetOptions()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetOptions()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.options, other.options); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("PluginConfig("); + boolean first = true; + + sb.append("className:"); + if (this.className == null) { + sb.append("null"); + } else { + sb.append(this.className); + } + first = false; + if (!first) sb.append(", "); + sb.append("options:"); + if (this.options == null) { + sb.append("null"); + } else { + sb.append(this.options); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class PluginConfigStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { + @Override + public PluginConfigStandardScheme getScheme() { + return new PluginConfigStandardScheme(); + } + } + + private static class PluginConfigStandardScheme extends org.apache.thrift.scheme.StandardScheme { + + @Override + 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) + { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // CLASS_NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.className = iprot.readString(); + struct.setClassNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // OPTIONS + if (schemeField.type == org.apache.thrift.protocol.TType.MAP) { + { + org.apache.thrift.protocol.TMap _map154 = iprot.readMapBegin(); + struct.options = new java.util.HashMap(2*_map154.size); + @org.apache.thrift.annotation.Nullable java.lang.String _key155; + @org.apache.thrift.annotation.Nullable java.lang.String _val156; + for (int _i157 = 0; _i157 < _map154.size; ++_i157) + { + _key155 = iprot.readString(); + _val156 = iprot.readString(); + struct.options.put(_key155, _val156); + } + iprot.readMapEnd(); + } + struct.setOptionsIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, PluginConfig struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.className != null) { + oprot.writeFieldBegin(CLASS_NAME_FIELD_DESC); + oprot.writeString(struct.className); + oprot.writeFieldEnd(); + } + if (struct.options != null) { + oprot.writeFieldBegin(OPTIONS_FIELD_DESC); + { + oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.options.size())); + for (java.util.Map.Entry _iter158 : struct.options.entrySet()) + { + oprot.writeString(_iter158.getKey()); + oprot.writeString(_iter158.getValue()); + } + oprot.writeMapEnd(); + } + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class PluginConfigTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { + @Override + public PluginConfigTupleScheme getScheme() { + return new PluginConfigTupleScheme(); + } + } + + private static class PluginConfigTupleScheme extends org.apache.thrift.scheme.TupleScheme { + + @Override + 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()) { + optionals.set(0); + } + if (struct.isSetOptions()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetClassName()) { + oprot.writeString(struct.className); + } + if (struct.isSetOptions()) { + { + oprot.writeI32(struct.options.size()); + for (java.util.Map.Entry _iter159 : struct.options.entrySet()) + { + oprot.writeString(_iter159.getKey()); + oprot.writeString(_iter159.getValue()); + } + } + } + } + + @Override + 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)) { + struct.className = iprot.readString(); + struct.setClassNameIsSet(true); + } + if (incoming.get(1)) { + { + org.apache.thrift.protocol.TMap _map160 = iprot.readMapBegin(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING); + struct.options = new java.util.HashMap(2*_map160.size); + @org.apache.thrift.annotation.Nullable java.lang.String _key161; + @org.apache.thrift.annotation.Nullable java.lang.String _val162; + for (int _i163 = 0; _i163 < _map160.size; ++_i163) + { + _key161 = iprot.readString(); + _val162 = iprot.readString(); + struct.options.put(_key161, _val162); + } + } + struct.setOptionsIsSet(true); + } + } + } + + private static S scheme(org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme(); + } + private static void unusedMethod() {} +} + diff --git a/src/main/thrift/proxy.thrift b/src/main/thrift/proxy.thrift index 95fe2fb2..563ead91 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 options } @@ -407,7 +407,8 @@ service AccumuloProxy { 5:list 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/SimpleProxyBase.java b/src/test/java/org/apache/accumulo/proxy/its/SimpleProxyBase.java index ffad3dc4..179249d1 100644 --- a/src/test/java/org/apache/accumulo/proxy/its/SimpleProxyBase.java +++ b/src/test/java/org/apache/accumulo/proxy/its/SimpleProxyBase.java @@ -78,6 +78,8 @@ import org.apache.accumulo.miniclusterImpl.MiniAccumuloClusterImpl; import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl; import org.apache.accumulo.proxy.Proxy; +import org.apache.accumulo.proxy.Util; +import org.apache.accumulo.proxy.Util.SelectHalfSelector; import org.apache.accumulo.proxy.thrift.AccumuloProxy.Client; import org.apache.accumulo.proxy.thrift.AccumuloSecurityException; import org.apache.accumulo.proxy.thrift.ActiveCompaction; @@ -86,7 +88,6 @@ 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 +104,7 @@ 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; @@ -121,7 +123,7 @@ import org.apache.accumulo.test.constraints.MaxMutationSize; import org.apache.accumulo.test.constraints.NumericValueConstraint; import org.apache.accumulo.test.functional.SlowIterator; -import org.apache.commons.io.FileUtils; +import org.apache.accumulo.test.util.Wait; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.CommonConfigurationKeysPublic; import org.apache.hadoop.fs.FSDataInputStream; @@ -403,7 +405,7 @@ public void clearLocatorCacheLoginFailure() { @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 @@ -1002,7 +1004,7 @@ public void tableNotFound() throws IOException { () -> 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()), @@ -1362,7 +1364,7 @@ public void run() { 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 { @@ -2014,7 +2016,7 @@ public void compactTable() throws Exception { 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); } @@ -2033,7 +2035,7 @@ public void diskUsage() throws Exception { 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); @@ -2055,7 +2057,7 @@ public void diskUsage() throws Exception { 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()); @@ -2704,40 +2706,26 @@ public void testGetRowRange() throws Exception { } @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"))); + List data = List.of("A", "B", "C", "D"); + final int expectedFileCount = data.size(); - 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 From c15864643dc65657b77ca0cbd18e82058992a09f Mon Sep 17 00:00:00 2001 From: DomGarguilo Date: Fri, 30 Dec 2022 16:50:30 -0500 Subject: [PATCH 2/8] formatting and variable name change --- src/main/java/org/apache/accumulo/proxy/ProxyServer.java | 4 ++-- .../java/org/apache/accumulo/proxy/its/SimpleProxyBase.java | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/apache/accumulo/proxy/ProxyServer.java b/src/main/java/org/apache/accumulo/proxy/ProxyServer.java index c3a1d223..fe7c770e 100644 --- a/src/main/java/org/apache/accumulo/proxy/ProxyServer.java +++ b/src/main/java/org/apache/accumulo/proxy/ProxyServer.java @@ -418,10 +418,10 @@ public void compactTable(ByteBuffer login, String tableName, ByteBuffer startRow Map options = configurerConfig.options == null ? Map.of() : configurerConfig.options; - org.apache.accumulo.core.client.admin.PluginConfig spc = new org.apache.accumulo.core.client.admin.PluginConfig( + org.apache.accumulo.core.client.admin.PluginConfig cpc = new org.apache.accumulo.core.client.admin.PluginConfig( configurerConfig.getClassName(), options); - compactionConfig.setConfigurer(spc); + compactionConfig.setConfigurer(cpc); } getConnector(login).tableOperations().compact(tableName, compactionConfig); 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 179249d1..9b2a4f9f 100644 --- a/src/test/java/org/apache/accumulo/proxy/its/SimpleProxyBase.java +++ b/src/test/java/org/apache/accumulo/proxy/its/SimpleProxyBase.java @@ -78,7 +78,6 @@ import org.apache.accumulo.miniclusterImpl.MiniAccumuloClusterImpl; import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl; import org.apache.accumulo.proxy.Proxy; -import org.apache.accumulo.proxy.Util; import org.apache.accumulo.proxy.Util.SelectHalfSelector; import org.apache.accumulo.proxy.thrift.AccumuloProxy.Client; import org.apache.accumulo.proxy.thrift.AccumuloSecurityException; From 1a6e5d56f59038d440ec2271a6b2dedb084188f0 Mon Sep 17 00:00:00 2001 From: DomGarguilo Date: Wed, 4 Jan 2023 10:21:13 -0500 Subject: [PATCH 3/8] Move test Selector to /test --- .../java/org/apache/accumulo/proxy/Util.java | 37 ------------ .../accumulo/proxy/SelectHalfSelector.java | 56 +++++++++++++++++++ .../accumulo/proxy/its/SimpleProxyBase.java | 2 +- 3 files changed, 57 insertions(+), 38 deletions(-) create mode 100644 src/test/java/org/apache/accumulo/proxy/SelectHalfSelector.java diff --git a/src/main/java/org/apache/accumulo/proxy/Util.java b/src/main/java/org/apache/accumulo/proxy/Util.java index 684ef81f..487f67b7 100644 --- a/src/main/java/org/apache/accumulo/proxy/Util.java +++ b/src/main/java/org/apache/accumulo/proxy/Util.java @@ -21,17 +21,10 @@ import java.math.BigInteger; import java.nio.ByteBuffer; import java.security.SecureRandom; -import java.util.Collection; -import java.util.List; import java.util.Random; -import java.util.stream.Collectors; -import org.apache.accumulo.core.client.admin.compaction.CompactableFile; -import org.apache.accumulo.core.client.admin.compaction.CompactionSelector; import org.apache.accumulo.proxy.thrift.IteratorSetting; import org.apache.accumulo.proxy.thrift.Key; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; public class Util { @@ -75,34 +68,4 @@ protected static byte[] deNullify(byte[] in) { return in; } - /** - * Select half of the files to compact - */ - public static class SelectHalfSelector implements CompactionSelector { - public final Logger log = LoggerFactory.getLogger(SelectHalfSelector.class); - - @Override - public void init(InitParameters iparams) {} - - @Override - public Selection select(SelectionParameters sparams) { - log.info(sparams.getAvailableFiles().toString()); - Collection totalFiles = sparams.getAvailableFiles(); - final int fileCount = totalFiles.size(); - - if (fileCount < 1) { - return new Selection(List.of()); - } - - final int numToCompact = fileCount / 2; - - List toCompact = totalFiles.stream().limit(numToCompact) - .collect(Collectors.toList()); - - log.info("files to select: {}", toCompact); - return new Selection(toCompact); - } - - } - } diff --git a/src/test/java/org/apache/accumulo/proxy/SelectHalfSelector.java b/src/test/java/org/apache/accumulo/proxy/SelectHalfSelector.java new file mode 100644 index 00000000..5c7c4630 --- /dev/null +++ b/src/test/java/org/apache/accumulo/proxy/SelectHalfSelector.java @@ -0,0 +1,56 @@ +/* + * 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; + +import java.util.Collection; +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; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Select half of the files to compact + */ +public class SelectHalfSelector implements CompactionSelector { + public final Logger log = LoggerFactory.getLogger(SelectHalfSelector.class); + + @Override + public void init(InitParameters iparams) {} + + @Override + public Selection select(SelectionParameters sparams) { + log.info(sparams.getAvailableFiles().toString()); + Collection totalFiles = sparams.getAvailableFiles(); + final int fileCount = totalFiles.size(); + + if (fileCount < 1) { + return new Selection(List.of()); + } + + final int numToCompact = fileCount / 2; + + List toCompact = totalFiles.stream().limit(numToCompact) + .collect(Collectors.toList()); + + log.info("files to select: {}", toCompact); + 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 9b2a4f9f..6178496b 100644 --- a/src/test/java/org/apache/accumulo/proxy/its/SimpleProxyBase.java +++ b/src/test/java/org/apache/accumulo/proxy/its/SimpleProxyBase.java @@ -78,7 +78,7 @@ import org.apache.accumulo.miniclusterImpl.MiniAccumuloClusterImpl; import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl; import org.apache.accumulo.proxy.Proxy; -import org.apache.accumulo.proxy.Util.SelectHalfSelector; +import org.apache.accumulo.proxy.SelectHalfSelector; import org.apache.accumulo.proxy.thrift.AccumuloProxy.Client; import org.apache.accumulo.proxy.thrift.AccumuloSecurityException; import org.apache.accumulo.proxy.thrift.ActiveCompaction; From 9d9f16a65641859f8e1fd5b78facc22784e9c2a3 Mon Sep 17 00:00:00 2001 From: DomGarguilo Date: Wed, 4 Jan 2023 10:30:44 -0500 Subject: [PATCH 4/8] Simplify Selector code --- .../accumulo/proxy/SelectHalfSelector.java | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/src/test/java/org/apache/accumulo/proxy/SelectHalfSelector.java b/src/test/java/org/apache/accumulo/proxy/SelectHalfSelector.java index 5c7c4630..82f79a22 100644 --- a/src/test/java/org/apache/accumulo/proxy/SelectHalfSelector.java +++ b/src/test/java/org/apache/accumulo/proxy/SelectHalfSelector.java @@ -16,40 +16,29 @@ */ package org.apache.accumulo.proxy; -import java.util.Collection; 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; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; /** * Select half of the files to compact */ public class SelectHalfSelector implements CompactionSelector { - public final Logger log = LoggerFactory.getLogger(SelectHalfSelector.class); @Override public void init(InitParameters iparams) {} @Override public Selection select(SelectionParameters sparams) { - log.info(sparams.getAvailableFiles().toString()); - Collection totalFiles = sparams.getAvailableFiles(); - final int fileCount = totalFiles.size(); + final var totalFiles = sparams.getAvailableFiles(); - if (fileCount < 1) { - return new Selection(List.of()); - } + final int halfOfFileCount = totalFiles.size() / 2; - final int numToCompact = fileCount / 2; - - List toCompact = totalFiles.stream().limit(numToCompact) + final List toCompact = totalFiles.stream().limit(halfOfFileCount) .collect(Collectors.toList()); - log.info("files to select: {}", toCompact); return new Selection(toCompact); } From ec32f625f83a6359e927269647bdc2347b4dc879 Mon Sep 17 00:00:00 2001 From: DomGarguilo Date: Wed, 4 Jan 2023 11:02:20 -0500 Subject: [PATCH 5/8] Increase scale of test case and remove unneeded code --- src/main/java/org/apache/accumulo/proxy/Util.java | 1 - .../java/org/apache/accumulo/proxy/its/SimpleProxyBase.java | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/apache/accumulo/proxy/Util.java b/src/main/java/org/apache/accumulo/proxy/Util.java index 487f67b7..6774d7fd 100644 --- a/src/main/java/org/apache/accumulo/proxy/Util.java +++ b/src/main/java/org/apache/accumulo/proxy/Util.java @@ -67,5 +67,4 @@ protected static byte[] deNullify(byte[] in) { else return in; } - } 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 6178496b..c2bd97b4 100644 --- a/src/test/java/org/apache/accumulo/proxy/its/SimpleProxyBase.java +++ b/src/test/java/org/apache/accumulo/proxy/its/SimpleProxyBase.java @@ -2707,8 +2707,8 @@ public void testGetRowRange() throws Exception { @Test public void testCompactionSelector() throws Exception { - List data = List.of("A", "B", "C", "D"); - final int expectedFileCount = data.size(); + 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; for (String datum : data) { client.addSplits(creds, tableName, Set.of(s2bb(datum))); From 1f6d325bae6ef21028dd86a5cd8fcb9854111502 Mon Sep 17 00:00:00 2001 From: DomGarguilo Date: Wed, 11 Jan 2023 13:51:07 -0500 Subject: [PATCH 6/8] deleted old comapction files --- .../thrift/CompactionStrategyConfig.java | 561 ------------------ src/test/resources/TestCompactionStrat.jar | Bin 2530 -> 0 bytes 2 files changed, 561 deletions(-) delete mode 100644 src/main/java/org/apache/accumulo/proxy/thrift/CompactionStrategyConfig.java delete mode 100644 src/test/resources/TestCompactionStrat.jar diff --git a/src/main/java/org/apache/accumulo/proxy/thrift/CompactionStrategyConfig.java b/src/main/java/org/apache/accumulo/proxy/thrift/CompactionStrategyConfig.java deleted file mode 100644 index 67ee918b..00000000 --- a/src/main/java/org/apache/accumulo/proxy/thrift/CompactionStrategyConfig.java +++ /dev/null @@ -1,561 +0,0 @@ -/* - * 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. - */ -/** - * Autogenerated by Thrift Compiler (0.17.0) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -package org.apache.accumulo.proxy.thrift; - -@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) -public class CompactionStrategyConfig implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("CompactionStrategyConfig"); - - 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(); - - public @org.apache.thrift.annotation.Nullable java.lang.String className; // required - public @org.apache.thrift.annotation.Nullable java.util.Map options; // 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 { - CLASS_NAME((short)1, "className"), - OPTIONS((short)2, "options"); - - private static final java.util.Map byName = new java.util.HashMap(); - - static { - for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - @org.apache.thrift.annotation.Nullable - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 1: // CLASS_NAME - return CLASS_NAME; - case 2: // OPTIONS - return OPTIONS; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - @org.apache.thrift.annotation.Nullable - public static _Fields findByName(java.lang.String name) { - return byName.get(name); - } - - private final short _thriftId; - private final java.lang.String _fieldName; - - _Fields(short thriftId, java.lang.String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - @Override - public short getThriftFieldId() { - return _thriftId; - } - - @Override - public java.lang.String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.CLASS_NAME, new org.apache.thrift.meta_data.FieldMetaData("className", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - tmpMap.put(_Fields.OPTIONS, new org.apache.thrift.meta_data.FieldMetaData("options", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP, - 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); - } - - public CompactionStrategyConfig() { - } - - public CompactionStrategyConfig( - java.lang.String className, - java.util.Map options) - { - this(); - this.className = className; - this.options = options; - } - - /** - * Performs a deep copy on other. - */ - public CompactionStrategyConfig(CompactionStrategyConfig other) { - if (other.isSetClassName()) { - this.className = other.className; - } - if (other.isSetOptions()) { - java.util.Map __this__options = new java.util.HashMap(other.options); - this.options = __this__options; - } - } - - @Override - public CompactionStrategyConfig deepCopy() { - return new CompactionStrategyConfig(this); - } - - @Override - public void clear() { - this.className = null; - this.options = null; - } - - @org.apache.thrift.annotation.Nullable - public java.lang.String getClassName() { - return this.className; - } - - public CompactionStrategyConfig setClassName(@org.apache.thrift.annotation.Nullable java.lang.String className) { - this.className = className; - return this; - } - - public void unsetClassName() { - this.className = null; - } - - /** Returns true if field className is set (has been assigned a value) and false otherwise */ - public boolean isSetClassName() { - return this.className != null; - } - - public void setClassNameIsSet(boolean value) { - if (!value) { - this.className = null; - } - } - - public int getOptionsSize() { - return (this.options == null) ? 0 : this.options.size(); - } - - public void putToOptions(java.lang.String key, java.lang.String val) { - if (this.options == null) { - this.options = new java.util.HashMap(); - } - this.options.put(key, val); - } - - @org.apache.thrift.annotation.Nullable - public java.util.Map getOptions() { - return this.options; - } - - public CompactionStrategyConfig setOptions(@org.apache.thrift.annotation.Nullable java.util.Map options) { - this.options = options; - return this; - } - - public void unsetOptions() { - this.options = null; - } - - /** Returns true if field options is set (has been assigned a value) and false otherwise */ - public boolean isSetOptions() { - return this.options != null; - } - - public void setOptionsIsSet(boolean value) { - if (!value) { - this.options = null; - } - } - - @Override - public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { - switch (field) { - case CLASS_NAME: - if (value == null) { - unsetClassName(); - } else { - setClassName((java.lang.String)value); - } - break; - - case OPTIONS: - if (value == null) { - unsetOptions(); - } else { - setOptions((java.util.Map)value); - } - break; - - } - } - - @org.apache.thrift.annotation.Nullable - @Override - public java.lang.Object getFieldValue(_Fields field) { - switch (field) { - case CLASS_NAME: - return getClassName(); - - case OPTIONS: - return getOptions(); - - } - throw new java.lang.IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - @Override - public boolean isSet(_Fields field) { - if (field == null) { - throw new java.lang.IllegalArgumentException(); - } - - switch (field) { - case CLASS_NAME: - return isSetClassName(); - case OPTIONS: - return isSetOptions(); - } - throw new java.lang.IllegalStateException(); - } - - @Override - public boolean equals(java.lang.Object that) { - if (that instanceof CompactionStrategyConfig) - return this.equals((CompactionStrategyConfig)that); - return false; - } - - public boolean equals(CompactionStrategyConfig that) { - if (that == null) - return false; - if (this == that) - return true; - - boolean this_present_className = true && this.isSetClassName(); - boolean that_present_className = true && that.isSetClassName(); - if (this_present_className || that_present_className) { - if (!(this_present_className && that_present_className)) - return false; - if (!this.className.equals(that.className)) - return false; - } - - boolean this_present_options = true && this.isSetOptions(); - boolean that_present_options = true && that.isSetOptions(); - if (this_present_options || that_present_options) { - if (!(this_present_options && that_present_options)) - return false; - if (!this.options.equals(that.options)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - int hashCode = 1; - - hashCode = hashCode * 8191 + ((isSetClassName()) ? 131071 : 524287); - if (isSetClassName()) - hashCode = hashCode * 8191 + className.hashCode(); - - hashCode = hashCode * 8191 + ((isSetOptions()) ? 131071 : 524287); - if (isSetOptions()) - hashCode = hashCode * 8191 + options.hashCode(); - - return hashCode; - } - - @Override - public int compareTo(CompactionStrategyConfig other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = java.lang.Boolean.compare(isSetClassName(), other.isSetClassName()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetClassName()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.className, other.className); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = java.lang.Boolean.compare(isSetOptions(), other.isSetOptions()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetOptions()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.options, other.options); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - @org.apache.thrift.annotation.Nullable - @Override - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - scheme(iprot).read(iprot, this); - } - - @Override - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - scheme(oprot).write(oprot, this); - } - - @Override - public java.lang.String toString() { - java.lang.StringBuilder sb = new java.lang.StringBuilder("CompactionStrategyConfig("); - boolean first = true; - - sb.append("className:"); - if (this.className == null) { - sb.append("null"); - } else { - sb.append(this.className); - } - first = false; - if (!first) sb.append(", "); - sb.append("options:"); - if (this.options == null) { - sb.append("null"); - } else { - sb.append(this.options); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { - try { - write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException { - try { - read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private static class CompactionStrategyConfigStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { - @Override - public CompactionStrategyConfigStandardScheme getScheme() { - return new CompactionStrategyConfigStandardScheme(); - } - } - - private static class CompactionStrategyConfigStandardScheme extends org.apache.thrift.scheme.StandardScheme { - - @Override - public void read(org.apache.thrift.protocol.TProtocol iprot, CompactionStrategyConfig struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // CLASS_NAME - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.className = iprot.readString(); - struct.setClassNameIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 2: // OPTIONS - if (schemeField.type == org.apache.thrift.protocol.TType.MAP) { - { - org.apache.thrift.protocol.TMap _map154 = iprot.readMapBegin(); - struct.options = new java.util.HashMap(2*_map154.size); - @org.apache.thrift.annotation.Nullable java.lang.String _key155; - @org.apache.thrift.annotation.Nullable java.lang.String _val156; - for (int _i157 = 0; _i157 < _map154.size; ++_i157) - { - _key155 = iprot.readString(); - _val156 = iprot.readString(); - struct.options.put(_key155, _val156); - } - iprot.readMapEnd(); - } - struct.setOptionsIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - @Override - public void write(org.apache.thrift.protocol.TProtocol oprot, CompactionStrategyConfig struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.className != null) { - oprot.writeFieldBegin(CLASS_NAME_FIELD_DESC); - oprot.writeString(struct.className); - oprot.writeFieldEnd(); - } - if (struct.options != null) { - oprot.writeFieldBegin(OPTIONS_FIELD_DESC); - { - oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.options.size())); - for (java.util.Map.Entry _iter158 : struct.options.entrySet()) - { - oprot.writeString(_iter158.getKey()); - oprot.writeString(_iter158.getValue()); - } - oprot.writeMapEnd(); - } - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class CompactionStrategyConfigTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { - @Override - public CompactionStrategyConfigTupleScheme getScheme() { - return new CompactionStrategyConfigTupleScheme(); - } - } - - private static class CompactionStrategyConfigTupleScheme extends org.apache.thrift.scheme.TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, CompactionStrategyConfig 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()) { - optionals.set(0); - } - if (struct.isSetOptions()) { - optionals.set(1); - } - oprot.writeBitSet(optionals, 2); - if (struct.isSetClassName()) { - oprot.writeString(struct.className); - } - if (struct.isSetOptions()) { - { - oprot.writeI32(struct.options.size()); - for (java.util.Map.Entry _iter159 : struct.options.entrySet()) - { - oprot.writeString(_iter159.getKey()); - oprot.writeString(_iter159.getValue()); - } - } - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, CompactionStrategyConfig 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)) { - struct.className = iprot.readString(); - struct.setClassNameIsSet(true); - } - if (incoming.get(1)) { - { - org.apache.thrift.protocol.TMap _map160 = iprot.readMapBegin(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING); - struct.options = new java.util.HashMap(2*_map160.size); - @org.apache.thrift.annotation.Nullable java.lang.String _key161; - @org.apache.thrift.annotation.Nullable java.lang.String _val162; - for (int _i163 = 0; _i163 < _map160.size; ++_i163) - { - _key161 = iprot.readString(); - _val162 = iprot.readString(); - struct.options.put(_key161, _val162); - } - } - struct.setOptionsIsSet(true); - } - } - } - - private static S scheme(org.apache.thrift.protocol.TProtocol proto) { - return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme(); - } - private static void unusedMethod() {} -} - diff --git a/src/test/resources/TestCompactionStrat.jar b/src/test/resources/TestCompactionStrat.jar deleted file mode 100644 index 3daa16e2468761487fe4ea3a7399de8302e83b27..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2530 zcmb7G3pA8l8~)tKHKWOl$n{{t47nG%jdACUF@rifHBA^Hml;w+E=`!+e!1puhUgUi za=#{$B#A~iq~ahE8C`x^bj<&^4*r$1)_L~&*80A+-}l*j?e}}$XJhPncp(4?1OiT9 zH9-U000DRbM>NhHVe4e2>1gg`YlU{fAswwY9s|IN>?d8kt0*gJsT?B%ReEEj=(Q8^p3VIX&9JZidf|@ zf*$1KvZ#N5hLXDXA%k^=0C5${tZ3F=dPfw#?o7R+SLx&JQmN#@XWr3XC3a!%ww<*> z=z))@HtlMsa+q%Q4I>A5g5@mezOxYmpI(eb9aaMk+3KjP3ahUSUf;Kp`4daoALUN& zIMhnDg;Ah=#&0gNSzPsq=c2 zr`o4puEf%$-A!tw2E|5UX3`|cHar9&2daSq!s2)C8m%qZ!&+t9xfi^-Od@HZJK48=7 z>7hXL$dx8~>CnhB&oy(E?@G18lj5HBkQJfYYKm{M;>s);{lRBRu#|mS*6zk&(bR~b z8#7rYZ}fW9BUAVf7{D@Iqzn)}4{MFe`G#v6CJ$HkBgS2y^)iFaii`K04_jc*{4&>n zE~dz^t3ce!=`flWMFAlq5329AYwU3MLYAsxdM_+o$(f-E`j!>UrhS#OOjd^}d|c1E zbCrN|WwSAzaM@+5c6DQiQ^MKLdT<|Y)E(5+e%UF(^AX1?%SxyXsT!xN%WTxbtPH7I zQL%y!cW>F0$+=7Z>~p4Yw%q^Np!dwZg{V}ekKep)4O7!k1d7agT9AytqTVe>4RFcA z!%j*S{zvuEtqz0y^OLPDzQV;nhl9+fYdfI&%&Tq{r1mwbiNknYHD0vva`>%Joh?K< zw5^%C_tO|j(cwWGQ?HI**K{kl;j?VW?Z&pGT;mBjjO;jk>_cPNDK#UWikAA-sP|nM zWwRw#O0!65uq01I_luy+STj>Fek4aLzE~+eQKIyNo5;QKj&=How=w)0Ovz6P+@3Jf z{W7ut>q9rg1$<2rSuXVhGBuEH0}{>d(4|Tgtbx5Q@o*&PY!gO+@BqLf|8~hqyX};m z)<2ZoSwbiwA7>wsYbM^d=H?I)FCQE`(ot;kfFi8IV_<&;kxV&q5o+xnof!L)g2S%Ed-x>P9Y@5{?ixm_;o<@t~ zq}s+1L^(gJ zX|xvxpO8KjT}bOZVZyrvdpu<{wLUju8iT;Qofft;B58;fE$esv4#rR7he{!8UD0>f zWdG=%mbJW-U$n+>;l8NT!r$SnFwDLaSh-=CU*|6!pBz-=X!4%VssGUnv@x}r*oU6| z&C<8$_Q@pOGs_o+87i(f-S-Y-Yh+GAu~3sLl4xTETW}=etB8)n-2IvYMO(RF<;Q3- zK`;~~<&8bedYNX9Wc)GDHjYjRtQCUV>Lw5xW74K4b?q3_F|K3~H0uN6c%Bo`qy6r3 zeJz2{(&cV`cF5>wCd=iu`J38`LmAT7ujytOC|W=IB)Y$gjAh;|nRZ8jpTKUUXHZ@m zkIptV3{WifPwI$Cy`&-sYi{OX1;i?h_9w+>>x)%BNCK6JF{W?la#=(ehF6U<6oR?- zT(w!f6d3&Ni@-s{iy7;PzSNphMcs=*vf69G{o)$@DAE)gFUh)Fdx>w z4rRuunSdFrj?7MReaveU$Xs+^l|CwGa-SO8x)wLmJ-{<$I&qCCmmFbs^3}gJTA{cTQ~Fl3t0}E^^Q{k?2TpRtBpwMSE^z~Z$9FLa0RRX9%B^;a ziTAshI1cyY2;rS_+dUAnGw?4f+{&o>zr{J$x~q9&?76rhz?Q9V_hXK&@5F8CX$Gf*c*nHh}GrKwYc6v^q+J5MqKD7nbW?%a!^qj86VHW~^T$Y^&pdj!+_P@*E z6mkow?-}1OE`OKEDeM;fb|!8s^VVj6ROl^+f?XK?duPJf^KJgH03fhAzHkA+&}J|I F{0ZjtsWt!r From 1b285f4d0469c91c3ee2a055bd6ea4de190cd98b Mon Sep 17 00:00:00 2001 From: Christopher Tubbs Date: Tue, 17 Jan 2023 21:22:33 -0500 Subject: [PATCH 7/8] Update and rename src/test/java/org/apache/accumulo/proxy/SelectHalfSelector.java to src/test/java/org/apache/accumulo/proxy/its/SelectHalfSelector.java Fix jar sealing error --- .../org/apache/accumulo/proxy/{ => its}/SelectHalfSelector.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename src/test/java/org/apache/accumulo/proxy/{ => its}/SelectHalfSelector.java (97%) diff --git a/src/test/java/org/apache/accumulo/proxy/SelectHalfSelector.java b/src/test/java/org/apache/accumulo/proxy/its/SelectHalfSelector.java similarity index 97% rename from src/test/java/org/apache/accumulo/proxy/SelectHalfSelector.java rename to src/test/java/org/apache/accumulo/proxy/its/SelectHalfSelector.java index 82f79a22..da695014 100644 --- a/src/test/java/org/apache/accumulo/proxy/SelectHalfSelector.java +++ b/src/test/java/org/apache/accumulo/proxy/its/SelectHalfSelector.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.accumulo.proxy; +package org.apache.accumulo.proxy.its; import java.util.List; import java.util.stream.Collectors; From a31d9c8d8d2881a8f840a8b4f16a2b538e6508db Mon Sep 17 00:00:00 2001 From: Christopher Tubbs Date: Tue, 17 Jan 2023 21:23:41 -0500 Subject: [PATCH 8/8] Update SimpleProxyBase.java Fix jar sealing import --- src/test/java/org/apache/accumulo/proxy/its/SimpleProxyBase.java | 1 - 1 file changed, 1 deletion(-) 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 7917ea72..e542fa35 100644 --- a/src/test/java/org/apache/accumulo/proxy/its/SimpleProxyBase.java +++ b/src/test/java/org/apache/accumulo/proxy/its/SimpleProxyBase.java @@ -78,7 +78,6 @@ import org.apache.accumulo.miniclusterImpl.MiniAccumuloClusterImpl; import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl; import org.apache.accumulo.proxy.Proxy; -import org.apache.accumulo.proxy.SelectHalfSelector; import org.apache.accumulo.proxy.thrift.AccumuloProxy.Client; import org.apache.accumulo.proxy.thrift.AccumuloSecurityException; import org.apache.accumulo.proxy.thrift.ActiveCompaction;