blob: e050102ccdeddff0418f39e0cc9e890bfcfe0f17 [file] [log] [blame]
/*
* 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.examples.bloom;
import static org.apache.accumulo.examples.bloom.BloomFilters.writeData;
import org.apache.accumulo.core.client.Accumulo;
import org.apache.accumulo.core.client.AccumuloClient;
import org.apache.accumulo.core.client.AccumuloException;
import org.apache.accumulo.core.client.AccumuloSecurityException;
import org.apache.accumulo.core.client.TableNotFoundException;
import org.apache.accumulo.examples.Common;
import org.apache.accumulo.examples.cli.ClientOpts;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class BloomFiltersNotFound {
private static final Logger log = LoggerFactory.getLogger(BloomFiltersNotFound.class);
public static void main(String[] args)
throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
ClientOpts opts = new ClientOpts();
opts.parseArgs(BloomFiltersNotFound.class.getName(), args);
try (AccumuloClient client = Accumulo.newClient().from(opts.getClientPropsPath()).build()) {
Common.createTableWithNamespace(client, BloomCommon.BLOOM_TEST3_TABLE);
Common.createTableWithNamespace(client, BloomCommon.BLOOM_TEST4_TABLE);
client.tableOperations().setProperty(BloomCommon.BLOOM_TEST4_TABLE,
BloomCommon.BLOOM_ENABLED_PROPERTY, "true");
writeAndFlush(BloomCommon.BLOOM_TEST3_TABLE, client);
writeAndFlush(BloomCommon.BLOOM_TEST4_TABLE, client);
BloomBatchScanner.scan(client, BloomCommon.BLOOM_TEST3_TABLE, 8);
BloomBatchScanner.scan(client, BloomCommon.BLOOM_TEST4_TABLE, 8);
}
}
private static void writeAndFlush(String tableName, AccumuloClient client)
throws TableNotFoundException, AccumuloException, AccumuloSecurityException {
log.info("Writing data to {} (bloom filters enabled)", tableName);
writeData(client, tableName, 7);
client.tableOperations().flush(tableName, null, null, true);
}
}