本文整理汇总了Java中org.apache.accumulo.core.client.MutationsRejectedException类的典型用法代码示例。如果您正苦于以下问题:Java MutationsRejectedException类的具体用法?Java MutationsRejectedException怎么用?Java MutationsRejectedException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MutationsRejectedException类属于org.apache.accumulo.core.client包,在下文中一共展示了MutationsRejectedException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testIsDocumentIngested
import org.apache.accumulo.core.client.MutationsRejectedException; //导入依赖的package包/类
/**
* Test method for {@link edu.jhu.hlt.rebar.accumulo.CleanIngester#isDocumentIngested(edu.jhu.hlt.concrete.Communication)}.
*
* @throws RebarException
* @throws TableNotFoundException
* @throws MutationsRejectedException
*/
@Test
public void testIsDocumentIngested() throws RebarException, TableNotFoundException, MutationsRejectedException {
assertFalse(cr.exists("bar"));
Communication c = generateMockDocument();
Communication c2 = generateMockDocument();
c.startTime = 39595830;
c2.startTime = 395958301;
assertFalse(cr.exists(c));
ci.ingest(c);
assertTrue(cr.exists(c));
assertFalse(cr.exists("bar"));
ci.ingest(c);
ci.ingest(c2);
assertTrue(cr.exists(c));
assertTrue(cr.exists(c2));
}
示例2: processSinglePathWithByteBuffer
import org.apache.accumulo.core.client.MutationsRejectedException; //导入依赖的package包/类
private void processSinglePathWithByteBuffer(BatchWriter writer, FileMapping mapping, Path p, CsvParser parser) throws IOException, MutationsRejectedException {
final FileSystem fs = p.getFileSystem(conf);
FSDataInputStream dis = fs.open(p, INPUT_BUFFER_SIZE);
InputStreamReader reader = new InputStreamReader(dis, UTF_8);
try {
parser.beginParsing(reader);
String[] line = null;
while ((line = parser.parseNext()) != null) {
writer.addMutation(parseLine(mapping, line));
}
} finally {
if (null != reader) {
reader.close();
}
}
}
示例3: accept
import org.apache.accumulo.core.client.MutationsRejectedException; //导入依赖的package包/类
@Override
/**
* Processes a record by extracting its field map and converting
* it into a list of Mutations into Accumulo.
*/
public void accept(FieldMappable record)
throws IOException, ProcessingException {
Map<String, Object> fields = record.getFieldMap();
Iterable<Mutation> putList = mutationTransformer.getMutations(fields);
if (null != putList) {
for (Mutation m : putList) {
try {
this.table.addMutation(m);
} catch (MutationsRejectedException ex) {
throw new IOException("Mutation rejected" , ex);
}
}
}
}
示例4: writeRandomEntries
import org.apache.accumulo.core.client.MutationsRejectedException; //导入依赖的package包/类
/**
* Write random entries.
* <p>
* Closes the writer after entries are written.
*
* @param writer
* Writer to write entries to.
*/
void writeRandomEntries(BatchWriter writer) throws MutationsRejectedException {
for (int i = 0; i < rowCount; i++) {
byte[] row = getRandomBytes(keyFieldSize, true);
for (int j = 0; j < columnCount; j++) {
byte[] colF = getRandomBytes(keyFieldSize, true);
byte[] colQ = getRandomBytes(keyFieldSize, true);
byte[] value = getRandomBytes(valueFieldSize, false);
Mutation mutation = new Mutation(row);
mutation.put(colF, colQ, VISIBILITY, value);
writer.addMutation(mutation);
}
}
writer.close();
}
示例5: writeData
import org.apache.accumulo.core.client.MutationsRejectedException; //导入依赖的package包/类
/**
* Writes the given data to Accumulo. The full combinatorial of values is written.
*
* @param rows
* Rows to write.
* @param colFs
* Column families to write.
* @param colQs
* Column qualifiers to write.
* @param colVs
* Column visibilities to write.
* @param values
* Values to write.
*/
private static void writeData(BatchWriter writer, Iterable<String> rows, Iterable<String> colFs, Iterable<String> colQs, Iterable<String> colVs,
Iterable<String> values) throws MutationsRejectedException {
List<Mutation> mutations = new ArrayList<>();
for (String row : rows) {
Mutation mutation = new Mutation(row);
mutations.add(mutation);
for (String colF : colFs) {
for (String colQ : colQs) {
for (String colV : colVs) {
for (String value : values) {
mutation.put(colF, colQ, new ColumnVisibility(colV), value);
}
}
}
}
}
writer.addMutations(mutations);
writer.flush();
}
示例6: main
import org.apache.accumulo.core.client.MutationsRejectedException; //导入依赖的package包/类
public static void main(String[] args) throws AccumuloException, AccumuloSecurityException, MutationsRejectedException, TableExistsException,
TableNotFoundException {
ClientOnRequiredTable opts = new ClientOnRequiredTable();
BatchWriterOpts bwOpts = new BatchWriterOpts();
opts.parseArgs(InsertWithBatchWriter.class.getName(), args, bwOpts);
Connector connector = opts.getConnector();
MultiTableBatchWriter mtbw = connector.createMultiTableBatchWriter(bwOpts.getBatchWriterConfig());
if (!connector.tableOperations().exists(opts.getTableName()))
connector.tableOperations().create(opts.getTableName());
BatchWriter bw = mtbw.getBatchWriter(opts.getTableName());
Text colf = new Text("colfam");
System.out.println("writing ...");
for (int i = 0; i < 10000; i++) {
Mutation m = new Mutation(new Text(String.format("row_%d", i)));
for (int j = 0; j < 5; j++) {
m.put(colf, new Text(String.format("colqual_%d", j)), new Value((String.format("value_%d_%d", i, j)).getBytes()));
}
bw.addMutation(m);
if (i % 100 == 0)
System.out.println(i);
}
mtbw.close();
}
示例7: main
import org.apache.accumulo.core.client.MutationsRejectedException; //导入依赖的package包/类
/**
* Writes a specified number of entries to Accumulo using a {@link BatchWriter}. The rows of the entries will be sequential starting at a specified number.
* The column families will be "foo" and column qualifiers will be "1". The values will be random byte arrays of a specified size.
*/
public static void main(String[] args) throws AccumuloException, AccumuloSecurityException, TableNotFoundException, MutationsRejectedException {
Opts opts = new Opts();
BatchWriterOpts bwOpts = new BatchWriterOpts();
opts.parseArgs(SequentialBatchWriter.class.getName(), args, bwOpts);
Connector connector = opts.getConnector();
BatchWriter bw = connector.createBatchWriter(opts.getTableName(), bwOpts.getBatchWriterConfig());
long end = opts.start + opts.num;
for (long i = opts.start; i < end; i++) {
Mutation m = RandomBatchWriter.createMutation(i, opts.valueSize, opts.vis);
bw.addMutation(m);
}
bw.close();
}
示例8: testMaxMutationConstraint
import org.apache.accumulo.core.client.MutationsRejectedException; //导入依赖的package包/类
@Test
public void testMaxMutationConstraint() throws Exception {
String tableName = getUniqueNames(1)[0];
c.tableOperations().create(tableName);
c.tableOperations().addConstraint(tableName, MaxMutationSize.class.getName());
TestIngest.Opts opts = new TestIngest.Opts();
opts.rows = 1;
opts.cols = 1000;
opts.setTableName(tableName);
opts.setPrincipal(getAdminPrincipal());
try {
TestIngest.ingest(c, opts, bwOpts);
} catch (MutationsRejectedException ex) {
assertEquals(1, ex.getConstraintViolationSummaries().size());
}
}
示例9: deleteRows
import org.apache.accumulo.core.client.MutationsRejectedException; //导入依赖的package包/类
private void deleteRows(BatchWriter writer, List<Key> rowsToDelete, Options options) throws MutationsRejectedException {
rowsToDelete.sort(Comparator.comparingLong(Key::getTimestamp));
int i = 0;
for (Key key : rowsToDelete) {
if (i < rowsToDelete.size() - options.getVersionsToKeep()) {
LOGGER.debug("deleting row: %s", key.getRow().toString());
if (!options.isDryRun()) {
Mutation mutation = new Mutation(key.getRow());
mutation.putDelete(
key.getColumnFamily(),
key.getColumnQualifier(),
key.getColumnVisibilityParsed(),
key.getTimestamp()
);
writer.addMutation(mutation);
}
} else {
if (options.isDryRun()) {
LOGGER.debug("skipping row: %s", key.getRow().toString());
}
}
i++;
}
}
示例10: storeAggregate
import org.apache.accumulo.core.client.MutationsRejectedException; //导入依赖的package包/类
@Override
public void storeAggregate()
{
try {
for (T tuple : tuples) {
Mutation mutation = operationMutation(tuple);
store.getBatchwriter().addMutation(mutation);
}
store.getBatchwriter().flush();
} catch (MutationsRejectedException e) {
logger.error("unable to write mutations", e);
DTThrowable.rethrow(e);
}
tuples.clear();
}
示例11: storeCommittedWindowId
import org.apache.accumulo.core.client.MutationsRejectedException; //导入依赖的package包/类
@Override
public void storeCommittedWindowId(String appId, int operatorId,long windowId)
{
byte[] WindowIdBytes = toBytes(windowId);
String columnKey = appId + "_" + operatorId + "_" + lastWindowColumnName;
lastWindowColumnBytes = columnKey.getBytes();
Mutation mutation = new Mutation(rowBytes);
mutation.put(columnFamilyBytes, lastWindowColumnBytes, WindowIdBytes);
try {
batchwriter.addMutation(mutation);
batchwriter.flush();
} catch (MutationsRejectedException e) {
logger.error("error getting committed window id", e);
DTThrowable.rethrow(e);
}
}
示例12: bulkSet
import org.apache.accumulo.core.client.MutationsRejectedException; //导入依赖的package包/类
public void bulkSet(List<TridentTuple> tuples) {
mutations = new ArrayList<Mutation>();
for(TridentTuple tuple : tuples) {
setKVPair(tuple);
Mutation m = new Mutation(_row);
m.put(_cf, _cq, new ColumnVisibility(_cv), _ts, _val);
mutations.add(m);
}
try {
_writer.addMutations(mutations);
_writer.flush();
} catch(MutationsRejectedException e) {
// TODO: This
}
}
示例13: writeMutation
import org.apache.accumulo.core.client.MutationsRejectedException; //导入依赖的package包/类
private void writeMutation(BatchWriter writer, List<ColumnReference> columns, List<Expression> values) throws MutationsRejectedException {
byte[] rowId = getRowId(columns, values);
for (int i = 0; i < columns.size(); i++) {
Column column = columns.get(i).getMetadataObject();
if (SQLStringVisitor.getRecordName(column).equalsIgnoreCase(AccumuloMetadataProcessor.ROWID)) {
continue;
}
Object value = values.get(i);
if (value instanceof Literal) {
writer.addMutation(buildMutation(rowId, column, ((Literal)value).getValue()));
}
else {
writer.addMutation(buildMutation(rowId, column, value));
}
}
}
示例14: checkExceptions
import org.apache.accumulo.core.client.MutationsRejectedException; //导入依赖的package包/类
private void checkExceptions(List<MutationsRejectedException> mres) throws MutationsRejectedException {
if (mres == null || mres.isEmpty()) {
return;
}
List<ConstraintViolationSummary> cvsList = new LinkedList<ConstraintViolationSummary>();
HashMap<KeyExtent,Set<SecurityErrorCode>> map = new HashMap<KeyExtent,Set<SecurityErrorCode>>();
Collection<String> serverSideErrors = new LinkedList<String>();
int unknownErrors = 0;
for (MutationsRejectedException mre : mres) {
cvsList.addAll(mre.getConstraintViolationSummaries());
map.putAll(mre.getAuthorizationFailuresMap());
serverSideErrors.addAll(mre.getErrorServers());
unknownErrors += mre.getUnknownExceptions();
}
throw new MutationsRejectedException(null, cvsList, map, serverSideErrors, unknownErrors, null);
}
示例15: register
import org.apache.accumulo.core.client.MutationsRejectedException; //导入依赖的package包/类
@Override
public void register(Store id) throws TableNotFoundException, MutationsRejectedException, UnexpectedStateException {
checkNotNull(id);
Stopwatch sw = new Stopwatch().start();
try {
State s = PersistedStores.getState(id);
if (!State.UNKNOWN.equals(s)) {
UnexpectedStateException e = unexpectedState(id, State.UNKNOWN, s);
log.error(e.getMessage());
throw e;
}
State targetState = State.LOADING;
log.debug("Setting state for {} from {} to {}", new Object[] {id, s, targetState});
PersistedStores.setState(id, targetState);
} finally {
sw.stop();
id.tracer().addTiming("Cosmos:register", sw.elapsed(TimeUnit.MILLISECONDS));
}
}