You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@carbondata.apache.org by ch...@apache.org on 2017/02/04 02:38:28 UTC

[29/35] incubator-carbondata-site git commit: Updated website for CarbonData release 1.0.0

http://git-wip-us.apache.org/repos/asf/incubator-carbondata-site/blob/0d4cdb1c/content/docs/latest/data-management.html
----------------------------------------------------------------------
diff --git a/content/docs/latest/data-management.html b/content/docs/latest/data-management.html
new file mode 100644
index 0000000..d2758b8
--- /dev/null
+++ b/content/docs/latest/data-management.html
@@ -0,0 +1,180 @@
+<!--
+    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.
+-->
+<!--<script src="../../js/mdNavigation.js" type="text/javascript"></script>-->
+<h1>Data Management</h1><p>This tutorial is going to introduce you to the conceptual details of data management like:</p>
+<ul>
+  <li><a href="#loading-data">Loading Data</a></li>
+  <li><a href="#deleting-data">Deleting Data</a></li>
+  <li><a href="#compacting-data">Compacting Data</a></li>
+  <li><a href="#updating-data">Updating Data</a></li>
+</ul><h2 id="loading-data">Loading Data</h2>
+<ul>
+  <li><strong>Scenario</strong></li>
+</ul><p>After creating a table, you can load data to the table using the <a href="mainpage.html?page=dml">LOAD DATA</a> command. The loaded data is available for querying.  When data load is triggered, the data is encoded in CarbonData format and copied into HDFS CarbonData store path (specified in carbon.properties file)  in compressed, multi dimensional columnar format for quick analysis queries. The same command can be used to load new data or to  update the existing data. Only one data load can be triggered for one table. The high cardinality columns of the dictionary encoding are  automatically recognized and these columns will not be used for dictionary encoding.</p>
+<ul>
+  <li><strong>Procedure</strong></li>
+</ul><p>Data loading is a process that involves execution of multiple steps to read, sort and encode the data in CarbonData store format.  Each step is executed on different threads. After data loading process is complete, the status (success/partial success) is updated to  CarbonData store metadata. The table below lists the possible load status.</p>
+<table class="table table-striped table-bordered">
+  <thead>
+    <tr>
+      <th>Status </th>
+      <th>Description </th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Success </td>
+      <td>All the data is loaded into table and no bad records found. </td>
+    </tr>
+    <tr>
+      <td>Partial Success </td>
+      <td>Data is loaded into table and bad records are found. Bad records are stored at carbon.badrecords.location. </td>
+    </tr>
+  </tbody>
+</table><p>In case of failure, the error will be logged in error log. Details of loads can be seen with <a href="mainpage.html?page=dml">SHOW SEGMENTS</a> command. The show segment command output consists of :</p>
+<ul>
+  <li>SegmentSequenceID</li>
+  <li>START_TIME OF LOAD</li>
+  <li>END_TIME OF LOAD</li>
+  <li>LOAD STATUS</li>
+</ul><p>The latest load will be displayed first in the output.</p><p>Refer to <a href="mainpage.html?page=dml">DML operations on CarbonData</a> for load commands.</p>
+<h2 id="deleting-data">Deleting Data</h2>
+<ul>
+  <li><strong>Scenario</strong></li>
+</ul><p>If you have loaded wrong data into the table, or too many bad records are present and you want to modify and reload the data, you can delete required data loads.  The load can be deleted using the Segment Sequence Id or if the table contains date field then the data can be deleted using the date field.  If there are some specific records that need to be deleted based on some filter condition(s) we can delete by records.</p>
+<ul>
+  <li><strong>Procedure</strong></li>
+</ul><p>The loaded data can be deleted in the following ways:</p>
+<ul>
+  <li><p>Delete by Segment ID</p><p>After you get the segment ID of the segment that you want to delete, execute the DELETE command for the selected segment.  The status of deleted segment is updated to Marked for delete / Marked for Update.</p></li>
+</ul>
+<table class="table table-striped table-bordered">
+  <thead>
+    <tr>
+      <th>SegmentSequenceId </th>
+      <th>Status </th>
+      <th>Load Start Time </th>
+      <th>Load End Time </th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>0 </td>
+      <td>Success </td>
+      <td>2015-11-19 19:14:... </td>
+      <td>2015-11-19 19:14:... </td>
+    </tr>
+    <tr>
+      <td>1 </td>
+      <td>Marked for Update </td>
+      <td>2015-11-19 19:54:... </td>
+      <td>2015-11-19 20:08:... </td>
+    </tr>
+    <tr>
+      <td>2 </td>
+      <td>Marked for Delete </td>
+      <td>2015-11-19 20:25:... </td>
+      <td>2015-11-19 20:49:... </td>
+    </tr>
+  </tbody>
+</table>
+<ul>
+  <li><p>Delete by Date Field</p><p>If the table contains date field, you can delete the data based on a specific date.</p></li>
+  <li><p>Delete by Record</p><p>To delete records from CarbonData table based on some filter Condition(s).</p><p>For delete commands refer to <a href="mainpage.html?page=dml">DML operations on CarbonData</a>.</p></li>
+  <li><p><strong>NOTE</strong>:</p>
+  <ul>
+    <li>When the delete segment DML is called, segment will not be deleted physically from the file system. Instead the segment status will be marked as "Marked for Delete". For the query execution, this deleted segment will be excluded.</li>
+  </ul>
+  <ul>
+    <li>The deleted segment will be deleted physically during the next load operation and only after the maximum query execution time configured using "max.query.execution.time". By default it is 60 minutes.</li>
+  </ul>
+  <ul>
+    <li>If the user wants to force delete the segment physically then he can use CLEAN FILES Command.</li>
+  </ul></li>
+</ul><p>Example :</p><p><code>
+CLEAN FILES FOR TABLE table1
+</code></p><p>This DML will physically delete the segment which are "Marked for delete" immediately.</p>
+<h2 id="compacting-data">Compacting Data</h2>
+<ul>
+  <li><strong>Scenario</strong></li>
+</ul><p>Frequent data ingestion results in several fragmented CarbonData files in the store directory. Since data is sorted only within each load, the indices perform only within each  load. This means that there will be one index for each load and as number of data load increases, the number of indices also increases. As each index works only on one load,  the performance of indices is reduced. CarbonData provides provision for compacting the loads. Compaction process combines several segments into one large segment by merge sorting the data from across the segments. </p>
+<ul>
+  <li><strong>Procedure</strong></li>
+</ul><p>There are two types of compaction Minor and Major compaction.</p>
+<ul>
+  <li><p><strong>Minor Compaction</strong></p><p>In minor compaction the user can specify how many loads to be merged. Minor compaction triggers for every data load if the parameter carbon.enable.auto.load.merge is set. If any segments are available to be merged, then compaction will  run parallel with data load. There are 2 levels in minor compaction.</p>
+  <ul>
+    <li>Level 1: Merging of the segments which are not yet compacted.</li>
+    <li>Level 2: Merging of the compacted segments again to form a bigger segment.</li>
+  </ul></li>
+  <li><p><strong>Major Compaction</strong></p><p>In Major compaction, many segments can be merged into one big segment. User will specify the compaction size until which segments can be merged. Major compaction is usually done during the off-peak time. </p></li>
+</ul><p>There are number of parameters related to Compaction that can be set in carbon.properties file </p>
+<table class="table table-striped table-bordered">
+  <thead>
+    <tr>
+      <th>Parameter </th>
+      <th>Default </th>
+      <th>Application </th>
+      <th>Description </th>
+      <th>Valid Values </th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>carbon.compaction.level.threshold </td>
+      <td>4, 3 </td>
+      <td>Minor </td>
+      <td>This property is for minor compaction which decides how many segments to be merged. Example: If it is set as 2, 3 then minor compaction will be triggered for every 2 segments. 3 is the number of level 1 compacted segment which is further compacted to new segment. </td>
+      <td>NA </td>
+    </tr>
+    <tr>
+      <td>carbon.major.compaction.size </td>
+      <td>1024 MB </td>
+      <td>Major </td>
+      <td>Major compaction size can be configured using this parameter. Sum of the segments which is below this threshold will be merged. </td>
+      <td>NA </td>
+    </tr>
+    <tr>
+      <td>carbon.numberof.preserve.segments </td>
+      <td>0 </td>
+      <td>Minor/Major </td>
+      <td>If the user wants to preserve some number of segments from being compacted then he can set this property. Example: carbon.numberof.preserve.segments=2 then 2 latest segments will always be excluded from the compaction. No segments will be preserved by default. </td>
+      <td>0-100 </td>
+    </tr>
+    <tr>
+      <td>carbon.allowed.compaction.days </td>
+      <td>0 </td>
+      <td>Minor/Major </td>
+      <td>Compaction will merge the segments which are loaded within the specific number of days configured. Example: If the configuration is 2, then the segments which are loaded in the time frame of 2 days only will get merged. Segments which are loaded 2 days apart will not be merged. This is disabled by default. </td>
+      <td>0-100 </td>
+    </tr>
+    <tr>
+      <td>carbon.number.of.cores.while.compacting </td>
+      <td>2 </td>
+      <td>Minor/Major </td>
+      <td>Number of cores which is used to write data during compaction. </td>
+      <td>0-100 </td>
+    </tr>
+  </tbody>
+</table><p>For compaction commands refer to <a href="mainpage.html?page=dml">DDL operations on CarbonData</a></p>
+<h2 id="updating-data">Updating Data</h2>
+<ul>
+  <li><p><strong>Scenario</strong></p><p>Sometimes after the data has been ingested into the System, it is required to be updated. Also there may be situations where some specific columns need to be updated on the basis of column expression and optional filter conditions.</p></li>
+  <li><p><strong>Procedure</strong></p><p>To update we need to specify the column expression with an optional filter condition(s).</p><p>For update commands refer to <a href="mainpage.html?page=dml">DML operations on CarbonData</a>.</p></li>
+</ul>
\ No newline at end of file