Uploaded image for project: 'HBase'
  1. HBase
  2. HBASE-7782

HBaseTestingUtility.truncateTable() not acting like CLI

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 0.94.3
    • Fix Version/s: 2.0.0
    • Component/s: test
    • Labels:
    • Hadoop Flags:
      Incompatible change, Reviewed
    • Release Note:
      Hide
      HBaseTestingUtility now uses the truncate API added in HBASE-8332 so that calls to HBTU.truncateTable will behave like the shell command: effectively dropping the table and recreating a new one with the same split points.

      Previously, HBTU.truncateTable instead issued deletes for all the data already in the table. If you wish to maintain the same behavior, you should use the newly added HBTU.deleteTableData method.
      Show
      HBaseTestingUtility now uses the truncate API added in HBASE-8332 so that calls to HBTU.truncateTable will behave like the shell command: effectively dropping the table and recreating a new one with the same split points. Previously, HBTU.truncateTable instead issued deletes for all the data already in the table. If you wish to maintain the same behavior, you should use the newly added HBTU.deleteTableData method.

      Description

      I would like to discuss the behavior of the truncateTable() method of HBaseTestingUtility. It's currently only removing the data through a scan/delete pattern.

      However, the truncate command in CLI is doing additional things: it disables the tables, drop, creates (with similar column descriptors) and then enables the table.

      I think the truncateTable() method is misleading; for example I used it to force a coprocessor to be reloaded, but it did not. Of course I can disable and enable the table by myself within my unit test, but perhaps it deserves to be discussed?

        Issue Links

          Activity

          Hide
          stack stack added a comment -

          IMO, they should do the same thing Adrien Mogenet.

          Show
          stack stack added a comment - IMO, they should do the same thing Adrien Mogenet .
          Hide
          jdcryans Jean-Daniel Cryans added a comment -

          IIRC we wrote it because the disable/drop/create cycle is slow. I agree it could be renamed to something like deleteTableData() and have truncateTable() do the same as the shell.

          Show
          jdcryans Jean-Daniel Cryans added a comment - IIRC we wrote it because the disable/drop/create cycle is slow. I agree it could be renamed to something like deleteTableData() and have truncateTable() do the same as the shell.
          Hide
          busbey Sean Busbey added a comment -

          The truncating version of this can be handled with HBASE-8332 now.

          Any preference on wether existing use of HBTU.truncateTable should use the renamed deleteTableData method?

          Show
          busbey Sean Busbey added a comment - The truncating version of this can be handled with HBASE-8332 now. Any preference on wether existing use of HBTU.truncateTable should use the renamed deleteTableData method?
          Hide
          busbey Sean Busbey added a comment -

          patch:

          • preserves current behavior in deleteTableData method
          • updates existing tests to use deleteTableData
          • adds truncateTable methods that behave like the shell.
          Show
          busbey Sean Busbey added a comment - patch: preserves current behavior in deleteTableData method updates existing tests to use deleteTableData adds truncateTable methods that behave like the shell.
          Hide
          mbertozzi Matteo Bertozzi added a comment -

          +1 looks good to me

          Show
          mbertozzi Matteo Bertozzi added a comment - +1 looks good to me
          Hide
          stack stack added a comment -

          Committed to master. Thanks Sean Busbey

          Show
          stack stack added a comment - Committed to master. Thanks Sean Busbey
          Hide
          hudson Hudson added a comment -

          FAILURE: Integrated in HBase-TRUNK #5433 (See https://builds.apache.org/job/HBase-TRUNK/5433/)
          HBASE-7782 HBaseTestingUtility.truncateTable() not acting like CLI (Sean Busbey) (stack: rev aada70053b37c4ac113f12c682ca61964af36847)

          • hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicationSink.java
          • hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
          • hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationChangingPeerRegionservers.java
          • hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationSmallTests.java
          Show
          hudson Hudson added a comment - FAILURE: Integrated in HBase-TRUNK #5433 (See https://builds.apache.org/job/HBase-TRUNK/5433/ ) HBASE-7782 HBaseTestingUtility.truncateTable() not acting like CLI (Sean Busbey) (stack: rev aada70053b37c4ac113f12c682ca61964af36847) hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicationSink.java hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationChangingPeerRegionservers.java hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationSmallTests.java
          Hide
          srikanth235 Srikanth Srungarapu added a comment -

          Any particular reason why this fix is not backported to 1.0+ and 0.98 branches?

          Show
          srikanth235 Srikanth Srungarapu added a comment - Any particular reason why this fix is not backported to 1.0+ and 0.98 branches?
          Hide
          busbey Sean Busbey added a comment -

          Not that I know of. It changes the behavior of HBaseTestingUtility, so I think it wouldn't be okay in a patch release but minor would be fine.

          Show
          busbey Sean Busbey added a comment - Not that I know of. It changes the behavior of HBaseTestingUtility, so I think it wouldn't be okay in a patch release but minor would be fine.
          Hide
          hudson Hudson added a comment -

          FAILURE: Integrated in HBase-1.2 #128 (See https://builds.apache.org/job/HBase-1.2/128/)
          HBASE-13764 Backport HBASE-7782 (HBaseTestingUtility.truncateTable() not acting like CLI) to branch-1.x (ssrungarapu: rev 83d5f31649d36ce4ae100bde3bdd1628631ac135)

          • hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationChangingPeerRegionservers.java
          • hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationSmallTests.java
          • hbase-server/src/test/java/org/apache/hadoop/hbase/mapreduce/TestRowCounter.java
          • hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
          • hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicationSink.java
          Show
          hudson Hudson added a comment - FAILURE: Integrated in HBase-1.2 #128 (See https://builds.apache.org/job/HBase-1.2/128/ ) HBASE-13764 Backport HBASE-7782 (HBaseTestingUtility.truncateTable() not acting like CLI) to branch-1.x (ssrungarapu: rev 83d5f31649d36ce4ae100bde3bdd1628631ac135) hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationChangingPeerRegionservers.java hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationSmallTests.java hbase-server/src/test/java/org/apache/hadoop/hbase/mapreduce/TestRowCounter.java hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicationSink.java
          Hide
          hudson Hudson added a comment -

          FAILURE: Integrated in HBase-1.0 #946 (See https://builds.apache.org/job/HBase-1.0/946/)
          HBASE-13764 Backport HBASE-7782 (HBaseTestingUtility.truncateTable() not acting like CLI) to branch-1.x (ssrungarapu: rev e1d177cb8050fa2f3fce9319b4f6b8b04cd438ec)

          • hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationChangingPeerRegionservers.java
          • hbase-server/src/test/java/org/apache/hadoop/hbase/mapreduce/TestRowCounter.java
          • hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicationSink.java
          • hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
          • hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationSmallTests.java
          Show
          hudson Hudson added a comment - FAILURE: Integrated in HBase-1.0 #946 (See https://builds.apache.org/job/HBase-1.0/946/ ) HBASE-13764 Backport HBASE-7782 (HBaseTestingUtility.truncateTable() not acting like CLI) to branch-1.x (ssrungarapu: rev e1d177cb8050fa2f3fce9319b4f6b8b04cd438ec) hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationChangingPeerRegionservers.java hbase-server/src/test/java/org/apache/hadoop/hbase/mapreduce/TestRowCounter.java hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicationSink.java hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationSmallTests.java
          Hide
          hudson Hudson added a comment -

          SUCCESS: Integrated in HBase-1.1 #523 (See https://builds.apache.org/job/HBase-1.1/523/)
          HBASE-13764 Backport HBASE-7782 (HBaseTestingUtility.truncateTable() not acting like CLI) to branch-1.x (ssrungarapu: rev 77c48846f0163b6e86293bc81ff4597a62bdb5ca)

          • hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicationSink.java
          • hbase-server/src/test/java/org/apache/hadoop/hbase/mapreduce/TestRowCounter.java
          • hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationSmallTests.java
          • hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationChangingPeerRegionservers.java
          • hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
          Show
          hudson Hudson added a comment - SUCCESS: Integrated in HBase-1.1 #523 (See https://builds.apache.org/job/HBase-1.1/523/ ) HBASE-13764 Backport HBASE-7782 (HBaseTestingUtility.truncateTable() not acting like CLI) to branch-1.x (ssrungarapu: rev 77c48846f0163b6e86293bc81ff4597a62bdb5ca) hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicationSink.java hbase-server/src/test/java/org/apache/hadoop/hbase/mapreduce/TestRowCounter.java hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationSmallTests.java hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationChangingPeerRegionservers.java hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java

            People

            • Assignee:
              busbey Sean Busbey
              Reporter:
              cf357 Adrien Mogenet
            • Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development