Author: vines
Date: Mon Jan 7 21:42:34 2013
New Revision: 1430031
URL: http://svn.apache.org/viewvc?rev=1430031&view=rev
Log:
ACCUMULO-670 - now a map of KeyExtent->SecurityErrorCode
Modified:
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/MutationsRejectedException.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchWriter.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormat.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/data/thrift/UpdateErrors.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/master/thrift/TabletServerStatus.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/InsertCommand.java
accumulo/trunk/core/src/main/thrift/data.thrift
accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/client/RandomBatchWriter.java
accumulo/trunk/server/src/main/c++/nativeMap/org_apache_accumulo_server_tabletserver_NativeMap.h
accumulo/trunk/server/src/main/c++/nativeMap/org_apache_accumulo_server_tabletserver_NativeMap_ConcurrentIterator.h
accumulo/trunk/server/src/main/c++/nativeMap/org_apache_accumulo_server_tabletserver_NativeMap_NMEntry.h
accumulo/trunk/server/src/main/c++/nativeMap/org_apache_accumulo_server_tabletserver_NativeMap_NMIterator.h
accumulo/trunk/server/src/main/c++/nativeMap/org_apache_accumulo_server_tabletserver_NativeMap_NMSKVIter.h
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/TestIngest.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/performance/thrift/NullTserver.java
Modified:
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/MutationsRejectedException.java
URL:
http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/MutationsRejectedException.java?rev=1430031&r1=1430030&r2=1430031&view=diff
==============================================================================
---
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/MutationsRejectedException.java
(original)
+++
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/MutationsRejectedException.java
Mon Jan 7 21:42:34 2013
@@ -16,12 +16,15 @@
*/
package org.apache.accumulo.core.client;
-import java.util.ArrayList;
import java.util.Collection;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
+import java.util.Set;
import org.apache.accumulo.core.data.ConstraintViolationSummary;
import org.apache.accumulo.core.data.KeyExtent;
+import org.apache.accumulo.core.security.thrift.SecurityErrorCode;
/**
* Communicate the failed mutations of a BatchWriter back to the client.
@@ -31,26 +34,26 @@ public class MutationsRejectedException
private static final long serialVersionUID = 1L;
private List<ConstraintViolationSummary> cvsl;
- private ArrayList<KeyExtent> af;
+ private Map<KeyExtent,Set<SecurityErrorCode>> af;
private Collection<String> es;
private int unknownErrors;
/**
* @param cvsList
* list of constraint violations
- * @param af
+ * @param hashMap
* authorization failures
* @param serverSideErrors
* server side errors
* @param unknownErrors
* number of unknown errors
*/
- public MutationsRejectedException(List<ConstraintViolationSummary> cvsList,
ArrayList<KeyExtent> af, Collection<String> serverSideErrors, int unknownErrors,
- Throwable cause) {
- super("# constraint violations : " + cvsList.size() + " # authorization
failures : " + af.size() + " # server errors " + serverSideErrors.size()
+ public MutationsRejectedException(List<ConstraintViolationSummary> cvsList,
HashMap<KeyExtent,Set<SecurityErrorCode>> hashMap,
+ Collection<String> serverSideErrors, int unknownErrors, Throwable cause)
{
+ super("# constraint violations : " + cvsList.size() + " security codes: "
+ hashMap.values() + " # server errors " + serverSideErrors.size()
+ " # exceptions " + unknownErrors, cause);
this.cvsl = cvsList;
- this.af = af;
+ this.af = hashMap;
this.es = serverSideErrors;
this.unknownErrors = unknownErrors;
}
@@ -65,7 +68,7 @@ public class MutationsRejectedException
/**
* @return the internal list of authorization failures
*/
- public List<KeyExtent> getAuthorizationFailures() {
+ public Map<KeyExtent,Set<SecurityErrorCode>> getAuthorizationFailures() {
return af;
}
Modified:
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchWriter.java
URL:
http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchWriter.java?rev=1430031&r1=1430030&r2=1430031&view=diff
==============================================================================
---
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchWriter.java
(original)
+++
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchWriter.java
Mon Jan 7 21:42:34 2013
@@ -21,7 +21,6 @@ import java.lang.management.CompilationM
import java.lang.management.GarbageCollectorMXBean;
import java.lang.management.ManagementFactory;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
@@ -60,6 +59,7 @@ import org.apache.accumulo.core.data.thr
import org.apache.accumulo.core.data.thrift.UpdateErrors;
import org.apache.accumulo.core.master.state.tables.TableState;
import org.apache.accumulo.core.security.thrift.AuthInfo;
+import org.apache.accumulo.core.security.thrift.SecurityErrorCode;
import org.apache.accumulo.core.security.thrift.ThriftSecurityException;
import
org.apache.accumulo.core.tabletserver.thrift.ConstraintViolationException;
import org.apache.accumulo.core.tabletserver.thrift.NoSuchScanIDException;
@@ -114,7 +114,7 @@ public class TabletServerBatchWriter {
private AuthInfo credentials;
private Violations violations;
- private HashSet<KeyExtent> authorizationFailures;
+ private Map<KeyExtent,Set<SecurityErrorCode>> authorizationFailures;
private HashSet<String> serverSideErrors;
private int unknownErrors = 0;
private boolean somethingFailed = false;
@@ -124,7 +124,7 @@ public class TabletServerBatchWriter {
private long maxLatency;
private long timeout;
-
+
private long lastProcessingStartTime;
private long totalAdded = 0;
@@ -148,7 +148,7 @@ public class TabletServerBatchWriter {
private Throwable lastUnknownError = null;
private Map<String,TimeoutTracker> timeoutTrackers;
-
+
private static class TimeoutTracker {
String server;
@@ -169,7 +169,7 @@ public class TabletServerBatchWriter {
activityTime = System.currentTimeMillis();
firstErrorTime = null;
}
-
+
void wroteNothing() {
if (firstErrorTime == null) {
firstErrorTime = activityTime;
@@ -181,12 +181,12 @@ public class TabletServerBatchWriter {
void errorOccured(Exception e) {
wroteNothing();
}
-
+
public long getTimeOut() {
return timeOut;
}
}
-
+
public TabletServerBatchWriter(Instance instance, AuthInfo credentials,
BatchWriterConfig config) {
this.instance = instance;
this.maxMem = config.getMaxMemory();
@@ -197,7 +197,7 @@ public class TabletServerBatchWriter {
violations = new Violations();
- authorizationFailures = new HashSet<KeyExtent>();
+ authorizationFailures = new HashMap<KeyExtent,Set<SecurityErrorCode>>();
serverSideErrors = new HashSet<String>();
lastProcessingStartTime = System.currentTimeMillis();
@@ -208,7 +208,7 @@ public class TabletServerBatchWriter {
failedMutations = new FailedMutations();
timeoutTrackers = Collections.synchronizedMap(new
HashMap<String,TabletServerBatchWriter.TimeoutTracker>());
-
+
if (this.maxLatency != Long.MAX_VALUE) {
jtimer.schedule(new TimerTask() {
public void run() {
@@ -461,12 +461,20 @@ public class TabletServerBatchWriter {
}
}
- private void updateAuthorizationFailures(Collection<KeyExtent>
authorizationFailures) {
+ private void updateAuthorizationFailures(Set<KeyExtent> keySet,
SecurityErrorCode code) {
+ HashMap<KeyExtent, SecurityErrorCode> map = new HashMap<KeyExtent,
SecurityErrorCode>();
+ for (KeyExtent ke : keySet)
+ map.put(ke, code);
+
+ updateAuthorizationFailures(map);
+ }
+
+ private void updateAuthorizationFailures(Map<KeyExtent,SecurityErrorCode>
authorizationFailures) {
if (authorizationFailures.size() > 0) {
// was a table deleted?
HashSet<String> tableIds = new HashSet<String>();
- for (KeyExtent ke : authorizationFailures)
+ for (KeyExtent ke : authorizationFailures.keySet())
tableIds.add(ke.getTableId().toString());
Tables.clearCache(instance);
@@ -476,12 +484,23 @@ public class TabletServerBatchWriter {
synchronized (this) {
somethingFailed = true;
- this.authorizationFailures.addAll(authorizationFailures);
+ mergeAuthorizationFailures(this.authorizationFailures,
authorizationFailures);
this.notifyAll();
}
}
}
+ private void
mergeAuthorizationFailures(Map<KeyExtent,Set<SecurityErrorCode>> source,
Map<KeyExtent,SecurityErrorCode> addition) {
+ for (Entry<KeyExtent,SecurityErrorCode> entry : addition.entrySet()) {
+ Set<SecurityErrorCode> secs = source.get(entry.getKey());
+ if (secs == null) {
+ secs = new HashSet<SecurityErrorCode>();
+ source.put(entry.getKey(), secs);
+ }
+ secs.add(entry.getValue());
+ }
+ }
+
private synchronized void updateServerErrors(String server, Exception e) {
somethingFailed = true;
this.serverSideErrors.add(server);
@@ -503,7 +522,7 @@ public class TabletServerBatchWriter {
private void checkForFailures() throws MutationsRejectedException {
if (somethingFailed) {
List<ConstraintViolationSummary> cvsList = violations.asList();
- throw new MutationsRejectedException(cvsList, new
ArrayList<KeyExtent>(authorizationFailures), serverSideErrors, unknownErrors,
lastUnknownError);
+ throw new MutationsRejectedException(cvsList, new
HashMap<KeyExtent,Set<SecurityErrorCode>>(authorizationFailures),
serverSideErrors, unknownErrors, lastUnknownError);
}
}
@@ -610,7 +629,7 @@ public class TabletServerBatchWriter {
return ret;
}
-
+
private void binMutations(MutationSet mutationsToProcess,
Map<String,TabletServerMutations> binnedMutations) {
try {
Set<Entry<String,List<Mutation>>> es =
mutationsToProcess.getMutations().entrySet();
@@ -643,7 +662,7 @@ public class TabletServerBatchWriter {
// assume an IOError communicating with !METADATA tablet
failedMutations.add(mutationsToProcess);
} catch (AccumuloSecurityException e) {
- updateAuthorizationFailures(Collections.singletonList(new
KeyExtent(new Text(Constants.METADATA_TABLE_ID), null, null)));
+ updateAuthorizationFailures(Collections.singletonMap(new KeyExtent(new
Text(Constants.METADATA_TABLE_ID), null, null), e.getErrorCode()));
} catch (TableDeletedException e) {
updateUnknownErrors(e.getMessage(), e);
} catch (TableOfflineException e) {
@@ -767,7 +786,7 @@ public class TabletServerBatchWriter {
timeoutTracker = new TimeoutTracker(location, timeout);
timeoutTrackers.put(location, timeoutTracker);
}
-
+
long st1 = System.currentTimeMillis();
failures = sendMutationsToTabletServer(location, mutationBatch,
timeoutTracker);
long st2 = System.currentTimeMillis();
@@ -812,8 +831,7 @@ public class TabletServerBatchWriter {
}
private MutationSet sendMutationsToTabletServer(String location,
Map<KeyExtent,List<Mutation>> tabMuts, TimeoutTracker timeoutTracker) throws
IOException,
- AccumuloSecurityException,
- AccumuloServerException {
+ AccumuloSecurityException, AccumuloServerException {
if (tabMuts.size() == 0) {
return new MutationSet();
}
@@ -821,7 +839,7 @@ public class TabletServerBatchWriter {
TTransport transport = null;
timeoutTracker.startingWrite();
-
+
try {
TabletClientService.Iface client;
@@ -829,7 +847,7 @@ public class TabletServerBatchWriter {
client = ThriftUtil.getTServerClient(location,
instance.getConfiguration(), timeoutTracker.getTimeOut());
else
client = ThriftUtil.getTServerClient(location,
instance.getConfiguration());
-
+
try {
MutationSet allFailures = new MutationSet();
@@ -867,13 +885,13 @@ public class TabletServerBatchWriter {
}
UpdateErrors updateErrors = client.closeUpdate(tinfo, usid);
-
+
Map<KeyExtent,Long> failures =
Translator.translate(updateErrors.failedExtents, Translator.TKET);
updatedConstraintViolations(Translator.translate(updateErrors.violationSummaries,
Translator.TCVST));
updateAuthorizationFailures(Translator.translate(updateErrors.authorizationFailures,
Translator.TKET));
long totalCommitted = 0;
-
+
for (Entry<KeyExtent,Long> entry : failures.entrySet()) {
KeyExtent failedExtent = entry.getKey();
int numCommitted = (int) (long) entry.getValue();
@@ -906,7 +924,7 @@ public class TabletServerBatchWriter {
updateServerErrors(location, tae);
throw new AccumuloServerException(location, tae);
} catch (ThriftSecurityException e) {
- updateAuthorizationFailures(tabMuts.keySet());
+ updateAuthorizationFailures(tabMuts.keySet(), e.code);
throw new AccumuloSecurityException(e.user, e.code, e);
} catch (NoSuchScanIDException e) {
throw new IOException(e);
@@ -916,7 +934,6 @@ public class TabletServerBatchWriter {
ThriftTransportPool.getInstance().returnTransport(transport);
}
}
-
}
// END code for sending mutations to tablet servers using background threads
Modified:
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormat.java
URL:
http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormat.java?rev=1430031&r1=1430030&r2=1430031&view=diff
==============================================================================
---
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormat.java
(original)
+++
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormat.java
Mon Jan 7 21:42:34 2013
@@ -19,6 +19,8 @@ package org.apache.accumulo.core.client.
import java.io.IOException;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.Map.Entry;
+import java.util.Set;
import java.util.concurrent.TimeUnit;
import org.apache.accumulo.core.client.AccumuloException;
@@ -37,6 +39,7 @@ import org.apache.accumulo.core.data.Col
import org.apache.accumulo.core.data.KeyExtent;
import org.apache.accumulo.core.data.Mutation;
import org.apache.accumulo.core.security.ColumnVisibility;
+import org.apache.accumulo.core.security.thrift.SecurityErrorCode;
import org.apache.accumulo.core.util.ArgumentChecker;
import org.apache.commons.codec.binary.Base64;
import org.apache.hadoop.conf.Configuration;
@@ -137,7 +140,7 @@ public class AccumuloOutputFormat extend
/**
* see {@link BatchWriterConfig#setMaxMemory(long)}
*/
-
+
public static void setMaxMutationBufferSize(Configuration conf, long
numberOfBytes) {
conf.setLong(MAX_MUTATION_BUFFER_SIZE, numberOfBytes);
}
@@ -145,7 +148,7 @@ public class AccumuloOutputFormat extend
/**
* see {@link BatchWriterConfig#setMaxLatency(long, TimeUnit)}
*/
-
+
public static void setMaxLatency(Configuration conf, int
numberOfMilliseconds) {
conf.setInt(MAX_LATENCY, numberOfMilliseconds);
}
@@ -153,7 +156,7 @@ public class AccumuloOutputFormat extend
/**
* see {@link BatchWriterConfig#setMaxWriteThreads(int)}
*/
-
+
public static void setMaxWriteThreads(Configuration conf, int
numberOfThreads) {
conf.setInt(NUM_WRITE_THREADS, numberOfThreads);
}
@@ -165,7 +168,7 @@ public class AccumuloOutputFormat extend
public static void setTimeout(Configuration conf, long time, TimeUnit
timeUnit) {
conf.setLong(TIMEOUT, timeUnit.toMillis(time));
}
-
+
public static void setLogLevel(Configuration conf, Level level) {
ArgumentChecker.notNull(level);
conf.setInt(LOGLEVEL, level.toInt());
@@ -216,7 +219,7 @@ public class AccumuloOutputFormat extend
protected static long getTimeout(Configuration conf) {
return conf.getLong(TIMEOUT, Long.MAX_VALUE);
}
-
+
protected static Level getLogLevel(Configuration conf) {
if (conf.get(LOGLEVEL) != null)
return Level.toLevel(conf.getInt(LOGLEVEL, Level.INFO.toInt()));
@@ -366,9 +369,14 @@ public class AccumuloOutputFormat extend
mtbw.close();
} catch (MutationsRejectedException e) {
if (e.getAuthorizationFailures().size() >= 0) {
- HashSet<String> tables = new HashSet<String>();
- for (KeyExtent ke : e.getAuthorizationFailures()) {
- tables.add(ke.getTableId().toString());
+ HashMap<String,Set<SecurityErrorCode>> tables = new
HashMap<String,Set<SecurityErrorCode>>();
+ for (Entry<KeyExtent,Set<SecurityErrorCode>> ke :
e.getAuthorizationFailures().entrySet()) {
+ Set<SecurityErrorCode> secCodes =
tables.get(ke.getKey().getTableId().toString());
+ if (secCodes == null) {
+ secCodes = new HashSet<SecurityErrorCode>();
+ tables.put(ke.getKey().getTableId().toString(), secCodes);
+ }
+ secCodes.addAll(ke.getValue());
}
log.error("Not authorized to write to tables : " + tables);
Modified:
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/data/thrift/UpdateErrors.java
URL:
http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/data/thrift/UpdateErrors.java?rev=1430031&r1=1430030&r2=1430031&view=diff
==============================================================================
---
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/data/thrift/UpdateErrors.java
(original)
+++
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/data/thrift/UpdateErrors.java
Mon Jan 7 21:42:34 2013
@@ -51,7 +51,7 @@ import org.slf4j.LoggerFactory;
private static final org.apache.thrift.protocol.TField
FAILED_EXTENTS_FIELD_DESC = new
org.apache.thrift.protocol.TField("failedExtents",
org.apache.thrift.protocol.TType.MAP, (short)1);
private static final org.apache.thrift.protocol.TField
VIOLATION_SUMMARIES_FIELD_DESC = new
org.apache.thrift.protocol.TField("violationSummaries",
org.apache.thrift.protocol.TType.LIST, (short)2);
- private static final org.apache.thrift.protocol.TField
AUTHORIZATION_FAILURES_FIELD_DESC = new
org.apache.thrift.protocol.TField("authorizationFailures",
org.apache.thrift.protocol.TType.LIST, (short)3);
+ private static final org.apache.thrift.protocol.TField
AUTHORIZATION_FAILURES_FIELD_DESC = new
org.apache.thrift.protocol.TField("authorizationFailures",
org.apache.thrift.protocol.TType.MAP, (short)3);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes =
new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
@@ -61,7 +61,7 @@ import org.slf4j.LoggerFactory;
public Map<TKeyExtent,Long> failedExtents; // required
public List<TConstraintViolationSummary> violationSummaries; // required
- public List<TKeyExtent> authorizationFailures; // required
+ public
Map<TKeyExtent,org.apache.accumulo.core.security.thrift.SecurityErrorCode>
authorizationFailures; // required
/** The set of fields this struct contains, along with convenience methods
for finding and manipulating them. */
@SuppressWarnings("all") public enum _Fields implements
org.apache.thrift.TFieldIdEnum {
@@ -139,8 +139,9 @@ import org.slf4j.LoggerFactory;
new
org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
new
org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT,
TConstraintViolationSummary.class))));
tmpMap.put(_Fields.AUTHORIZATION_FAILURES, new
org.apache.thrift.meta_data.FieldMetaData("authorizationFailures",
org.apache.thrift.TFieldRequirementType.DEFAULT,
- new
org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
- new
org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT,
TKeyExtent.class))));
+ new
org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP,
+ new
org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT,
TKeyExtent.class),
+ new
org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM,
org.apache.accumulo.core.security.thrift.SecurityErrorCode.class))));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(UpdateErrors.class,
metaDataMap);
}
@@ -151,7 +152,7 @@ import org.slf4j.LoggerFactory;
public UpdateErrors(
Map<TKeyExtent,Long> failedExtents,
List<TConstraintViolationSummary> violationSummaries,
- List<TKeyExtent> authorizationFailures)
+ Map<TKeyExtent,org.apache.accumulo.core.security.thrift.SecurityErrorCode>
authorizationFailures)
{
this();
this.failedExtents = failedExtents;
@@ -186,9 +187,17 @@ import org.slf4j.LoggerFactory;
this.violationSummaries = __this__violationSummaries;
}
if (other.isSetAuthorizationFailures()) {
- List<TKeyExtent> __this__authorizationFailures = new
ArrayList<TKeyExtent>();
- for (TKeyExtent other_element : other.authorizationFailures) {
- __this__authorizationFailures.add(new TKeyExtent(other_element));
+
Map<TKeyExtent,org.apache.accumulo.core.security.thrift.SecurityErrorCode>
__this__authorizationFailures = new
HashMap<TKeyExtent,org.apache.accumulo.core.security.thrift.SecurityErrorCode>();
+ for (Map.Entry<TKeyExtent,
org.apache.accumulo.core.security.thrift.SecurityErrorCode> other_element :
other.authorizationFailures.entrySet()) {
+
+ TKeyExtent other_element_key = other_element.getKey();
+ org.apache.accumulo.core.security.thrift.SecurityErrorCode
other_element_value = other_element.getValue();
+
+ TKeyExtent __this__authorizationFailures_copy_key = new
TKeyExtent(other_element_key);
+
+ org.apache.accumulo.core.security.thrift.SecurityErrorCode
__this__authorizationFailures_copy_value = other_element_value;
+
+
__this__authorizationFailures.put(__this__authorizationFailures_copy_key,
__this__authorizationFailures_copy_value);
}
this.authorizationFailures = __this__authorizationFailures;
}
@@ -283,22 +292,18 @@ import org.slf4j.LoggerFactory;
return (this.authorizationFailures == null) ? 0 :
this.authorizationFailures.size();
}
- public java.util.Iterator<TKeyExtent> getAuthorizationFailuresIterator() {
- return (this.authorizationFailures == null) ? null :
this.authorizationFailures.iterator();
- }
-
- public void addToAuthorizationFailures(TKeyExtent elem) {
+ public void putToAuthorizationFailures(TKeyExtent key,
org.apache.accumulo.core.security.thrift.SecurityErrorCode val) {
if (this.authorizationFailures == null) {
- this.authorizationFailures = new ArrayList<TKeyExtent>();
+ this.authorizationFailures = new
HashMap<TKeyExtent,org.apache.accumulo.core.security.thrift.SecurityErrorCode>();
}
- this.authorizationFailures.add(elem);
+ this.authorizationFailures.put(key, val);
}
- public List<TKeyExtent> getAuthorizationFailures() {
+ public
Map<TKeyExtent,org.apache.accumulo.core.security.thrift.SecurityErrorCode>
getAuthorizationFailures() {
return this.authorizationFailures;
}
- public UpdateErrors setAuthorizationFailures(List<TKeyExtent>
authorizationFailures) {
+ public UpdateErrors
setAuthorizationFailures(Map<TKeyExtent,org.apache.accumulo.core.security.thrift.SecurityErrorCode>
authorizationFailures) {
this.authorizationFailures = authorizationFailures;
return this;
}
@@ -340,7 +345,7 @@ import org.slf4j.LoggerFactory;
if (value == null) {
unsetAuthorizationFailures();
} else {
- setAuthorizationFailures((List<TKeyExtent>)value);
+
setAuthorizationFailures((Map<TKeyExtent,org.apache.accumulo.core.security.thrift.SecurityErrorCode>)value);
}
break;
@@ -592,18 +597,20 @@ import org.slf4j.LoggerFactory;
}
break;
case 3: // AUTHORIZATION_FAILURES
- if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
+ if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
{
- org.apache.thrift.protocol.TList _list57 =
iprot.readListBegin();
- struct.authorizationFailures = new
ArrayList<TKeyExtent>(_list57.size);
- for (int _i58 = 0; _i58 < _list57.size; ++_i58)
+ org.apache.thrift.protocol.TMap _map57 = iprot.readMapBegin();
+ struct.authorizationFailures = new
HashMap<TKeyExtent,org.apache.accumulo.core.security.thrift.SecurityErrorCode>(2*_map57.size);
+ for (int _i58 = 0; _i58 < _map57.size; ++_i58)
{
- TKeyExtent _elem59; // required
- _elem59 = new TKeyExtent();
- _elem59.read(iprot);
- struct.authorizationFailures.add(_elem59);
+ TKeyExtent _key59; // required
+ org.apache.accumulo.core.security.thrift.SecurityErrorCode
_val60; // required
+ _key59 = new TKeyExtent();
+ _key59.read(iprot);
+ _val60 =
org.apache.accumulo.core.security.thrift.SecurityErrorCode.findByValue(iprot.readI32());
+ struct.authorizationFailures.put(_key59, _val60);
}
- iprot.readListEnd();
+ iprot.readMapEnd();
}
struct.setAuthorizationFailuresIsSet(true);
} else {
@@ -629,10 +636,10 @@ import org.slf4j.LoggerFactory;
oprot.writeFieldBegin(FAILED_EXTENTS_FIELD_DESC);
{
oprot.writeMapBegin(new
org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRUCT,
org.apache.thrift.protocol.TType.I64, struct.failedExtents.size()));
- for (Map.Entry<TKeyExtent, Long> _iter60 :
struct.failedExtents.entrySet())
+ for (Map.Entry<TKeyExtent, Long> _iter61 :
struct.failedExtents.entrySet())
{
- _iter60.getKey().write(oprot);
- oprot.writeI64(_iter60.getValue());
+ _iter61.getKey().write(oprot);
+ oprot.writeI64(_iter61.getValue());
}
oprot.writeMapEnd();
}
@@ -642,9 +649,9 @@ import org.slf4j.LoggerFactory;
oprot.writeFieldBegin(VIOLATION_SUMMARIES_FIELD_DESC);
{
oprot.writeListBegin(new
org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT,
struct.violationSummaries.size()));
- for (TConstraintViolationSummary _iter61 : struct.violationSummaries)
+ for (TConstraintViolationSummary _iter62 : struct.violationSummaries)
{
- _iter61.write(oprot);
+ _iter62.write(oprot);
}
oprot.writeListEnd();
}
@@ -653,12 +660,13 @@ import org.slf4j.LoggerFactory;
if (struct.authorizationFailures != null) {
oprot.writeFieldBegin(AUTHORIZATION_FAILURES_FIELD_DESC);
{
- oprot.writeListBegin(new
org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT,
struct.authorizationFailures.size()));
- for (TKeyExtent _iter62 : struct.authorizationFailures)
+ oprot.writeMapBegin(new
org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRUCT,
org.apache.thrift.protocol.TType.I32, struct.authorizationFailures.size()));
+ for (Map.Entry<TKeyExtent,
org.apache.accumulo.core.security.thrift.SecurityErrorCode> _iter63 :
struct.authorizationFailures.entrySet())
{
- _iter62.write(oprot);
+ _iter63.getKey().write(oprot);
+ oprot.writeI32(_iter63.getValue().getValue());
}
- oprot.writeListEnd();
+ oprot.writeMapEnd();
}
oprot.writeFieldEnd();
}
@@ -693,28 +701,29 @@ import org.slf4j.LoggerFactory;
if (struct.isSetFailedExtents()) {
{
oprot.writeI32(struct.failedExtents.size());
- for (Map.Entry<TKeyExtent, Long> _iter63 :
struct.failedExtents.entrySet())
+ for (Map.Entry<TKeyExtent, Long> _iter64 :
struct.failedExtents.entrySet())
{
- _iter63.getKey().write(oprot);
- oprot.writeI64(_iter63.getValue());
+ _iter64.getKey().write(oprot);
+ oprot.writeI64(_iter64.getValue());
}
}
}
if (struct.isSetViolationSummaries()) {
{
oprot.writeI32(struct.violationSummaries.size());
- for (TConstraintViolationSummary _iter64 : struct.violationSummaries)
+ for (TConstraintViolationSummary _iter65 : struct.violationSummaries)
{
- _iter64.write(oprot);
+ _iter65.write(oprot);
}
}
}
if (struct.isSetAuthorizationFailures()) {
{
oprot.writeI32(struct.authorizationFailures.size());
- for (TKeyExtent _iter65 : struct.authorizationFailures)
+ for (Map.Entry<TKeyExtent,
org.apache.accumulo.core.security.thrift.SecurityErrorCode> _iter66 :
struct.authorizationFailures.entrySet())
{
- _iter65.write(oprot);
+ _iter66.getKey().write(oprot);
+ oprot.writeI32(_iter66.getValue().getValue());
}
}
}
@@ -726,44 +735,46 @@ import org.slf4j.LoggerFactory;
BitSet incoming = iprot.readBitSet(3);
if (incoming.get(0)) {
{
- org.apache.thrift.protocol.TMap _map66 = new
org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRUCT,
org.apache.thrift.protocol.TType.I64, iprot.readI32());
- struct.failedExtents = new HashMap<TKeyExtent,Long>(2*_map66.size);
- for (int _i67 = 0; _i67 < _map66.size; ++_i67)
+ org.apache.thrift.protocol.TMap _map67 = new
org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRUCT,
org.apache.thrift.protocol.TType.I64, iprot.readI32());
+ struct.failedExtents = new HashMap<TKeyExtent,Long>(2*_map67.size);
+ for (int _i68 = 0; _i68 < _map67.size; ++_i68)
{
- TKeyExtent _key68; // required
- long _val69; // required
- _key68 = new TKeyExtent();
- _key68.read(iprot);
- _val69 = iprot.readI64();
- struct.failedExtents.put(_key68, _val69);
+ TKeyExtent _key69; // required
+ long _val70; // required
+ _key69 = new TKeyExtent();
+ _key69.read(iprot);
+ _val70 = iprot.readI64();
+ struct.failedExtents.put(_key69, _val70);
}
}
struct.setFailedExtentsIsSet(true);
}
if (incoming.get(1)) {
{
- org.apache.thrift.protocol.TList _list70 = new
org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT,
iprot.readI32());
- struct.violationSummaries = new
ArrayList<TConstraintViolationSummary>(_list70.size);
- for (int _i71 = 0; _i71 < _list70.size; ++_i71)
+ org.apache.thrift.protocol.TList _list71 = new
org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT,
iprot.readI32());
+ struct.violationSummaries = new
ArrayList<TConstraintViolationSummary>(_list71.size);
+ for (int _i72 = 0; _i72 < _list71.size; ++_i72)
{
- TConstraintViolationSummary _elem72; // required
- _elem72 = new TConstraintViolationSummary();
- _elem72.read(iprot);
- struct.violationSummaries.add(_elem72);
+ TConstraintViolationSummary _elem73; // required
+ _elem73 = new TConstraintViolationSummary();
+ _elem73.read(iprot);
+ struct.violationSummaries.add(_elem73);
}
}
struct.setViolationSummariesIsSet(true);
}
if (incoming.get(2)) {
{
- org.apache.thrift.protocol.TList _list73 = new
org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT,
iprot.readI32());
- struct.authorizationFailures = new
ArrayList<TKeyExtent>(_list73.size);
- for (int _i74 = 0; _i74 < _list73.size; ++_i74)
+ org.apache.thrift.protocol.TMap _map74 = new
org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRUCT,
org.apache.thrift.protocol.TType.I32, iprot.readI32());
+ struct.authorizationFailures = new
HashMap<TKeyExtent,org.apache.accumulo.core.security.thrift.SecurityErrorCode>(2*_map74.size);
+ for (int _i75 = 0; _i75 < _map74.size; ++_i75)
{
- TKeyExtent _elem75; // required
- _elem75 = new TKeyExtent();
- _elem75.read(iprot);
- struct.authorizationFailures.add(_elem75);
+ TKeyExtent _key76; // required
+ org.apache.accumulo.core.security.thrift.SecurityErrorCode _val77;
// required
+ _key76 = new TKeyExtent();
+ _key76.read(iprot);
+ _val77 =
org.apache.accumulo.core.security.thrift.SecurityErrorCode.findByValue(iprot.readI32());
+ struct.authorizationFailures.put(_key76, _val77);
}
}
struct.setAuthorizationFailuresIsSet(true);
Modified:
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/master/thrift/TabletServerStatus.java
URL:
http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/master/thrift/TabletServerStatus.java?rev=1430031&r1=1430030&r2=1430031&view=diff
==============================================================================
---
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/master/thrift/TabletServerStatus.java
(original)
+++
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/master/thrift/TabletServerStatus.java
Mon Jan 7 21:42:34 2013
@@ -1127,7 +1127,7 @@ import org.slf4j.LoggerFactory;
for (int _i1 = 0; _i1 < _map0.size; ++_i1)
{
String _key2; // required
- TableInfo _val3; // required
+ TableInfo _val3; // optional
_key2 = iprot.readString();
_val3 = new TableInfo();
_val3.read(iprot);
Modified:
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/InsertCommand.java
URL:
http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/InsertCommand.java?rev=1430031&r1=1430030&r2=1430031&view=diff
==============================================================================
---
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/InsertCommand.java
(original)
+++
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/InsertCommand.java
Mon Jan 7 21:42:34 2013
@@ -18,6 +18,8 @@ package org.apache.accumulo.core.util.sh
import java.io.IOException;
import java.util.ArrayList;
+import java.util.Map.Entry;
+import java.util.Set;
import java.util.concurrent.TimeUnit;
import org.apache.accumulo.core.client.AccumuloException;
@@ -32,6 +34,7 @@ import org.apache.accumulo.core.data.Key
import org.apache.accumulo.core.data.Mutation;
import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.security.ColumnVisibility;
+import org.apache.accumulo.core.security.thrift.SecurityErrorCode;
import
org.apache.accumulo.core.tabletserver.thrift.ConstraintViolationException;
import org.apache.accumulo.core.util.shell.Shell;
import org.apache.accumulo.core.util.shell.Shell.Command;
@@ -84,8 +87,8 @@ public class InsertCommand extends Comma
if (e.getAuthorizationFailures().isEmpty() == false) {
lines.add(" Authorization Failures:");
}
- for (KeyExtent extent : e.getAuthorizationFailures()) {
- lines.add(" " + extent);
+ for (Entry<KeyExtent,Set<SecurityErrorCode>> entry :
e.getAuthorizationFailures().entrySet()) {
+ lines.add(" " + entry);
}
if (e.getConstraintViolationSummaries().isEmpty() == false) {
lines.add(" Constraint Failures:");
Modified: accumulo/trunk/core/src/main/thrift/data.thrift
URL:
http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/thrift/data.thrift?rev=1430031&r1=1430030&r2=1430031&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/thrift/data.thrift (original)
+++ accumulo/trunk/core/src/main/thrift/data.thrift Mon Jan 7 21:42:34 2013
@@ -17,6 +17,8 @@
namespace java org.apache.accumulo.core.data.thrift
namespace cpp org.apache.accumulo.core.data.thrift
+include "security.thrift"
+
typedef i64 ScanID
typedef i64 UpdateID
@@ -104,7 +106,7 @@ struct TConstraintViolationSummary {
struct UpdateErrors {
1:map<TKeyExtent, i64> failedExtents,
2:list<TConstraintViolationSummary> violationSummaries,
- 3:list<TKeyExtent> authorizationFailures
+ 3:map<TKeyExtent, security.SecurityErrorCode> authorizationFailures
}
struct MapFileInfo {
Modified:
accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/client/RandomBatchWriter.java
URL:
http://svn.apache.org/viewvc/accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/client/RandomBatchWriter.java?rev=1430031&r1=1430030&r2=1430031&view=diff
==============================================================================
---
accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/client/RandomBatchWriter.java
(original)
+++
accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/client/RandomBatchWriter.java
Mon Jan 7 21:42:34 2013
@@ -16,8 +16,11 @@
*/
package org.apache.accumulo.examples.simple.client;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.Random;
+import java.util.Set;
+import java.util.Map.Entry;
import org.apache.accumulo.core.cli.BatchWriterOpts;
import org.apache.accumulo.core.cli.ClientOnRequiredTable;
@@ -31,6 +34,7 @@ import org.apache.accumulo.core.data.Key
import org.apache.accumulo.core.data.Mutation;
import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.security.ColumnVisibility;
+import org.apache.accumulo.core.security.thrift.SecurityErrorCode;
import org.apache.hadoop.io.Text;
import com.beust.jcommander.Parameter;
@@ -145,9 +149,14 @@ public class RandomBatchWriter {
bw.close();
} catch (MutationsRejectedException e) {
if (e.getAuthorizationFailures().size() > 0) {
- HashSet<String> tables = new HashSet<String>();
- for (KeyExtent ke : e.getAuthorizationFailures()) {
- tables.add(ke.getTableId().toString());
+ HashMap<String,Set<SecurityErrorCode>> tables = new
HashMap<String,Set<SecurityErrorCode>>();
+ for (Entry<KeyExtent,Set<SecurityErrorCode>> ke :
e.getAuthorizationFailures().entrySet()) {
+ Set<SecurityErrorCode> secCodes =
tables.get(ke.getKey().getTableId().toString());
+ if (secCodes == null) {
+ secCodes = new HashSet<SecurityErrorCode>();
+ tables.put(ke.getKey().getTableId().toString(), secCodes);
+ }
+ secCodes.addAll(ke.getValue());
}
System.err.println("ERROR : Not authorized to write to tables : " +
tables);
}
Modified:
accumulo/trunk/server/src/main/c++/nativeMap/org_apache_accumulo_server_tabletserver_NativeMap.h
URL:
http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/c%2B%2B/nativeMap/org_apache_accumulo_server_tabletserver_NativeMap.h?rev=1430031&r1=1430030&r2=1430031&view=diff
==============================================================================
---
accumulo/trunk/server/src/main/c++/nativeMap/org_apache_accumulo_server_tabletserver_NativeMap.h
(original)
+++
accumulo/trunk/server/src/main/c++/nativeMap/org_apache_accumulo_server_tabletserver_NativeMap.h
Mon Jan 7 21:42:34 2013
@@ -1,19 +1,3 @@
-/*
-* 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.
-*/
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_apache_accumulo_server_tabletserver_NativeMap */
Modified:
accumulo/trunk/server/src/main/c++/nativeMap/org_apache_accumulo_server_tabletserver_NativeMap_ConcurrentIterator.h
URL:
http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/c%2B%2B/nativeMap/org_apache_accumulo_server_tabletserver_NativeMap_ConcurrentIterator.h?rev=1430031&r1=1430030&r2=1430031&view=diff
==============================================================================
---
accumulo/trunk/server/src/main/c++/nativeMap/org_apache_accumulo_server_tabletserver_NativeMap_ConcurrentIterator.h
(original)
+++
accumulo/trunk/server/src/main/c++/nativeMap/org_apache_accumulo_server_tabletserver_NativeMap_ConcurrentIterator.h
Mon Jan 7 21:42:34 2013
@@ -1,19 +1,3 @@
-/*
-* 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.
-*/
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class
org_apache_accumulo_server_tabletserver_NativeMap_ConcurrentIterator */
Modified:
accumulo/trunk/server/src/main/c++/nativeMap/org_apache_accumulo_server_tabletserver_NativeMap_NMEntry.h
URL:
http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/c%2B%2B/nativeMap/org_apache_accumulo_server_tabletserver_NativeMap_NMEntry.h?rev=1430031&r1=1430030&r2=1430031&view=diff
==============================================================================
---
accumulo/trunk/server/src/main/c++/nativeMap/org_apache_accumulo_server_tabletserver_NativeMap_NMEntry.h
(original)
+++
accumulo/trunk/server/src/main/c++/nativeMap/org_apache_accumulo_server_tabletserver_NativeMap_NMEntry.h
Mon Jan 7 21:42:34 2013
@@ -1,19 +1,3 @@
-/*
-* 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.
-*/
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_apache_accumulo_server_tabletserver_NativeMap_NMEntry
*/
Modified:
accumulo/trunk/server/src/main/c++/nativeMap/org_apache_accumulo_server_tabletserver_NativeMap_NMIterator.h
URL:
http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/c%2B%2B/nativeMap/org_apache_accumulo_server_tabletserver_NativeMap_NMIterator.h?rev=1430031&r1=1430030&r2=1430031&view=diff
==============================================================================
---
accumulo/trunk/server/src/main/c++/nativeMap/org_apache_accumulo_server_tabletserver_NativeMap_NMIterator.h
(original)
+++
accumulo/trunk/server/src/main/c++/nativeMap/org_apache_accumulo_server_tabletserver_NativeMap_NMIterator.h
Mon Jan 7 21:42:34 2013
@@ -1,19 +1,3 @@
-/*
-* 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.
-*/
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class
org_apache_accumulo_server_tabletserver_NativeMap_NMIterator */
Modified:
accumulo/trunk/server/src/main/c++/nativeMap/org_apache_accumulo_server_tabletserver_NativeMap_NMSKVIter.h
URL:
http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/c%2B%2B/nativeMap/org_apache_accumulo_server_tabletserver_NativeMap_NMSKVIter.h?rev=1430031&r1=1430030&r2=1430031&view=diff
==============================================================================
---
accumulo/trunk/server/src/main/c++/nativeMap/org_apache_accumulo_server_tabletserver_NativeMap_NMSKVIter.h
(original)
+++
accumulo/trunk/server/src/main/c++/nativeMap/org_apache_accumulo_server_tabletserver_NativeMap_NMSKVIter.h
Mon Jan 7 21:42:34 2013
@@ -1,19 +1,3 @@
-/*
-* 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.
-*/
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class
org_apache_accumulo_server_tabletserver_NativeMap_NMSKVIter */
Modified:
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java
URL:
http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java?rev=1430031&r1=1430030&r2=1430031&view=diff
==============================================================================
---
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java
(original)
+++
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java
Mon Jan 7 21:42:34 2013
@@ -715,7 +715,7 @@ public class TabletServer extends Abstra
public Tablet currentTablet;
public MapCounter<Tablet> successfulCommits = new MapCounter<Tablet>();
Map<KeyExtent,Long> failures = new HashMap<KeyExtent,Long>();
- HashSet<KeyExtent> authFailures = new HashSet<KeyExtent>();
+ HashMap<KeyExtent, SecurityErrorCode> authFailures = new
HashMap<KeyExtent, SecurityErrorCode>();
public Violations violations;
public AuthInfo credentials;
public long totalUpdates = 0;
@@ -1406,8 +1406,7 @@ public class TabletServer extends Abstra
long t1 = System.currentTimeMillis();
if (us.currentTablet != null &&
us.currentTablet.getExtent().equals(keyExtent))
return;
-
- if (us.currentTablet == null && (us.failures.containsKey(keyExtent) ||
us.authFailures.contains(keyExtent))) {
+ if (us.currentTablet == null && (us.failures.containsKey(keyExtent) ||
us.authFailures.containsKey(keyExtent))) {
// if there were previous failures, then do not accept additional
writes
return;
}
@@ -1416,9 +1415,7 @@ public class TabletServer extends Abstra
// if user has no permission to write to this table, add it to
// the failures list
boolean sameTable = us.currentTablet != null &&
(us.currentTablet.getExtent().getTableId().equals(keyExtent.getTableId()));
- if (sameTable
- ||
authenticator.hasTablePermission(SecurityConstants.getSystemCredentials(),
us.credentials.user, keyExtent.getTableId().toString(),
- TablePermission.WRITE)) {
+ if (sameTable ||
authenticator.hasTablePermission(SecurityConstants.getSystemCredentials(),
us.credentials.user, keyExtent.getTableId().toString(), TablePermission.WRITE))
{
long t2 = System.currentTimeMillis();
us.authTimes.addStat(t2 - t1);
us.currentTablet = onlineTablets.get(keyExtent);
@@ -1436,7 +1433,7 @@ public class TabletServer extends Abstra
long t2 = System.currentTimeMillis();
us.authTimes.addStat(t2 - t1);
us.currentTablet = null;
- us.authFailures.add(keyExtent);
+ us.authFailures.put(keyExtent, SecurityErrorCode.PERMISSION_DENIED);
if (updateMetrics.isEnabled())
updateMetrics.add(TabletServerUpdateMetrics.permissionErrors, 0);
return;
@@ -1446,7 +1443,7 @@ public class TabletServer extends Abstra
long t2 = System.currentTimeMillis();
us.authTimes.addStat(t2 - t1);
us.currentTablet = null;
- us.authFailures.add(keyExtent);
+ us.authFailures.put(keyExtent, e.getErrorCode());
if (updateMetrics.isEnabled())
updateMetrics.add(TabletServerUpdateMetrics.permissionErrors, 0);
return;
@@ -1652,12 +1649,11 @@ public class TabletServer extends Abstra
log.debug(String.format("Violations: %d, first %s occurs %d",
violations.size(), first.violationDescription,
first.numberOfViolatingMutations));
}
if (us.authFailures.size() > 0) {
- KeyExtent first = us.authFailures.iterator().next();
+ KeyExtent first = us.authFailures.keySet().iterator().next();
log.debug(String.format("Authentication Failures: %d, first %s",
us.authFailures.size(), first.toString()));
}
- return new UpdateErrors(Translator.translate(us.failures,
Translator.KET), Translator.translate(violations, Translator.CVST),
Translator.translate(
- us.authFailures, Translator.KET));
+ return new UpdateErrors(Translator.translate(us.failures,
Translator.KET), Translator.translate(violations, Translator.CVST),
Translator.translate(us.authFailures, Translator.KET));
}
@Override
Modified:
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/TestIngest.java
URL:
http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/TestIngest.java?rev=1430031&r1=1430030&r2=1430031&view=diff
==============================================================================
---
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/TestIngest.java
(original)
+++
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/TestIngest.java
Mon Jan 7 21:42:34 2013
@@ -16,7 +16,9 @@
*/
package org.apache.accumulo.server.test;
+import java.util.Map.Entry;
import java.util.Random;
+import java.util.Set;
import java.util.TreeSet;
import org.apache.accumulo.cloudtrace.instrument.Trace;
@@ -39,6 +41,7 @@ import org.apache.accumulo.core.file.Fil
import org.apache.accumulo.core.file.rfile.RFile;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.core.security.ColumnVisibility;
+import org.apache.accumulo.core.security.thrift.SecurityErrorCode;
import org.apache.accumulo.core.trace.DistributedTrace;
import org.apache.accumulo.core.util.CachedConfiguration;
import org.apache.accumulo.fate.zookeeper.ZooReader;
@@ -301,8 +304,8 @@ public class TestIngest {
bw.close();
} catch (MutationsRejectedException e) {
if (e.getAuthorizationFailures().size() > 0) {
- for (KeyExtent ke : e.getAuthorizationFailures()) {
- System.err.println("ERROR : Not authorized to write to : " + ke);
+ for (Entry<KeyExtent,Set<SecurityErrorCode>> entry :
e.getAuthorizationFailures().entrySet()) {
+ System.err.println("ERROR : Not authorized to write to : " +
entry.getKey() + " due to " + entry.getValue());
}
}
Modified:
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/performance/thrift/NullTserver.java
URL:
http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/performance/thrift/NullTserver.java?rev=1430031&r1=1430030&r2=1430031&view=diff
==============================================================================
---
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/performance/thrift/NullTserver.java
(original)
+++
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/performance/thrift/NullTserver.java
Mon Jan 7 21:42:34 2013
@@ -47,6 +47,7 @@ import org.apache.accumulo.core.data.thr
import org.apache.accumulo.core.data.thrift.UpdateErrors;
import org.apache.accumulo.core.master.thrift.TabletServerStatus;
import org.apache.accumulo.core.security.thrift.AuthInfo;
+import org.apache.accumulo.core.security.thrift.SecurityErrorCode;
import org.apache.accumulo.core.security.thrift.ThriftSecurityException;
import org.apache.accumulo.core.tabletserver.thrift.ActiveScan;
import org.apache.accumulo.core.tabletserver.thrift.TabletClientService;
@@ -96,7 +97,7 @@ public class NullTserver {
@Override
public UpdateErrors closeUpdate(TInfo tinfo, long updateID) {
- return new UpdateErrors(new HashMap<TKeyExtent,Long>(), new
ArrayList<TConstraintViolationSummary>(), new ArrayList<TKeyExtent>());
+ return new UpdateErrors(new HashMap<TKeyExtent,Long>(), new
ArrayList<TConstraintViolationSummary>(), new HashMap<TKeyExtent,
SecurityErrorCode>());
}
@Override