You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by jt...@apache.org on 2005/02/01 00:13:42 UTC
svn commit: r149319 - in incubator/derby/site/trunk: build/site/
build/site/papers/ src/documentation/content/xdocs/
src/documentation/content/xdocs/papers/
Author: jta
Date: Mon Jan 31 15:13:36 2005
New Revision: 149319
URL: http://svn.apache.org/viewcvs?view=rev&rev=149319
Log:
Added Dibyendu Majumdar <di...@mazumdar.demon.co.uk> document on
"Derby On Disk Page Format".
Modified faq.html#createdb_OS_X to clarify that this issue also applies to
modifying an existing database.
Added:
incubator/derby/site/trunk/build/site/papers/alloc-page.png (with props)
incubator/derby/site/trunk/build/site/papers/field-header-non-overflow.png (with props)
incubator/derby/site/trunk/build/site/papers/field-header-overflow.png (with props)
incubator/derby/site/trunk/build/site/papers/page-format.png (with props)
incubator/derby/site/trunk/build/site/papers/pageformats.html
incubator/derby/site/trunk/src/documentation/content/xdocs/papers/alloc-page.aart
incubator/derby/site/trunk/src/documentation/content/xdocs/papers/field-header-non-overflow.aart
incubator/derby/site/trunk/src/documentation/content/xdocs/papers/field-header-overflow.aart
incubator/derby/site/trunk/src/documentation/content/xdocs/papers/page-format.aart
incubator/derby/site/trunk/src/documentation/content/xdocs/papers/pageformats.xml
Modified:
incubator/derby/site/trunk/build/site/faq.html
incubator/derby/site/trunk/build/site/linkmap.html
incubator/derby/site/trunk/build/site/papers/ApacheConUs04.html
incubator/derby/site/trunk/build/site/papers/JDBCImplementation.html
incubator/derby/site/trunk/build/site/papers/MiscPresentations.html
incubator/derby/site/trunk/build/site/papers/derby_arch.html
incubator/derby/site/trunk/build/site/papers/derby_htw.html
incubator/derby/site/trunk/build/site/papers/derby_plugin.html
incubator/derby/site/trunk/build/site/papers/derby_web.html
incubator/derby/site/trunk/build/site/papers/fortune_tut.html
incubator/derby/site/trunk/build/site/papers/index.html
incubator/derby/site/trunk/build/site/papers/misc.html
incubator/derby/site/trunk/src/documentation/content/xdocs/faq.xml
incubator/derby/site/trunk/src/documentation/content/xdocs/papers/index.xml
incubator/derby/site/trunk/src/documentation/content/xdocs/site.xml
Modified: incubator/derby/site/trunk/build/site/faq.html
URL: http://svn.apache.org/viewcvs/incubator/derby/site/trunk/build/site/faq.html?view=diff&r1=149318&r2=149319
==============================================================================
--- incubator/derby/site/trunk/build/site/faq.html (original)
+++ incubator/derby/site/trunk/build/site/faq.html Mon Jan 31 15:13:36 2005
@@ -203,7 +203,8 @@
<ul class="minitoc">
<li>
<a href="#createdb_OS_X">2.1.
- Why can't I create a new database on Mac OS X?
+ Why can't I create a new database or modify an existing database
+ on Mac OS X?
</a>
</li>
<li>
@@ -339,7 +340,8 @@
<h3 class="boxed">2. Using Derby</h3>
<a name="N1005C"></a><a name="createdb_OS_X"></a>
<h4 class="faq">2.1.
- Why can't I create a new database on Mac OS X?
+ Why can't I create a new database or modify an existing database
+ on Mac OS X?
</h4>
<div align="right">
<a href="#createdb_OS_X-menu">^</a>
Modified: incubator/derby/site/trunk/build/site/linkmap.html
URL: http://svn.apache.org/viewcvs/incubator/derby/site/trunk/build/site/linkmap.html?view=diff&r1=149318&r2=149319
==============================================================================
--- incubator/derby/site/trunk/build/site/linkmap.html (original)
+++ incubator/derby/site/trunk/build/site/linkmap.html Mon Jan 31 15:13:36 2005
@@ -156,6 +156,9 @@
<a title="" href="papers/derby_arch.html">Architecture</a>
</div>
<div class="menuitem">
+<a title="" href="papers/pageformats.html">Disk Page Format</a>
+</div>
+<div class="menuitem">
<a title="" href="papers/derby_htw.html">How Things Work</a>
</div>
<div class="menuitem">
@@ -379,6 +382,10 @@
<li>
<a href="papers/derby_arch.html">Architecture</a> _________________________ <em>index</em>
+</li>
+
+<li>
+<a href="papers/pageformats.html">Disk Page Format</a> _________________________ <em>pformat</em>
</li>
<li>
Modified: incubator/derby/site/trunk/build/site/papers/ApacheConUs04.html
URL: http://svn.apache.org/viewcvs/incubator/derby/site/trunk/build/site/papers/ApacheConUs04.html?view=diff&r1=149318&r2=149319
==============================================================================
--- incubator/derby/site/trunk/build/site/papers/ApacheConUs04.html (original)
+++ incubator/derby/site/trunk/build/site/papers/ApacheConUs04.html Mon Jan 31 15:13:36 2005
@@ -117,6 +117,9 @@
<a title="" href="../papers/derby_arch.html">Architecture</a>
</div>
<div class="menuitem">
+<a title="" href="../papers/pageformats.html">Disk Page Format</a>
+</div>
+<div class="menuitem">
<a title="" href="../papers/derby_htw.html">How Things Work</a>
</div>
<div class="menuitem">
Modified: incubator/derby/site/trunk/build/site/papers/JDBCImplementation.html
URL: http://svn.apache.org/viewcvs/incubator/derby/site/trunk/build/site/papers/JDBCImplementation.html?view=diff&r1=149318&r2=149319
==============================================================================
--- incubator/derby/site/trunk/build/site/papers/JDBCImplementation.html (original)
+++ incubator/derby/site/trunk/build/site/papers/JDBCImplementation.html Mon Jan 31 15:13:36 2005
@@ -117,6 +117,9 @@
<a title="" href="../papers/derby_arch.html">Architecture</a>
</div>
<div class="menuitem">
+<a title="" href="../papers/pageformats.html">Disk Page Format</a>
+</div>
+<div class="menuitem">
<a title="" href="../papers/derby_htw.html">How Things Work</a>
</div>
<div class="menupage">
Modified: incubator/derby/site/trunk/build/site/papers/MiscPresentations.html
URL: http://svn.apache.org/viewcvs/incubator/derby/site/trunk/build/site/papers/MiscPresentations.html?view=diff&r1=149318&r2=149319
==============================================================================
--- incubator/derby/site/trunk/build/site/papers/MiscPresentations.html (original)
+++ incubator/derby/site/trunk/build/site/papers/MiscPresentations.html Mon Jan 31 15:13:36 2005
@@ -117,6 +117,9 @@
<a title="" href="../papers/derby_arch.html">Architecture</a>
</div>
<div class="menuitem">
+<a title="" href="../papers/pageformats.html">Disk Page Format</a>
+</div>
+<div class="menuitem">
<a title="" href="../papers/derby_htw.html">How Things Work</a>
</div>
<div class="menuitem">
Added: incubator/derby/site/trunk/build/site/papers/alloc-page.png
URL: http://svn.apache.org/viewcvs/incubator/derby/site/trunk/build/site/papers/alloc-page.png?view=auto&rev=149319
==============================================================================
Binary file - no diff available.
Propchange: incubator/derby/site/trunk/build/site/papers/alloc-page.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Modified: incubator/derby/site/trunk/build/site/papers/derby_arch.html
URL: http://svn.apache.org/viewcvs/incubator/derby/site/trunk/build/site/papers/derby_arch.html?view=diff&r1=149318&r2=149319
==============================================================================
--- incubator/derby/site/trunk/build/site/papers/derby_arch.html (original)
+++ incubator/derby/site/trunk/build/site/papers/derby_arch.html Mon Jan 31 15:13:36 2005
@@ -117,6 +117,9 @@
<div class="menupagetitle">Architecture</div>
</div>
<div class="menuitem">
+<a title="" href="../papers/pageformats.html">Disk Page Format</a>
+</div>
+<div class="menuitem">
<a title="" href="../papers/derby_htw.html">How Things Work</a>
</div>
<div class="menuitem">
Modified: incubator/derby/site/trunk/build/site/papers/derby_htw.html
URL: http://svn.apache.org/viewcvs/incubator/derby/site/trunk/build/site/papers/derby_htw.html?view=diff&r1=149318&r2=149319
==============================================================================
--- incubator/derby/site/trunk/build/site/papers/derby_htw.html (original)
+++ incubator/derby/site/trunk/build/site/papers/derby_htw.html Mon Jan 31 15:13:36 2005
@@ -116,6 +116,9 @@
<div class="menuitem">
<a title="" href="../papers/derby_arch.html">Architecture</a>
</div>
+<div class="menuitem">
+<a title="" href="../papers/pageformats.html">Disk Page Format</a>
+</div>
<div class="menupage">
<div class="menupagetitle">How Things Work</div>
</div>
Modified: incubator/derby/site/trunk/build/site/papers/derby_plugin.html
URL: http://svn.apache.org/viewcvs/incubator/derby/site/trunk/build/site/papers/derby_plugin.html?view=diff&r1=149318&r2=149319
==============================================================================
--- incubator/derby/site/trunk/build/site/papers/derby_plugin.html (original)
+++ incubator/derby/site/trunk/build/site/papers/derby_plugin.html Mon Jan 31 15:13:36 2005
@@ -117,6 +117,9 @@
<a title="" href="../papers/derby_arch.html">Architecture</a>
</div>
<div class="menuitem">
+<a title="" href="../papers/pageformats.html">Disk Page Format</a>
+</div>
+<div class="menuitem">
<a title="" href="../papers/derby_htw.html">How Things Work</a>
</div>
<div class="menuitem">
Modified: incubator/derby/site/trunk/build/site/papers/derby_web.html
URL: http://svn.apache.org/viewcvs/incubator/derby/site/trunk/build/site/papers/derby_web.html?view=diff&r1=149318&r2=149319
==============================================================================
--- incubator/derby/site/trunk/build/site/papers/derby_web.html (original)
+++ incubator/derby/site/trunk/build/site/papers/derby_web.html Mon Jan 31 15:13:36 2005
@@ -117,6 +117,9 @@
<a title="" href="../papers/derby_arch.html">Architecture</a>
</div>
<div class="menuitem">
+<a title="" href="../papers/pageformats.html">Disk Page Format</a>
+</div>
+<div class="menuitem">
<a title="" href="../papers/derby_htw.html">How Things Work</a>
</div>
<div class="menuitem">
Added: incubator/derby/site/trunk/build/site/papers/field-header-non-overflow.png
URL: http://svn.apache.org/viewcvs/incubator/derby/site/trunk/build/site/papers/field-header-non-overflow.png?view=auto&rev=149319
==============================================================================
Binary file - no diff available.
Propchange: incubator/derby/site/trunk/build/site/papers/field-header-non-overflow.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/derby/site/trunk/build/site/papers/field-header-overflow.png
URL: http://svn.apache.org/viewcvs/incubator/derby/site/trunk/build/site/papers/field-header-overflow.png?view=auto&rev=149319
==============================================================================
Binary file - no diff available.
Propchange: incubator/derby/site/trunk/build/site/papers/field-header-overflow.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Modified: incubator/derby/site/trunk/build/site/papers/fortune_tut.html
URL: http://svn.apache.org/viewcvs/incubator/derby/site/trunk/build/site/papers/fortune_tut.html?view=diff&r1=149318&r2=149319
==============================================================================
--- incubator/derby/site/trunk/build/site/papers/fortune_tut.html (original)
+++ incubator/derby/site/trunk/build/site/papers/fortune_tut.html Mon Jan 31 15:13:36 2005
@@ -117,6 +117,9 @@
<a title="" href="../papers/derby_arch.html">Architecture</a>
</div>
<div class="menuitem">
+<a title="" href="../papers/pageformats.html">Disk Page Format</a>
+</div>
+<div class="menuitem">
<a title="" href="../papers/derby_htw.html">How Things Work</a>
</div>
<div class="menuitem">
Modified: incubator/derby/site/trunk/build/site/papers/index.html
URL: http://svn.apache.org/viewcvs/incubator/derby/site/trunk/build/site/papers/index.html?view=diff&r1=149318&r2=149319
==============================================================================
--- incubator/derby/site/trunk/build/site/papers/index.html (original)
+++ incubator/derby/site/trunk/build/site/papers/index.html Mon Jan 31 15:13:36 2005
@@ -117,6 +117,9 @@
<a title="" href="../papers/derby_arch.html">Architecture</a>
</div>
<div class="menuitem">
+<a title="" href="../papers/pageformats.html">Disk Page Format</a>
+</div>
+<div class="menuitem">
<a title="" href="../papers/derby_htw.html">How Things Work</a>
</div>
<div class="menuitem">
@@ -220,6 +223,9 @@
Overview</a>
</li>
+<li>Disk Page Format:<a href="pageformats.html">Derby On Disk Page Format</a>
+</li>
+
<li>
<a href="derby_htw.html">How Things Work</a>
</li>
@@ -232,7 +238,7 @@
</div>
-<a name="N1002E"></a><a name="Integration"></a>
+<a name="N10034"></a><a name="Integration"></a>
<h2 class="boxed">Integration</h2>
<div class="section">
<p> The <a href="misc.html">Summary</a> contains pointers
@@ -264,7 +270,7 @@
</div>
-<a name="N10065"></a><a name="Presentations"></a>
+<a name="N1006B"></a><a name="Presentations"></a>
<h2 class="boxed">Presentations</h2>
<div class="section">
<ul>
@@ -323,7 +329,7 @@
</div>
-<a name="N100CB"></a><a name="How+To%27s"></a>
+<a name="N100D1"></a><a name="How+To%27s"></a>
<h2 class="boxed">How To's</h2>
<div class="section">
<p>
@@ -335,7 +341,7 @@
</div>
-<a name="N100D9"></a><a name="How+to+Contribute+Papers"></a>
+<a name="N100DF"></a><a name="How+to+Contribute+Papers"></a>
<h2 class="boxed">How to Contribute Papers</h2>
<div class="section">
<p>
@@ -408,7 +414,7 @@
<p>
-<em>Last Updated: January 21, 2005</em>
+<em>Last Updated: January 31, 2005</em>
</p>
</div>
Modified: incubator/derby/site/trunk/build/site/papers/misc.html
URL: http://svn.apache.org/viewcvs/incubator/derby/site/trunk/build/site/papers/misc.html?view=diff&r1=149318&r2=149319
==============================================================================
--- incubator/derby/site/trunk/build/site/papers/misc.html (original)
+++ incubator/derby/site/trunk/build/site/papers/misc.html Mon Jan 31 15:13:36 2005
@@ -117,6 +117,9 @@
<a title="" href="../papers/derby_arch.html">Architecture</a>
</div>
<div class="menuitem">
+<a title="" href="../papers/pageformats.html">Disk Page Format</a>
+</div>
+<div class="menuitem">
<a title="" href="../papers/derby_htw.html">How Things Work</a>
</div>
<div class="menuitem">
Added: incubator/derby/site/trunk/build/site/papers/page-format.png
URL: http://svn.apache.org/viewcvs/incubator/derby/site/trunk/build/site/papers/page-format.png?view=auto&rev=149319
==============================================================================
Binary file - no diff available.
Propchange: incubator/derby/site/trunk/build/site/papers/page-format.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/derby/site/trunk/build/site/papers/pageformats.html
URL: http://svn.apache.org/viewcvs/incubator/derby/site/trunk/build/site/papers/pageformats.html?view=auto&rev=149319
==============================================================================
--- incubator/derby/site/trunk/build/site/papers/pageformats.html (added)
+++ incubator/derby/site/trunk/build/site/papers/pageformats.html Mon Jan 31 15:13:36 2005
@@ -0,0 +1,760 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="Apache Forrest" name="Generator">
+<meta name="Forrest-version" content="0.6">
+<meta name="Forrest-skin-name" content="pelt">
+<title>Derby On Disk Page Format</title>
+<link type="text/css" href="../skin/basic.css" rel="stylesheet">
+<link media="screen" type="text/css" href="../skin/screen.css" rel="stylesheet">
+<link media="print" type="text/css" href="../skin/print.css" rel="stylesheet">
+<link type="text/css" href="../skin/profile.css" rel="stylesheet">
+<script src="../skin/getBlank.js" language="javascript" type="text/javascript"></script><script src="../skin/getMenu.js" language="javascript" type="text/javascript"></script><script src="../skin/fontsize.js" language="javascript" type="text/javascript"></script>
+<link rel="shortcut icon" href="../">
+</head>
+<body onload="init()">
+<script type="text/javascript">ndeSetTextSize();</script>
+<div id="top">
+<!--+
+ |breadtrail
+ +-->
+<div class="breadtrail">
+<a href="http://www.apache.org/">apache</a> > <a href="http://incubator.apache.org/">incubator</a><script src="../skin/breadcrumbs.js" language="JavaScript" type="text/javascript"></script>
+</div>
+<!--+
+ |header
+ +-->
+<div class="header">
+<!--+
+ |start group logo
+ +-->
+<div class="grouplogo">
+<a href="http://incubator.apache.org"><img class="logoImage" alt="" src="../images/apache-incubator-logo.png" title=""></a>
+</div>
+<!--+
+ |end group logo
+ +-->
+<!--+
+ |start Project Logo
+ +-->
+<div class="projectlogo">
+<a href="http://incubator.apache.org/derby/"><img class="logoImage" alt="Derby" src="../images/derby-logo.jpg" title="Derby is a zero admin java RDBMS."></a>
+</div>
+<!--+
+ |end Project Logo
+ +-->
+<!--+
+ |start Search
+ +-->
+<div class="searchbox">
+<form action="http://www.google.com/search" method="get" class="roundtopsmall">
+<input value="apache.org" name="sitesearch" type="hidden"><input onFocus="getBlank (this, 'Search the site with google:');" value="Search the site with google:" size="25" name="q" id="query" type="text">
+ <input name="Search" value="Search" type="submit">
+</form>
+</div>
+<!--+
+ |end search
+ +-->
+<!--+
+ |start Tabs
+ +-->
+<ul id="tabs">
+<li>
+<a class="base-not-selected" href="../index.html">Home</a>
+</li>
+<li>
+<a class="base-not-selected" href="../manuals/index.html">Manuals</a>
+</li>
+<li class="current">
+<a class="base-selected" href="../papers/index.html">Papers</a>
+</li>
+</ul>
+<!--+
+ |end Tabs
+ +-->
+</div>
+</div>
+<div id="main">
+<div id="publishedStrip">
+<!--+
+ |start Subtabs
+ +-->
+<div id="level2tabs"></div>
+<!--+
+ |end Endtabs
+ +-->
+<script type="text/javascript" language="JavaScript"><!--
+ document.write("Published: " + document.lastModified);
+ // --></script>
+</div>
+<!--+
+ |breadtrail
+ +-->
+<div class="breadtrail">
+
+
+ </div>
+<!--+
+ |start Menu, mainarea
+ +-->
+<!--+
+ |start Menu
+ +-->
+<div id="menu">
+<div onclick="SwitchMenu('menu_1.1', '../skin/')" id="menu_1.1Title" class="menutitle">About</div>
+<div id="menu_1.1" class="menuitemgroup">
+<div class="menuitem">
+<a title="" href="../papers/index.html">Index</a>
+</div>
+<div class="menuitem">
+<a title="" href="../papers/derby_web.html">Derby Web Site</a>
+</div>
+</div>
+<div onclick="SwitchMenu('menu_selected_1.2', '../skin/')" id="menu_selected_1.2Title" class="menutitle" style="background-image: url('../skin/images/chapter_open.gif');">Derby Engine</div>
+<div id="menu_selected_1.2" class="selectedmenuitemgroup" style="display: block;">
+<div class="menuitem">
+<a title="" href="../papers/derby_arch.html">Architecture</a>
+</div>
+<div class="menupage">
+<div class="menupagetitle">Disk Page Format</div>
+</div>
+<div class="menuitem">
+<a title="" href="../papers/derby_htw.html">How Things Work</a>
+</div>
+<div class="menuitem">
+<a title="" href="../papers/JDBCImplementation.html">JDBC</a>
+</div>
+</div>
+<div onclick="SwitchMenu('menu_1.3', '../skin/')" id="menu_1.3Title" class="menutitle">Integration</div>
+<div id="menu_1.3" class="menuitemgroup">
+<div class="menuitem">
+<a title="" href="../papers/misc.html">Summary</a>
+</div>
+<div class="menuitem">
+<a title="" href="../binaries/HOWTO_CJDBC_Derby_v0.2.pdf">C-JDBC (PDF)</a>
+</div>
+<div class="menuitem">
+<a title="" href="../binaries/HOWTO_CJDBC_Derby_v0.2.sxw">C-JDBC (SXW)</a>
+</div>
+<div class="menuitem">
+<a title="" href="../DOTS_Derby.html">DOTS</a>
+</div>
+<div class="menuitem">
+<a title="" href="../papers/derby_plugin.html">Eclipse</a>
+</div>
+<div class="menuitem">
+<a title="" href="../binaries/DerbyAndRedHatAppServer.pdf">JOnAS (PDF)</a>
+</div>
+</div>
+<div onclick="SwitchMenu('menu_1.4', '../skin/')" id="menu_1.4Title" class="menutitle">Presentations</div>
+<div id="menu_1.4" class="menuitemgroup">
+<div class="menuitem">
+<a title="" href="../papers/MiscPresentations.html">Colorado 2004</a>
+</div>
+<div class="menuitem">
+<a title="" href="../papers/ApacheConUs04.html">ApacheCon US '04</a>
+</div>
+</div>
+<div onclick="SwitchMenu('menu_1.5', '../skin/')" id="menu_1.5Title" class="menutitle">How To's</div>
+<div id="menu_1.5" class="menuitemgroup">
+<div class="menuitem">
+<a title="" href="../papers/fortune_tut.html">Embedded Tutorial</a>
+</div>
+</div>
+<div id="credit"></div>
+<div id="roundbottom">
+<img style="display: none" class="corner" height="15" width="15" alt="" src="../skin/images/rc-b-l-15-1body-2menu-3menu.png"></div>
+<!--+
+ |alternative credits
+ +-->
+</div>
+<!--+
+ |end Menu
+ +-->
+<!--+
+ |start content
+ +-->
+<div id="content">
+<div id="skinconf-txtlink"></div>
+<div class="trail">
+ Font size:
+ <input value="Reset" class="resetfont" title="Reset text" onclick="ndeSetTextSize('reset'); return false;" type="button">
+ <input value="-a" class="smallerfont" title="Shrink text" onclick="ndeSetTextSize('decr'); return false;" type="button">
+ <input value="+a" class="biggerfont" title="Enlarge text" onclick="ndeSetTextSize('incr'); return false;" type="button">
+</div>
+<h1>Derby On Disk Page Format</h1>
+<div class="abstract">This document describes the storage format of Derby disk pages.
+ This is a work-in-progress derived from Javadoc comments and
+ from explanations Mike Matrigali posted to the Derby lists.
+ Please post questions, comments, and corrections to
+ derby-dev@db.apache.org.
+ </div>
+<div id="minitoc-area">
+<ul class="minitoc">
+<li>
+<a href="#introduction"> Introduction </a>
+</li>
+<li>
+<a href="#storedpage">Data Page Format</a>
+<ul class="minitoc">
+<li>
+<a href="#formatid">Format Id </a>
+</li>
+<li>
+<a href="#pageheader"> Page Header </a>
+</li>
+<li>
+<a href="#records"> Records </a>
+</li>
+<li>
+<a href="#slottable">Slot Offset Table</a>
+</li>
+<li>
+<a href="#checksum">Checksum</a>
+</li>
+</ul>
+</li>
+<li>
+<a href="#allocpage">Allocation Page</a>
+</li>
+</ul>
+</div>
+
+
+
+<a name="N1000F"></a><a name="introduction"></a>
+<h2 class="boxed"> Introduction </h2>
+<div class="section">
+<p>Derby stores table and index data in Containers, which currently map
+ to files in the
+ <span class="codefrag">seg0</span>
+ directory of the database. Data is stored in pages within the container.</p>
+<div class="frame fixme">
+<div class="label">Fixme (Dibyendu Majumdar)</div>
+<div class="content"> Do all containers map to a single file, or does each container map
+ to a file? </div>
+</div>
+<p>A page contains a set of records, which can be accessed by "slot", which
+ defines the order of the records on the page, or by "id" which defines
+ the identity of the records on the page. Clients access records by both
+ slot and id, depending on their needs.</p>
+<p>There are two types of pages - Raw Stored Pages which hold data, and
+ Raw Stored Alloc Pages which hold page allocation information.</p>
+<p>A Table or a BTree index provides a row-based access mechanism (row-based
+ access interface is known as conglomerate). Rows are mapped to records
+ in pages, in case of a table, a single row can span multiple records in
+ multiple pages.</p>
+</div>
+
+<a name="N10029"></a><a name="storedpage"></a>
+<h2 class="boxed">Data Page Format</h2>
+<div class="section">
+<p>A data page is broken into five sections.
+ <img alt="" src="page-format.png">
+ </p>
+<a name="N10036"></a><a name="formatid"></a>
+<h3 class="boxed">Format Id </h3>
+<p> The formatId is a 4 bytes array, it contains the format Id of this
+ page. The possible values are RAW_STORE_STORED_PAGE or RAW_STORE_ALLOC_PAGE.</p>
+<a name="N10040"></a><a name="pageheader"></a>
+<h3 class="boxed"> Page Header </h3>
+<p> The page header is a fixed size, 56 bytes. </p>
+<table class="ForrestTable" cellspacing="1" cellpadding="4">
+
+<tr>
+
+<th colspan="1" rowspan="1">Size</th>
+ <th colspan="1" rowspan="1">Type</th>
+ <th colspan="1" rowspan="1">Description</th>
+
+</tr>
+
+<tr>
+
+<td colspan="1" rowspan="1">1 byte</td>
+ <td colspan="1" rowspan="1">boolean</td>
+ <td colspan="1" rowspan="1">is page an overflow page</td>
+
+</tr>
+
+<tr>
+
+<td colspan="1" rowspan="1">1 byte</td>
+ <td colspan="1" rowspan="1">byte</td>
+ <td colspan="1" rowspan="1">
+<p>page status is either VALID_PAGE or INVALID_PAGE(a field
+ maintained in base page)</p>
+
+<p>page goes thru the following transition:
+ <br>
+ VALID_PAGE <-> deallocated page -> free page <->
+ VALID_PAGE</p>
+
+<p>deallocated and free page are both INVALID_PAGE as far as BasePage
+ is concerned.
+ <br>
+ When a page is deallocated, it transitioned from VALID_PAGE
+ to INVALID_PAGE.
+ <br>
+ When a page is allocated, it trnasitioned from INVALID_PAGE
+ to VALID_PAGE.</p>
+</td>
+
+</tr>
+
+<tr>
+
+<td colspan="1" rowspan="1">8 bytes</td>
+ <td colspan="1" rowspan="1">long</td>
+ <td colspan="1" rowspan="1">pageVersion (a field maintained in base page)</td>
+
+</tr>
+
+<tr>
+
+<td colspan="1" rowspan="1">2 bytes</td>
+ <td colspan="1" rowspan="1">unsigned short</td>
+ <td colspan="1" rowspan="1">number of slots in slot offset table</td>
+
+</tr>
+
+<tr>
+
+<td colspan="1" rowspan="1">4 bytes</td>
+ <td colspan="1" rowspan="1">integer</td>
+ <td colspan="1" rowspan="1">next record identifier</td>
+
+</tr>
+
+<tr>
+
+<td colspan="1" rowspan="1">4 bytes</td>
+ <td colspan="1" rowspan="1">integer</td>
+ <td colspan="1" rowspan="1">generation number of this page (Future Use)</td>
+
+</tr>
+
+<tr>
+
+<td colspan="1" rowspan="1">4 bytes</td>
+ <td colspan="1" rowspan="1">integer</td>
+ <td colspan="1" rowspan="1">previous generation of this page (Future Use)</td>
+
+</tr>
+
+<tr>
+
+<td colspan="1" rowspan="1">8 bytes</td>
+ <td colspan="1" rowspan="1">bipLocation</td>
+ <td colspan="1" rowspan="1">the location of the beforeimage page (Future Use)</td>
+
+</tr>
+
+<tr>
+
+<td colspan="1" rowspan="1">2 bytes</td>
+ <td colspan="1" rowspan="1">unsigned short</td>
+ <td colspan="1" rowspan="1">number of deleted rows on page. (new release 2.0)</td>
+
+</tr>
+
+<tr>
+
+<td colspan="1" rowspan="1">2 bytes</td>
+ <td colspan="1" rowspan="1">unsigned short</td>
+ <td colspan="1" rowspan="1">% of the page to keep free for updates</td>
+
+</tr>
+
+<tr>
+
+<td colspan="1" rowspan="1">2 bytes</td>
+ <td colspan="1" rowspan="1">short</td>
+ <td colspan="1" rowspan="1">spare for future use</td>
+
+</tr>
+
+<tr>
+
+<td colspan="1" rowspan="1">4 bytes</td>
+ <td colspan="1" rowspan="1">long</td>
+ <td colspan="1" rowspan="1">spare for future use (encryption uses to write random bytes
+ here).</td>
+
+</tr>
+
+<tr>
+
+<td colspan="1" rowspan="1">8 bytes</td>
+ <td colspan="1" rowspan="1">long</td>
+ <td colspan="1" rowspan="1">spare for future use</td>
+
+</tr>
+
+<tr>
+
+<td colspan="1" rowspan="1">8 bytes</td>
+ <td colspan="1" rowspan="1">long</td>
+ <td colspan="1" rowspan="1">spare for future use</td>
+
+</tr>
+
+</table>
+<div class="frame note">
+<div class="label">Note</div>
+<div class="content">Spare space is guaranteed to be writen with "0", so that future
+ use of field should not either not use "0" as a valid data item or
+ pick 0 as a valid default value so that on the fly upgrade can assume
+ that 0 means field was never assigned. </div>
+</div>
+<a name="N1016B"></a><a name="records"></a>
+<h3 class="boxed"> Records </h3>
+<p>The records section contains zero or more records. Each record starts
+ with a Record Header</p>
+<table class="ForrestTable" cellspacing="1" cellpadding="4">
+
+<caption>Record Header</caption>
+
+<tr>
+
+<th colspan="1" rowspan="1">Type</th>
+ <th colspan="1" rowspan="1">Description</th>
+
+</tr>
+
+<tr>
+
+<td colspan="1" rowspan="1">1 byte</td>
+ <td colspan="1" rowspan="1">
+<p>Status bits for the record header</p>
+
+<table class="ForrestTable" cellspacing="1" cellpadding="4">
+
+<tr>
+
+<td colspan="1" rowspan="1">RECORD_INITIAL</td>
+ <td colspan="1" rowspan="1">used when record header is first initialized</td>
+
+</tr>
+
+<tr>
+
+<td colspan="1" rowspan="1">RECORD_DELETED</td>
+ <td colspan="1" rowspan="1">used to indicate the record has been deleted</td>
+
+</tr>
+
+<tr>
+
+<td colspan="1" rowspan="1">RECORD_OVERFLOW</td>
+ <td colspan="1" rowspan="1">used to indicate the record has been overflowed, it will
+ point to the overflow page and ID</td>
+
+</tr>
+
+<tr>
+
+<td colspan="1" rowspan="1">RECORD_HAS_FIRST_FIELD</td>
+ <td colspan="1" rowspan="1">used to indicate that firstField is stored will be stored.
+ When RECORD_OVERFLOW and RECORD_HAS_FIRST_FIELD both are
+ set, part of record is on the page, the record header also
+ stores the overflow point to the next part of the record.</td>
+
+</tr>
+
+<tr>
+
+<td colspan="1" rowspan="1">RECORD_VALID_MASK</td>
+ <td colspan="1" rowspan="1">A mask of valid bits that can be set currently, such that
+ the following assert can be made: </td>
+
+</tr>
+
+</table>
+</td>
+
+</tr>
+
+<tr>
+
+<td colspan="1" rowspan="1">compressed int</td>
+ <td colspan="1" rowspan="1">record identifier</td>
+
+</tr>
+
+<tr>
+
+<td colspan="1" rowspan="1">compressed long</td>
+ <td colspan="1" rowspan="1">overflow page only if RECORD_OVERFLOW is set</td>
+
+</tr>
+
+<tr>
+
+<td colspan="1" rowspan="1">compressed int</td>
+ <td colspan="1" rowspan="1">overflow id only if RECORD_OVERFLOW is set</td>
+
+</tr>
+
+<tr>
+
+<td colspan="1" rowspan="1">compressed int</td>
+ <td colspan="1" rowspan="1">first field only if RECORD_HAS_FIRST_FIELD is set - otherwise
+ 0</td>
+
+</tr>
+
+<tr>
+
+<td colspan="1" rowspan="1">compressed int</td>
+ <td colspan="1" rowspan="1">number of fields in this portion - only if RECORD_OVERFLOW is
+ false OR RECORD_HAS_FIRST_FIELD is true - otherwise 0</td>
+
+</tr>
+
+</table>
+<div class="frame note">
+<div class="label">Long Rows</div>
+<div class="content"> A row is long if all of it's columns can't fit on a single page.
+ When storing a long row, the segment of the row which fits on the
+ page is left there, and a pointer column is added at the end of the
+ row. It points to another row in the same container on a different
+ page. That row will contain the next set of columns and a continuation
+ pointer if necessary. The overflow portion will be on an "overflow"
+ page, and that page may have overflow portions of other rows on it
+ (unlike overflow columns). </div>
+</div>
+<p>The Record Header is followed by one or more fields. Each field contains
+ a Field Header and optional Field Data.</p>
+<table class="ForrestTable" cellspacing="1" cellpadding="4">
+
+<caption>Stored Field Header Format</caption>
+
+<tr>
+
+<td colspan="1" rowspan="1">status</td>
+ <td colspan="1" rowspan="1">
+<p> The status is 1 byte, it indicates the state of the field.
+ A FieldHeader can be in the following states: </p>
+
+<table class="ForrestTable" cellspacing="1" cellpadding="4">
+
+<tr>
+
+<td colspan="1" rowspan="1">NULL</td>
+ <td colspan="1" rowspan="1">if the field is NULL, no field data length is stored</td>
+
+</tr>
+
+<tr>
+
+<td colspan="1" rowspan="1">OVERFLOW</td>
+ <td colspan="1" rowspan="1">indicates the field has been overflowed to another page.
+ overflow page and overflow ID is stored at the end of
+ the user data. field data length must be a number greater
+ or equal to 0, indicating the length of the field that
+ is stored on the current page. The format looks like this:
+ <img alt="" src="field-header-overflow.png">
+ overflowPage will be written as compressed long, overflowId
+ will be written as compressed Int</td>
+
+</tr>
+
+<tr>
+
+<td colspan="1" rowspan="1">NONEXISTENT</td>
+ <td colspan="1" rowspan="1">the field no longer exists, e.g. column has been dropped
+ during an alter table</td>
+
+</tr>
+
+<tr>
+
+<td colspan="1" rowspan="1">EXTENSIBLE</td>
+ <td colspan="1" rowspan="1">the field is of user defined data type. The field may
+ be tagged.</td>
+
+</tr>
+
+<tr>
+
+<td colspan="1" rowspan="1">TAGGED</td>
+ <td colspan="1" rowspan="1">the field is TAGGED if and only if it is EXTENSIBLE.</td>
+
+</tr>
+
+<tr>
+
+<td colspan="1" rowspan="1">FIXED</td>
+ <td colspan="1" rowspan="1">the field is FIXED if and only if it is used in the
+ log records for version 1.2 and higher.</td>
+
+</tr>
+
+</table>
+
+</td>
+
+</tr>
+
+<tr>
+
+<td colspan="1" rowspan="1">fieldDataLength</td>
+ <td colspan="1" rowspan="1"> The fieldDataLength is only set if the field is not NULL. It
+ is the length of the field that is stored on the current page.
+ The fieldDataLength is a variable length CompressedInt. </td>
+
+</tr>
+
+<tr>
+
+<td colspan="1" rowspan="1">fieldData</td>
+ <td colspan="1" rowspan="1">
+<p> Overflow page and overflow id are stored as field data. If
+ the overflow bit in status is set, the field data is the overflow
+ information. When the overflow bit is not set in status, then,
+ fieldData is the actually user data for the field. That means,
+ field header consists only field status, and field data length.
+ <br>
+ A non-overflow field:
+ <br>
+<img alt="" src="field-header-non-overflow.png"> <br>
+ An overflow field:
+ <br>
+<img alt="" src="field-header-overflow.png"> <br>
+<strong>overflowPage
+ and overflowID</strong>
+<br>
+ The overflowPage is a variable length CompressedLong, overflowID
+ is a variable Length CompressedInt. They are only stored when
+ the field state is OVERFLOW. And they are not stored in the field
+ header. Instead, they are stored at the end of the field data.
+ The reason we do that is to save a copy if the field has to overflow. </p>
+
+</td>
+
+</tr>
+
+</table>
+<div class="frame note">
+<div class="label">Long Columns</div>
+<div class="content"> A column is long if it can't fit on a single page. A long column
+ is marked as long in the base row, and it's field contains a pointer
+ to a chain of other rows in the same container with contain the data
+ of the row. Each of the subsequent rows is on a page to itself. Each
+ subsquent row, except for the last piece has 2 columns, the first
+ is the next segment of the row and the second is the pointer to the
+ the following segment. The last segment only has the data segment.
+ </div>
+</div>
+<a name="N102C5"></a><a name="slottable"></a>
+<h3 class="boxed">Slot Offset Table</h3>
+<p>The slot offset table is a table of 6 or 12 bytes per record, depending
+ on the pageSize being less or greater than 64K: </p>
+<table class="ForrestTable" cellspacing="1" cellpadding="4">
+
+<caption>Slot Table Record</caption>
+
+<tr>
+
+<th colspan="1" rowspan="1">Size</th>
+ <th colspan="1" rowspan="1">Content</th>
+
+</tr>
+
+<tr>
+
+<td colspan="1" rowspan="1">2 bytes (unsigned short) or 4 bytes (int)</td>
+ <td colspan="1" rowspan="1">page offset for the record that is assigned to the slot</td>
+
+</tr>
+
+<tr>
+
+<td colspan="1" rowspan="1">2 bytes (unsigned short) or 4 bytes (int)</td>
+ <td colspan="1" rowspan="1">the length of the record on this page.</td>
+
+</tr>
+
+<tr>
+
+<td colspan="1" rowspan="1">2 bytes (unsigned short) or 4 bytes (int)</td>
+ <td colspan="1" rowspan="1">the length of the reserved number of bytes for this record on
+ this page.</td>
+
+</tr>
+
+</table>
+<p>
+ First slot is slot 0. The slot table grows backwards. Slots are never
+ left empty. </p>
+<a name="N1030C"></a><a name="checksum"></a>
+<h3 class="boxed">Checksum</h3>
+<p>8 bytes of a java.util.zip.CRC32 checksum of the entire's page contents
+ without the 8 bytes representing the checksum.</p>
+</div>
+
+<a name="N10317"></a><a name="allocpage"></a>
+<h2 class="boxed">Allocation Page</h2>
+<div class="section">
+<p> An allocation page of the file container extends a normal Stored page,
+ with the exception that a hunk of space may be 'borrowed' by the file
+ container to store the file header.</p>
+<p> The borrowed space is not visible to the alloc page even though it is
+ present in the page data array. It is accessed directly by the FileContainer.
+ Any change made to the borrowed space is not managed or seen by the allocation
+ page.</p>
+<p> The reason for having this borrowed space is so that the container header
+ does not need to have a page of its own. </p>
+<p>
+
+<strong>Page Format</strong>
+
+<br>
+ An allocation page extends a stored page, the on disk format is different
+ from a stored page in that N bytes are 'borrowed' by the container and
+ the page header of an allocation page will be slightly bigger than a normal
+ stored page. This N bytes are stored between the page header and the record
+ space.</p>
+<p> The reason why this N bytes can't simply be a row is because it needs
+ to be statically accessible by the container object to avoid a chicken
+ and egg problem of the container object needing to instantiate an alloc
+ page object before it can be objectified, and an alloc page object needing
+ to instantiate a container object before it can be objectified. So this
+ N bytes must be stored outside of the normal record interface yet it must
+ be settable because only the first alloc page has this borrowed space.
+ Other (non-first) alloc page have N == 0.
+ <br>
+
+<img alt="" src="alloc-page.png">
+ </p>
+</div>
+
+</div>
+<!--+
+ |end content
+ +-->
+<div class="clearboth"> </div>
+</div>
+<div id="footer">
+<!--+
+ |start bottomstrip
+ +-->
+<div class="lastmodified">
+<script type="text/javascript"><!--
+document.write("Last Published: " + document.lastModified);
+// --></script>
+</div>
+<div class="copyright">
+ Copyright © 2004-2005 Apache Software Foundation</div>
+<div id="feedback">
+ Send feedback about the website to:
+ <a id="feedbackto" href="mailto:derby-dev@db.apache.org?subject=Feedback%C2%A0papers/pageformats.html">derby-dev@db.apache.org</a>
+</div>
+<!--+
+ |end bottomstrip
+ +-->
+</div>
+</body>
+</html>
Modified: incubator/derby/site/trunk/src/documentation/content/xdocs/faq.xml
URL: http://svn.apache.org/viewcvs/incubator/derby/site/trunk/src/documentation/content/xdocs/faq.xml?view=diff&r1=149318&r2=149319
==============================================================================
--- incubator/derby/site/trunk/src/documentation/content/xdocs/faq.xml (original)
+++ incubator/derby/site/trunk/src/documentation/content/xdocs/faq.xml Mon Jan 31 15:13:36 2005
@@ -110,7 +110,8 @@
<faq id="createdb_OS_X">
<question>
- Why can't I create a new database on Mac OS X?
+ Why can't I create a new database or modify an existing database
+ on Mac OS X?
</question>
<answer>
<p>
Added: incubator/derby/site/trunk/src/documentation/content/xdocs/papers/alloc-page.aart
URL: http://svn.apache.org/viewcvs/incubator/derby/site/trunk/src/documentation/content/xdocs/papers/alloc-page.aart?view=auto&rev=149319
==============================================================================
--- incubator/derby/site/trunk/src/documentation/content/xdocs/papers/alloc-page.aart (added)
+++ incubator/derby/site/trunk/src/documentation/content/xdocs/papers/alloc-page.aart Mon Jan 31 15:13:36 2005
@@ -0,0 +1,5 @@
+ borrowed
+ <------------->
++----------+-------------+---+---------+-------------------+-------------------+--------+
+| FormatId | pageHeader | N | N-bytes | alloc-extend-rows | slot-offset-table |checksum|
++----------+-------------+---+---------+-------------------+-------------------+--------+
Added: incubator/derby/site/trunk/src/documentation/content/xdocs/papers/field-header-non-overflow.aart
URL: http://svn.apache.org/viewcvs/incubator/derby/site/trunk/src/documentation/content/xdocs/papers/field-header-non-overflow.aart?view=auto&rev=149319
==============================================================================
--- incubator/derby/site/trunk/src/documentation/content/xdocs/papers/field-header-non-overflow.aart (added)
+++ incubator/derby/site/trunk/src/documentation/content/xdocs/papers/field-header-non-overflow.aart Mon Jan 31 15:13:36 2005
@@ -0,0 +1,3 @@
++--------+-------------------+-------------+
+| status | <fieldDataLength> | <fieldData> |
++--------+-------------------+-------------+
Added: incubator/derby/site/trunk/src/documentation/content/xdocs/papers/field-header-overflow.aart
URL: http://svn.apache.org/viewcvs/incubator/derby/site/trunk/src/documentation/content/xdocs/papers/field-header-overflow.aart?view=auto&rev=149319
==============================================================================
--- incubator/derby/site/trunk/src/documentation/content/xdocs/papers/field-header-overflow.aart (added)
+++ incubator/derby/site/trunk/src/documentation/content/xdocs/papers/field-header-overflow.aart Mon Jan 31 15:13:36 2005
@@ -0,0 +1,3 @@
++--------+-------------------+----------------+--------------+
+| status | <fieldDataLength> | <overflowPage> | <overflowID> |
++--------+-------------------+----------------+--------------+
Modified: incubator/derby/site/trunk/src/documentation/content/xdocs/papers/index.xml
URL: http://svn.apache.org/viewcvs/incubator/derby/site/trunk/src/documentation/content/xdocs/papers/index.xml?view=diff&r1=149318&r2=149319
==============================================================================
--- incubator/derby/site/trunk/src/documentation/content/xdocs/papers/index.xml (original)
+++ incubator/derby/site/trunk/src/documentation/content/xdocs/papers/index.xml Mon Jan 31 15:13:36 2005
@@ -18,6 +18,7 @@
<ul>
<li> Architecture: <a href="derby_arch.html">Derby Engine Architecture
Overview</a></li>
+ <li>Disk Page Format:<a href="pageformats.html">Derby On Disk Page Format</a></li>
<li><a href="derby_htw.html">How Things Work</a> </li>
<li>JDBC: <a href="JDBCImplementation.html">Derby JDBC Implementation
Notes</a></li>
@@ -173,6 +174,6 @@
</section>
-<p><em>Last Updated: January 21, 2005</em></p>
+<p><em>Last Updated: January 31, 2005</em></p>
</body>
</document>
Added: incubator/derby/site/trunk/src/documentation/content/xdocs/papers/page-format.aart
URL: http://svn.apache.org/viewcvs/incubator/derby/site/trunk/src/documentation/content/xdocs/papers/page-format.aart?view=auto&rev=149319
==============================================================================
--- incubator/derby/site/trunk/src/documentation/content/xdocs/papers/page-format.aart (added)
+++ incubator/derby/site/trunk/src/documentation/content/xdocs/papers/page-format.aart Mon Jan 31 15:13:36 2005
@@ -0,0 +1,3 @@
++----------+-------------+-------------------+-------------------+----------+
+| formatId | page-header | records | slot-offset-table | checksum |
++----------+-------------+-------------------+-------------------+----------+
Added: incubator/derby/site/trunk/src/documentation/content/xdocs/papers/pageformats.xml
URL: http://svn.apache.org/viewcvs/incubator/derby/site/trunk/src/documentation/content/xdocs/papers/pageformats.xml?view=auto&rev=149319
==============================================================================
--- incubator/derby/site/trunk/src/documentation/content/xdocs/papers/pageformats.xml (added)
+++ incubator/derby/site/trunk/src/documentation/content/xdocs/papers/pageformats.xml Mon Jan 31 15:13:36 2005
@@ -0,0 +1,372 @@
+<?xml version="1.0"?>
+<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "http://forrest.apache.org/dtd/document-v20.dtd">
+<document>
+ <header>
+ <title>Derby On Disk Page Format</title>
+ <abstract>This document describes the storage format of Derby disk pages.
+ This is a work-in-progress derived from Javadoc comments and
+ from explanations Mike Matrigali posted to the Derby lists.
+ Please post questions, comments, and corrections to
+ derby-dev@db.apache.org.
+ </abstract>
+ </header>
+ <body>
+
+
+ <section id="introduction">
+ <title> Introduction </title>
+ <p>Derby stores table and index data in Containers, which currently map
+ to files in the
+ <code>seg0</code>
+ directory of the database. Data is stored in pages within the container.</p>
+ <fixme author="Dibyendu Majumdar"> Do all containers map to a single file, or does each container map
+ to a file? </fixme>
+ <p>A page contains a set of records, which can be accessed by "slot", which
+ defines the order of the records on the page, or by "id" which defines
+ the identity of the records on the page. Clients access records by both
+ slot and id, depending on their needs.</p>
+ <p>There are two types of pages - Raw Stored Pages which hold data, and
+ Raw Stored Alloc Pages which hold page allocation information.</p>
+ <p>A Table or a BTree index provides a row-based access mechanism (row-based
+ access interface is known as conglomerate). Rows are mapped to records
+ in pages, in case of a table, a single row can span multiple records in
+ multiple pages.</p>
+ </section>
+ <section id="storedpage">
+ <title>Data Page Format</title>
+ <p>A data page is broken into five sections.
+ <img src="page-format.png" alt=""/>
+ </p>
+ <section id="formatid">
+ <title>Format Id </title>
+ <p> The formatId is a 4 bytes array, it contains the format Id of this
+ page. The possible values are RAW_STORE_STORED_PAGE or RAW_STORE_ALLOC_PAGE.</p>
+ </section>
+ <section id="pageheader">
+ <title> Page Header </title>
+ <p> The page header is a fixed size, 56 bytes. </p>
+ <table>
+ <tr>
+ <th>Size</th>
+ <th>Type</th>
+ <th>Description</th>
+ </tr>
+ <tr>
+ <td>1 byte</td>
+ <td>boolean</td>
+ <td>is page an overflow page</td>
+ </tr>
+ <tr>
+ <td>1 byte</td>
+ <td>byte</td>
+ <td><p>page status is either VALID_PAGE or INVALID_PAGE(a field
+ maintained in base page)</p>
+ <p>page goes thru the following transition:
+ <br/>
+ VALID_PAGE <-> deallocated page -> free page <->
+ VALID_PAGE</p>
+ <p>deallocated and free page are both INVALID_PAGE as far as BasePage
+ is concerned.
+ <br/>
+ When a page is deallocated, it transitioned from VALID_PAGE
+ to INVALID_PAGE.
+ <br/>
+ When a page is allocated, it trnasitioned from INVALID_PAGE
+ to VALID_PAGE.</p></td>
+ </tr>
+ <tr>
+ <td>8 bytes</td>
+ <td>long</td>
+ <td>pageVersion (a field maintained in base page)</td>
+ </tr>
+ <tr>
+ <td>2 bytes</td>
+ <td>unsigned short</td>
+ <td>number of slots in slot offset table</td>
+ </tr>
+ <tr>
+ <td>4 bytes</td>
+ <td>integer</td>
+ <td>next record identifier</td>
+ </tr>
+ <tr>
+ <td>4 bytes</td>
+ <td>integer</td>
+ <td>generation number of this page (Future Use)</td>
+ </tr>
+ <tr>
+ <td>4 bytes</td>
+ <td>integer</td>
+ <td>previous generation of this page (Future Use)</td>
+ </tr>
+ <tr>
+ <td>8 bytes</td>
+ <td>bipLocation</td>
+ <td>the location of the beforeimage page (Future Use)</td>
+ </tr>
+ <tr>
+ <td>2 bytes</td>
+ <td>unsigned short</td>
+ <td>number of deleted rows on page. (new release 2.0)</td>
+ </tr>
+ <tr>
+ <td>2 bytes</td>
+ <td>unsigned short</td>
+ <td>% of the page to keep free for updates</td>
+ </tr>
+ <tr>
+ <td>2 bytes</td>
+ <td>short</td>
+ <td>spare for future use</td>
+ </tr>
+ <tr>
+ <td>4 bytes</td>
+ <td>long</td>
+ <td>spare for future use (encryption uses to write random bytes
+ here).</td>
+ </tr>
+ <tr>
+ <td>8 bytes</td>
+ <td>long</td>
+ <td>spare for future use</td>
+ </tr>
+ <tr>
+ <td>8 bytes</td>
+ <td>long</td>
+ <td>spare for future use</td>
+ </tr>
+ </table>
+ <note>Spare space is guaranteed to be writen with "0", so that future
+ use of field should not either not use "0" as a valid data item or
+ pick 0 as a valid default value so that on the fly upgrade can assume
+ that 0 means field was never assigned. </note>
+
+ </section>
+ <section id="records">
+ <title> Records </title>
+
+ <p>The records section contains zero or more records. Each record starts
+ with a Record Header</p>
+ <table>
+ <caption>Record Header</caption>
+ <tr>
+ <th>Type</th>
+ <th>Description</th>
+ </tr>
+ <tr>
+ <td>1 byte</td>
+ <td> <p>Status bits for the record header</p>
+ <table>
+ <tr>
+ <td>RECORD_INITIAL</td>
+ <td>used when record header is first initialized</td>
+ </tr>
+ <tr>
+ <td>RECORD_DELETED</td>
+ <td>used to indicate the record has been deleted</td>
+ </tr>
+ <tr>
+ <td>RECORD_OVERFLOW</td>
+ <td>used to indicate the record has been overflowed, it will
+ point to the overflow page and ID</td>
+ </tr>
+ <tr>
+ <td>RECORD_HAS_FIRST_FIELD</td>
+ <td>used to indicate that firstField is stored will be stored.
+ When RECORD_OVERFLOW and RECORD_HAS_FIRST_FIELD both are
+ set, part of record is on the page, the record header also
+ stores the overflow point to the next part of the record.</td>
+ </tr>
+ <tr>
+ <td>RECORD_VALID_MASK</td>
+ <td>A mask of valid bits that can be set currently, such that
+ the following assert can be made: </td>
+ </tr>
+ </table></td>
+ </tr>
+ <tr>
+ <td>compressed int</td>
+ <td>record identifier</td>
+ </tr>
+ <tr>
+ <td>compressed long</td>
+ <td>overflow page only if RECORD_OVERFLOW is set</td>
+ </tr>
+ <tr>
+ <td>compressed int</td>
+ <td>overflow id only if RECORD_OVERFLOW is set</td>
+ </tr>
+ <tr>
+ <td>compressed int</td>
+ <td>first field only if RECORD_HAS_FIRST_FIELD is set - otherwise
+ 0</td>
+ </tr>
+ <tr>
+ <td>compressed int</td>
+ <td>number of fields in this portion - only if RECORD_OVERFLOW is
+ false OR RECORD_HAS_FIRST_FIELD is true - otherwise 0</td>
+ </tr>
+ </table>
+ <note label="Long Rows"> A row is long if all of it's columns can't fit on a single page.
+ When storing a long row, the segment of the row which fits on the
+ page is left there, and a pointer column is added at the end of the
+ row. It points to another row in the same container on a different
+ page. That row will contain the next set of columns and a continuation
+ pointer if necessary. The overflow portion will be on an "overflow"
+ page, and that page may have overflow portions of other rows on it
+ (unlike overflow columns). </note>
+ <p>The Record Header is followed by one or more fields. Each field contains
+ a Field Header and optional Field Data.</p>
+ <table>
+ <caption>Stored Field Header Format</caption>
+ <tr>
+ <td>status</td>
+ <td> <p> The status is 1 byte, it indicates the state of the field.
+ A FieldHeader can be in the following states: </p>
+ <table>
+ <tr>
+ <td>NULL</td>
+ <td>if the field is NULL, no field data length is stored</td>
+ </tr>
+ <tr>
+ <td>OVERFLOW</td>
+ <td>indicates the field has been overflowed to another page.
+ overflow page and overflow ID is stored at the end of
+ the user data. field data length must be a number greater
+ or equal to 0, indicating the length of the field that
+ is stored on the current page. The format looks like this:
+ <img src="field-header-overflow.png" alt=""/>
+ overflowPage will be written as compressed long, overflowId
+ will be written as compressed Int</td>
+ </tr>
+ <tr>
+ <td>NONEXISTENT</td>
+ <td>the field no longer exists, e.g. column has been dropped
+ during an alter table</td>
+ </tr>
+ <tr>
+ <td>EXTENSIBLE</td>
+ <td>the field is of user defined data type. The field may
+ be tagged.</td>
+ </tr>
+ <tr>
+ <td>TAGGED</td>
+ <td>the field is TAGGED if and only if it is EXTENSIBLE.</td>
+ </tr>
+ <tr>
+ <td>FIXED</td>
+ <td>the field is FIXED if and only if it is used in the
+ log records for version 1.2 and higher.</td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td>fieldDataLength</td>
+ <td> The fieldDataLength is only set if the field is not NULL. It
+ is the length of the field that is stored on the current page.
+ The fieldDataLength is a variable length CompressedInt. </td>
+ </tr>
+ <tr>
+ <td>fieldData</td>
+ <td><p> Overflow page and overflow id are stored as field data. If
+ the overflow bit in status is set, the field data is the overflow
+ information. When the overflow bit is not set in status, then,
+ fieldData is the actually user data for the field. That means,
+ field header consists only field status, and field data length.
+ <br/>
+ A non-overflow field:
+ <br/> <img src="field-header-non-overflow.png" alt=""/> <br/>
+ An overflow field:
+ <br/> <img src="field-header-overflow.png" alt=""/> <br/> <strong>overflowPage
+ and overflowID</strong> <br/>
+ The overflowPage is a variable length CompressedLong, overflowID
+ is a variable Length CompressedInt. They are only stored when
+ the field state is OVERFLOW. And they are not stored in the field
+ header. Instead, they are stored at the end of the field data.
+ The reason we do that is to save a copy if the field has to overflow. </p>
+ </td>
+ </tr>
+ </table>
+ <note label="Long Columns"> A column is long if it can't fit on a single page. A long column
+ is marked as long in the base row, and it's field contains a pointer
+ to a chain of other rows in the same container with contain the data
+ of the row. Each of the subsequent rows is on a page to itself. Each
+ subsquent row, except for the last piece has 2 columns, the first
+ is the next segment of the row and the second is the pointer to the
+ the following segment. The last segment only has the data segment.
+ </note>
+
+ </section>
+ <section id="slottable">
+ <title>Slot Offset Table</title>
+ <p>The slot offset table is a table of 6 or 12 bytes per record, depending
+ on the pageSize being less or greater than 64K: </p>
+ <table>
+ <caption>Slot Table Record</caption>
+ <tr>
+ <th>Size</th>
+ <th>Content</th>
+ </tr>
+ <tr>
+ <td>2 bytes (unsigned short) or 4 bytes (int)</td>
+ <td>page offset for the record that is assigned to the slot</td>
+ </tr>
+ <tr>
+ <td>2 bytes (unsigned short) or 4 bytes (int)</td>
+ <td>the length of the record on this page.</td>
+ </tr>
+ <tr>
+ <td>2 bytes (unsigned short) or 4 bytes (int)</td>
+ <td>the length of the reserved number of bytes for this record on
+ this page.</td>
+ </tr>
+ </table>
+ <p>
+ First slot is slot 0. The slot table grows backwards. Slots are never
+ left empty. </p>
+ </section>
+ <section id="checksum">
+ <title>Checksum</title>
+ <p>8 bytes of a java.util.zip.CRC32 checksum of the entire's page contents
+ without the 8 bytes representing the checksum.</p>
+ </section>
+ </section>
+ <section id="allocpage">
+ <title>Allocation Page</title>
+ <p> An allocation page of the file container extends a normal Stored page,
+ with the exception that a hunk of space may be 'borrowed' by the file
+ container to store the file header.</p>
+ <p> The borrowed space is not visible to the alloc page even though it is
+ present in the page data array. It is accessed directly by the FileContainer.
+ Any change made to the borrowed space is not managed or seen by the allocation
+ page.</p>
+ <p> The reason for having this borrowed space is so that the container header
+ does not need to have a page of its own. </p>
+ <p>
+ <strong>Page Format</strong>
+ <br/>
+ An allocation page extends a stored page, the on disk format is different
+ from a stored page in that N bytes are 'borrowed' by the container and
+ the page header of an allocation page will be slightly bigger than a normal
+ stored page. This N bytes are stored between the page header and the record
+ space.</p>
+ <p> The reason why this N bytes can't simply be a row is because it needs
+ to be statically accessible by the container object to avoid a chicken
+ and egg problem of the container object needing to instantiate an alloc
+ page object before it can be objectified, and an alloc page object needing
+ to instantiate a container object before it can be objectified. So this
+ N bytes must be stored outside of the normal record interface yet it must
+ be settable because only the first alloc page has this borrowed space.
+ Other (non-first) alloc page have N == 0.
+ <br/>
+ <img src="alloc-page.png" alt=""/>
+ </p>
+ </section>
+ </body>
+ <footer>
+ <legal>This is a legal notice, so it is
+ <strong>important</strong>
+ .</legal>
+ </footer>
+</document>
Modified: incubator/derby/site/trunk/src/documentation/content/xdocs/site.xml
URL: http://svn.apache.org/viewcvs/incubator/derby/site/trunk/src/documentation/content/xdocs/site.xml?view=diff&r1=149318&r2=149319
==============================================================================
--- incubator/derby/site/trunk/src/documentation/content/xdocs/site.xml (original)
+++ incubator/derby/site/trunk/src/documentation/content/xdocs/site.xml Mon Jan 31 15:13:36 2005
@@ -26,6 +26,7 @@
<engine label="Derby Engine" href="papers/" tab="papers">
<index label="Architecture" href="derby_arch.html"/>
+ <pformat label="Disk Page Format" href="pageformats.html"/>
<misc label="How Things Work" href="derby_htw.html"/>
<jdbc label="JDBC" href="JDBCImplementation.html"/>
</engine>