Title: Apache Accumulo Isolation Example Notice: 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.
Accumulo has an isolated scanner that ensures partial changes to rows are not seen. Isolation is documented in ../docs/isolation.html and the user manual.
InterferenceTest is a simple example that shows the effects of scanning with and without isolation. This program starts two threads. One threads continually upates all of the values in a row to be the same thing, but different from what it used to be. The other thread continually scans the table and checks that all values in a row are the same. Without isolation the scanning thread will sometimes see different values, which is the result of reading the row at the same time a mutation is changing the row.
Below, Interference Test is run without isolation enabled for 5000 iterations and it reports problems.
$ ./bin/accumulo org.apache.accumulo.examples.simple.isolation.InterferenceTest -i instance -z zookeepers -u username -p password -t isotest --iterations 5000 ERROR Columns in row 053 had multiple values [53, 4553] ERROR Columns in row 061 had multiple values [561, 61] ERROR Columns in row 070 had multiple values [570, 1070] ERROR Columns in row 079 had multiple values [1079, 1579] ERROR Columns in row 088 had multiple values [2588, 1588] ERROR Columns in row 106 had multiple values [2606, 3106] ERROR Columns in row 115 had multiple values [4615, 3115] finished
Below, Interference Test is run with isolation enabled for 5000 iterations and it reports no problems.
$ ./bin/accumulo org.apache.accumulo.examples.simple.isolation.InterferenceTest -i instance -z zookeepers -u username -p password -t isotest --iterations 5000 --isolated finished