Uploaded image for project: 'Accumulo'
  1. Accumulo
  2. ACCUMULO-2544

Incorrect boundry matching for MockTableOperations.deleteRows

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.5.0, 1.5.1
    • 1.5.2, 1.6.0
    • test
    • Mac OS Mavericks; java 7

    Description

      The api for deleteRows specifies: Delete rows between (start, end] but the current implementation for MockTableOperations.deleteRows is implemented as (start, end)

      Here is the failing test case

      public class TestDelete {
        private static final String INSTANCE = "mock";
        private static final String TABLE = "foo";
        private static final String USER = "user";
        private static final String PASS = "password";
        private static final Authorizations AUTHS = new Authorizations();
      
        @Test
        public void testDelete() throws TableNotFoundException, AccumuloException,
            AccumuloSecurityException, TableExistsException {
      
          MockInstance mockAcc = new MockInstance(INSTANCE);
          Connector conn = mockAcc.getConnector(USER, new PasswordToken(PASS));
          conn.tableOperations().create(TABLE);
          conn.securityOperations().grantTablePermission(USER, TABLE, TablePermission.READ);
          conn.securityOperations().grantTablePermission(USER, TABLE, TablePermission.WRITE);
      
          Mutation mut = new Mutation("2");
          mut.put("colfam", "colqual", "value");
          BatchWriter writer = conn.createBatchWriter(TABLE, new BatchWriterConfig());
          writer.addMutation(mut);
      
          Scanner scan = conn.createScanner(TABLE, AUTHS);
          scan.setRange(new Range("2", "2"));
      
          assertEquals(1, countRecords(scan));
          
          // this should delete (1,2] 
          conn.tableOperations().deleteRows(TABLE, new Text("1"), new Text("2"));
      
          scan = conn.createScanner(TABLE, AUTHS);
          scan.setRange(new Range("2", "2"));
          
          // this will fail if row 2 exists
          assertEquals(0, countRecords(scan));
        }
      
        private int countRecords(Scanner scan) {
          int cnt = 0;
          for (Entry<Key, Value> entry : scan) {
            cnt++;
          }
          scan.close();
          return cnt;
        }
      }
      

      Attachments

        1. ACCUMULO-2544_v2.patch
          3 kB
          Mike Fagan
        2. ACCUMULO-2544_1.5.2.patch
          3 kB
          Mike Fagan
        3. ACCUMULO-2544.patch
          2 kB
          Mike Fagan
        4. ACCUMULO-2544.patch
          2 kB
          Mike Fagan

        Activity

          People

            faganm Mike Fagan
            faganm Mike Fagan
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: