Skip to content

Commit adcd006

Browse files
authored
Update troubleshoot-data-retention-issues-expired-data.md
Adding spaces to correctly align code blocks within lists.
1 parent 3d080dc commit adcd006

File tree

1 file changed

+30
-30
lines changed

1 file changed

+30
-30
lines changed

articles/hdinsight/hbase/troubleshoot-data-retention-issues-expired-data.md

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -18,52 +18,52 @@ To prepare to follow the steps and commands below, open two ssh connections to H
1818
* In one of the ssh sessions keep the default bash shell.
1919
* In the second ssh session launch HBase shell by running the command below.
2020

21-
```
22-
hbase shell
23-
```
21+
```
22+
hbase shell
23+
```
2424

2525
### Check if desired TTL is configured and if expired data is removed from query result
2626

2727
Follow the steps below to understand where is the issue. Start by checking if the behavior occurs for a specific table or for all the tables. If you're unsure whether the issue impacts all the tables or a specific table, just consider as example a specific table name for the start.
2828

2929
1. Check first that TTL has been configured for ColumnFamily for the target tables. Run the command below in the ssh session where you launched HBase shell and observe example and output below. One column family has TTL set to 50 seconds, the other ColumnFamily has no value configured for TTL, thus it appears as "FOREVER" (data in this column family isn't configured to expire).
30-
```
31-
describe 'table_name'
32-
```
30+
```
31+
describe 'table_name'
32+
```
3333

3434
1. If not configured, default TTL is set to 'FOREVER'. There are two possibilities why data is not expired as expected and removed from query result.
3535
1. If TTL has any other value then 'FOREVER', observe the value for column family and note down the value in seconds(pay special attention to value correlated with the unit measure as cell TTL is in ms, but column family TTL is in seconds) to confirm if it is the expected one. If the observed value isn't correct, fix that first.
3636
1. If TTL value is 'FOREVER' for all column families, configure TTL as first step and afterwards monitor if data is expired as expected.
3737
1. If you establish that TTL is configured and has the correct value for the ColumnFamily, next step is to confirm that the expired data no longer shows up when doing table scans. When data expires, it should be removed and not show up in the scan table results. Run the below command in HBase shell to check.
38-
```
39-
scan 'table_name'
40-
```
38+
```
39+
scan 'table_name'
40+
```
4141
### Check the number and size of StoreFiles per table per region to observe if any changes are visible after the compaction operation
4242

4343
1. Before moving to next step, from ssh session with bash shell, run the following command to check the current number of StoreFiles and size for each StoreFile currently showing up for the ColumnFamily for which the TTL has been configured. Note first the table and ColumnFamily for which you'll be doing the check, then run the following command in ssh session (bash).
4444

45-
```
46-
hdfs dfs -ls -R /hbase/data/default/table_name/ | grep "column_family_name"
47-
```
45+
```
46+
hdfs dfs -ls -R /hbase/data/default/table_name/ | grep "column_family_name"
47+
```
4848

4949
1. Likely, there will be more results shown in the output, one result for each region ID that is part of the table and between 0 and more results for StoreFiles present under each region name, for the selected ColumnFamily. To count the overall number of rows in the result output above, run the following command.
50-
```
51-
hdfs dfs -ls -R /hbase/data/default/table_name/ | grep "column_family_name" | wc -l
52-
```
50+
```
51+
hdfs dfs -ls -R /hbase/data/default/table_name/ | grep "column_family_name" | wc -l
52+
```
5353

5454
### Check the number and size of StoreFiles per table per region after flush
5555

5656
1. Based on the TTL configured for each ColumnFamily and how much data is written in the table for the target ColumnFamily, part of the data may still exist in MemStore and isn't written as StoreFile to storage. Thus, to make sure that the data is written to storage as StoreFile, before the maximum configured MemStore size is reached, you can run the following command in HBase shell to write data from MemStore to StoreFile immediately.
5757

58-
```
59-
flush 'table_name'
60-
```
58+
```
59+
flush 'table_name'
60+
```
6161

6262
1. Observe the result by running again in bash shell the command.
6363

64-
```
65-
hdfs dfs -ls -R /hbase/data/default/table_name/ | grep "column_family_name"
66-
```
64+
```
65+
hdfs dfs -ls -R /hbase/data/default/table_name/ | grep "column_family_name"
66+
```
6767

6868
1. An additional store file is created compared to previous result output for each region where data is modified, the StoreFile will include current content of MemStore for that region.
6969

@@ -75,21 +75,21 @@ hdfs dfs -ls -R /hbase/data/default/table_name/ | grep "column_family_name"
7575

7676
1. To make sure expired data is also deleted from storage, we need to run a major compaction operation. The major compaction operation, when completed, will leave behind a single StoreFile per region. In HBase shell, run the command to execute a major compaction operation on the table:
7777

78-
```
79-
major_compact 'table_name'
80-
```
78+
```
79+
major_compact 'table_name'
80+
```
8181

8282
1. Depending on the table size, major compaction operation can take some time. Use the command below in HBase shell to monitor progress. If the compaction is still running when you execute the command below, you'll see the output "MAJOR", but if the compaction is completed, you will see the output "NONE".
8383

84-
```
85-
compaction_state 'table_name'
86-
```
84+
```
85+
compaction_state 'table_name'
86+
```
8787

8888
1. When the compaction status appears as "NONE" in hbase shell, if you switch quickly to bash and run command
8989

90-
```
91-
hdfs dfs -ls -R /hbase/data/default/table_name/ | grep "column_family_name"
92-
```
90+
```
91+
hdfs dfs -ls -R /hbase/data/default/table_name/ | grep "column_family_name"
92+
```
9393
You will notice that an extra StoreFile has been created in addition to previous ones per region per ColumnFamily and after several moments only the last created StoreFile is kept per region per column family.
9494

9595
1. For the example region above, once the extra moments elapse, we can notice that one single StoreFile remained and the size occupied by this file on the storage is reduced as major compaction occurred and at this point any expired data that has not been deleted before(by another major compaction), will be deleted after running current major compaction operation.

0 commit comments

Comments
 (0)