225 lines
8.9 KiB
HTML
225 lines
8.9 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
<!-- NewPage -->
|
|
<html lang="en">
|
|
<head>
|
|
<!-- Generated by javadoc (1.8.0_151) on Tue Oct 31 17:36:45 EDT 2017 -->
|
|
<title>BinaryEqualityComparator (Oracle - Berkeley DB Java Edition API)</title>
|
|
<meta name="date" content="2017-10-31">
|
|
<link rel="stylesheet" type="text/css" href="../../../style.css" title="Style">
|
|
<script type="text/javascript" src="../../../script.js"></script>
|
|
</head>
|
|
<body>
|
|
<script type="text/javascript"><!--
|
|
try {
|
|
if (location.href.indexOf('is-external=true') == -1) {
|
|
parent.document.title="BinaryEqualityComparator (Oracle - Berkeley DB Java Edition API)";
|
|
}
|
|
}
|
|
catch(err) {
|
|
}
|
|
//-->
|
|
</script>
|
|
<noscript>
|
|
<div>JavaScript is disabled on your browser.</div>
|
|
</noscript>
|
|
<!-- ========= START OF TOP NAVBAR ======= -->
|
|
<div class="topNav"><a name="navbar.top">
|
|
<!-- -->
|
|
</a>
|
|
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
|
|
<a name="navbar.top.firstrow">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="navList" title="Navigation">
|
|
<li><a href="../../../overview-summary.html">Overview</a></li>
|
|
<li><a href="package-summary.html">Package</a></li>
|
|
<li class="navBarCell1Rev">Class</li>
|
|
<li><a href="class-use/BinaryEqualityComparator.html">Use</a></li>
|
|
<li><a href="package-tree.html">Tree</a></li>
|
|
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
|
|
<li><a href="../../../index-all.html">Index</a></li>
|
|
<li><a href="../../../help-doc.html">Help</a></li>
|
|
</ul>
|
|
<div class="aboutLanguage"><b>Berkeley DB Java Edition</b><br><font size=\"-1\"> version 7.5.11</font>
|
|
</div>
|
|
</div>
|
|
<div class="subNav">
|
|
<ul class="navList">
|
|
<li>Prev Class</li>
|
|
<li><a href="../../../com/sleepycat/je/BtreeStats.html" title="class in com.sleepycat.je"><span class="typeNameLink">Next Class</span></a></li>
|
|
</ul>
|
|
<ul class="navList">
|
|
<li><a href="../../../index.html?com/sleepycat/je/BinaryEqualityComparator.html" target="_top">Frames</a></li>
|
|
<li><a href="BinaryEqualityComparator.html" target="_top">No Frames</a></li>
|
|
</ul>
|
|
<ul class="navList" id="allclasses_navbar_top">
|
|
<li><a href="../../../allclasses-noframe.html">All Classes</a></li>
|
|
</ul>
|
|
<div>
|
|
<script type="text/javascript"><!--
|
|
allClassesLink = document.getElementById("allclasses_navbar_top");
|
|
if(window==top) {
|
|
allClassesLink.style.display = "block";
|
|
}
|
|
else {
|
|
allClassesLink.style.display = "none";
|
|
}
|
|
//-->
|
|
</script>
|
|
</div>
|
|
<div>
|
|
<ul class="subNavList">
|
|
<li>Summary: </li>
|
|
<li>Nested | </li>
|
|
<li>Field | </li>
|
|
<li>Constr | </li>
|
|
<li>Method</li>
|
|
</ul>
|
|
<ul class="subNavList">
|
|
<li>Detail: </li>
|
|
<li>Field | </li>
|
|
<li>Constr | </li>
|
|
<li>Method</li>
|
|
</ul>
|
|
</div>
|
|
<a name="skip.navbar.top">
|
|
<!-- -->
|
|
</a></div>
|
|
<!-- ========= END OF TOP NAVBAR ========= -->
|
|
<!-- ======== START OF CLASS DATA ======== -->
|
|
<div class="header">
|
|
<div class="subTitle">com.sleepycat.je</div>
|
|
<h2 title="Interface BinaryEqualityComparator" class="title">Interface BinaryEqualityComparator</h2>
|
|
</div>
|
|
<div class="contentContainer">
|
|
<div class="description">
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<hr>
|
|
<br>
|
|
<pre>public interface <span class="typeNameLabel">BinaryEqualityComparator</span></pre>
|
|
<div class="block">A tag interface used to mark a BTree or duplicate comparator class as a
|
|
<em>binary equality</em> comparator, that is, a comparator that considers
|
|
two keys (byte arrays) to be equal if and only if they have the same
|
|
length and they are equal byte-per-byte.
|
|
<p>
|
|
If both the BTree and duplicate comparators used by a databse are
|
|
binary-equality comparators, then certain internal optimizations can be
|
|
enabled. Specifically, the "BIN-delta blind-puts" optimization described
|
|
below is made possible.
|
|
<p>
|
|
We say that a record operation (insertion, update, or deletion) is performed
|
|
blindly in a BIN-delta when the delta does not contain a slot with the
|
|
operation's key and we don't need to access the full BIN to check whether
|
|
such a slot exists there or to extract any information from the full-BIN
|
|
slot, if it exists. Performing a blind operation involves inserting the
|
|
record in the BIN-delta, and in case of deletion, marking the BIN slot as
|
|
deleted. When the delta and the full BIN are merged at a later time, the
|
|
blind operation will be translated to an insertion, update, or delete
|
|
depending on whether the full BIN contained the record or not.
|
|
<p>
|
|
Normally, blind puts are not possible: we need to know whether the put
|
|
is actually an update or an insertion, i.e., whether the key exists in
|
|
the full BIN or not. Furthermore, in case of update we also need to
|
|
know the location of the previous record version to make the current
|
|
update abortable. However, it is possible to answer at least the key
|
|
existence question by adding a small amount of extra information in
|
|
the deltas. If we do so, puts that are actual insertions can be done
|
|
blindly.
|
|
<p>
|
|
To answer whether a key exists in a full BIN or not, each BIN-delta
|
|
stores a bloom filter, which is a very compact, approximate
|
|
representation of the set of keys in the full BIN. Bloom filters can
|
|
answer set membership questions with no false negatives and very low
|
|
probability of false positives. As a result, put operation that are
|
|
actual insertions can almost always be performed blindly.
|
|
<p>
|
|
Because bloom filters work by applying hash functions on keys (where each
|
|
key byte participates in the hash computation), an additional requirement
|
|
for blind puts is that a database uses "binary equality" comparators, that
|
|
is, a comparator that considers two keys to be equal if and only if they
|
|
have the same length and they are equal byte-per-byte. Inheriting from the
|
|
BinaryEqualityComparator interface marks an actual comparator as having the
|
|
"binary equality" property.
|
|
<p>
|
|
Comparators are configured using
|
|
<a href="../../../com/sleepycat/je/DatabaseConfig.html#setBtreeComparator-java.util.Comparator-"><code>DatabaseConfig.setBtreeComparator(java.util.Comparator)</code></a> or
|
|
<a href="../../../com/sleepycat/je/DatabaseConfig.html#setBtreeComparator-java.lang.Class-"><code>DatabaseConfig.setBtreeComparator(Class)</code></a>, and
|
|
<a href="../../../com/sleepycat/je/DatabaseConfig.html#setDuplicateComparator-java.util.Comparator-"><code>DatabaseConfig.setDuplicateComparator(java.util.Comparator)</code></a> or
|
|
<a href="../../../com/sleepycat/je/DatabaseConfig.html#setDuplicateComparator-java.lang.Class-"><code>DatabaseConfig.setDuplicateComparator(Class)</code></a>.
|
|
<p>
|
|
As described in the javadoc for these methods, comparators must be used
|
|
with great caution, since a badly behaved comparator can cause B-tree
|
|
corruption.</div>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<!-- ========= END OF CLASS DATA ========= -->
|
|
<!-- ======= START OF BOTTOM NAVBAR ====== -->
|
|
<div class="bottomNav"><a name="navbar.bottom">
|
|
<!-- -->
|
|
</a>
|
|
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
|
|
<a name="navbar.bottom.firstrow">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="navList" title="Navigation">
|
|
<li><a href="../../../overview-summary.html">Overview</a></li>
|
|
<li><a href="package-summary.html">Package</a></li>
|
|
<li class="navBarCell1Rev">Class</li>
|
|
<li><a href="class-use/BinaryEqualityComparator.html">Use</a></li>
|
|
<li><a href="package-tree.html">Tree</a></li>
|
|
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
|
|
<li><a href="../../../index-all.html">Index</a></li>
|
|
<li><a href="../../../help-doc.html">Help</a></li>
|
|
</ul>
|
|
<div class="aboutLanguage"><b>Berkeley DB Java Edition</b><br><font size=\"-1\"> version 7.5.11</font>
|
|
</div>
|
|
</div>
|
|
<div class="subNav">
|
|
<ul class="navList">
|
|
<li>Prev Class</li>
|
|
<li><a href="../../../com/sleepycat/je/BtreeStats.html" title="class in com.sleepycat.je"><span class="typeNameLink">Next Class</span></a></li>
|
|
</ul>
|
|
<ul class="navList">
|
|
<li><a href="../../../index.html?com/sleepycat/je/BinaryEqualityComparator.html" target="_top">Frames</a></li>
|
|
<li><a href="BinaryEqualityComparator.html" target="_top">No Frames</a></li>
|
|
</ul>
|
|
<ul class="navList" id="allclasses_navbar_bottom">
|
|
<li><a href="../../../allclasses-noframe.html">All Classes</a></li>
|
|
</ul>
|
|
<div>
|
|
<script type="text/javascript"><!--
|
|
allClassesLink = document.getElementById("allclasses_navbar_bottom");
|
|
if(window==top) {
|
|
allClassesLink.style.display = "block";
|
|
}
|
|
else {
|
|
allClassesLink.style.display = "none";
|
|
}
|
|
//-->
|
|
</script>
|
|
</div>
|
|
<div>
|
|
<ul class="subNavList">
|
|
<li>Summary: </li>
|
|
<li>Nested | </li>
|
|
<li>Field | </li>
|
|
<li>Constr | </li>
|
|
<li>Method</li>
|
|
</ul>
|
|
<ul class="subNavList">
|
|
<li>Detail: </li>
|
|
<li>Field | </li>
|
|
<li>Constr | </li>
|
|
<li>Method</li>
|
|
</ul>
|
|
</div>
|
|
<a name="skip.navbar.bottom">
|
|
<!-- -->
|
|
</a></div>
|
|
<!-- ======== END OF BOTTOM NAVBAR ======= -->
|
|
<p class="legalCopy"><small><font size=1>Copyright (c) 2002, 2017 Oracle and/or its affiliates. All rights reserved.</font> </small></p>
|
|
</body>
|
|
</html>
|