Skip to content

Commit a734369

Browse files
authored
Merge branch 'main' into distinct_from
2 parents 0c45afe + 8b91d19 commit a734369

File tree

55 files changed

+1759
-68
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1759
-68
lines changed

docs/sphinx/source/ReleaseNotes.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,43 @@ This document contains a log of changes to the FoundationDB Record Layer. It aim
55

66
As the [versioning guide](Versioning.md) details, it cannot always be determined solely by looking at the version numbers whether one Record Layer version contains all changes included in another. In particular, bug fixes and backwards-compatible changes might be back-ported to or introduced as patches against older versions. To track when a patch version has been included in the main release train, some releases will say as a note that they contain all changes from a specific patch.
77

8+
## 4.5
9+
10+
### 4.5.1.0
11+
12+
<h4> Breaking Changes </h4>
13+
14+
* Update to minor version 4.5 in recognition of incompatibility with older 4.3 versions - [PR #3508](https://github.com/FoundationDB/fdb-record-layer/pull/3508)
15+
* Remove QueryHashable - [PR #3392](https://github.com/FoundationDB/fdb-record-layer/pull/3392)
16+
<h4> Bug Fixes </h4>
17+
18+
* Enable AggregateCursorContinuation serialize to the new implementation - [PR #3495](https://github.com/FoundationDB/fdb-record-layer/pull/3495)
19+
20+
<details>
21+
<summary>
22+
23+
<h4> Build/Test/Documentation/Style Improvements (click to expand) </h4>
24+
25+
</summary>
26+
27+
* Introduce option to setup transaction before executing queries - [PR #3471](https://github.com/FoundationDB/fdb-record-layer/pull/3471)
28+
* Omit portions of stack trace that are just junit in test summary - [PR #3499](https://github.com/FoundationDB/fdb-record-layer/pull/3499)
29+
30+
</details>
31+
32+
33+
**[Full Changelog (4.4.15.0...4.5.1.0)](https://github.com/FoundationDB/fdb-record-layer/compare/4.4.15.0...4.5.1.0)**
34+
35+
#### Mixed Mode Test Results
36+
37+
Mixed mode testing run against the following previous versions:
38+
39+
`4.4.3.0`, ✅`4.4.4.0`, ❌`4.4.7.0`, ❌`4.4.8.0`, ❌`4.4.9.0`, ❌`4.4.10.0`, ❌`4.4.11.0`, ✅`4.4.12.0`, ✅`4.4.14.0`, ✅`4.4.15.0`
40+
41+
[See full test run](https://github.com/FoundationDB/fdb-record-layer/actions/runs/16597262218)
42+
43+
44+
845
## 4.4
946

1047
### 4.4.15.0

fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/query/plan/cascades/values/RelOpValue.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1138,7 +1138,10 @@ private enum UnaryPhysicalOperator {
11381138
IS_NOT_NULL_EI(Comparisons.Type.NOT_NULL, Type.TypeCode.ENUM, Objects::nonNull),
11391139

11401140
IS_NULL_ID(Comparisons.Type.IS_NULL, Type.TypeCode.UUID, Objects::isNull),
1141-
IS_NOT_NULL_ID(Comparisons.Type.NOT_NULL, Type.TypeCode.UUID, Objects::nonNull);
1141+
IS_NOT_NULL_ID(Comparisons.Type.NOT_NULL, Type.TypeCode.UUID, Objects::nonNull),
1142+
1143+
IS_NULL_NT(Comparisons.Type.IS_NULL, Type.TypeCode.NULL, Objects::isNull),
1144+
IS_NOT_NULL_NT(Comparisons.Type.NOT_NULL, Type.TypeCode.NULL, Objects::nonNull);
11421145

11431146
@Nonnull
11441147
private static final Supplier<BiMap<UnaryPhysicalOperator, PUnaryPhysicalOperator>> protoEnumBiMapSupplier =

fdb-record-layer-core/src/main/proto/record_query_plan.proto

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1196,6 +1196,9 @@ message PUnaryRelOpValue {
11961196

11971197
IS_NULL_ID = 19;
11981198
IS_NOT_NULL_ID = 20;
1199+
1200+
IS_NULL_NT = 21;
1201+
IS_NOT_NULL_NT = 22;
11991202
}
12001203
optional PRelOpValue super = 1;
12011204
optional PUnaryPhysicalOperator operator = 2;

fdb-relational-cli/fdb-relational-cli.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ generateGrammarSource {
108108
application {
109109
// https://docs.gradle.org/current/userguide/application_plugin.html
110110
// https://github.com/julianhyde/sqlline
111-
mainClass = "com.apple.relational.cli.sqlline.RelationalSQLLine"
111+
mainClass = "com.apple.foundationdb.relational.cli.sqlline.RelationalSQLLine"
112112
applicationName = "fdb-relational-sqlline"
113113
// JUL => log4j2 https://logging.apache.org/log4j/2.x/log4j-jul/index.html
114114
// TODO: Allow overriding default fdb.cluster file with FDB_CLUSTER_FILE.

fdb-relational-cli/src/main/dist/conf/log4j2.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
12
<!--
23
log4j2.xml
34
@@ -18,7 +19,6 @@
1819
limitations under the License.
1920
-->
2021

21-
<?xml version="1.0" encoding="UTF-8"?>
2222
<Configuration status="INFO">
2323
<Appenders>
2424
<Console name="Console" target="SYSTEM_OUT">

fdb-relational-cli/src/test/java/com/apple/foundationdb/relational/cli/LaunchSQLLine.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222

2323
import com.apple.foundationdb.relational.util.ExcludeFromJacocoGeneratedReport;
2424

25-
import java.io.IOException;
26-
2725
/**
2826
* Convenience class for launching sqlline so can run it under the debugger.
2927
* Be aware that the intellij terminal is dodgy. See
@@ -32,10 +30,9 @@
3230
*/
3331
@ExcludeFromJacocoGeneratedReport // Test utility only.
3432
public class LaunchSQLLine {
35-
public static void main(String[] args/*Ignored*/) throws IOException {
33+
public static void main(String[] args/*Ignored*/) throws Exception {
3634
// Read [SQLLINE-80] to see why maxWidth must be set
37-
sqlline.SqlLine.main(new String []{
38-
"-ac", "com.apple.foundationdb.relational.cli.sqlline.Customize",
35+
com.apple.foundationdb.relational.cli.sqlline.RelationalSQLLine.main(new String []{
3936
"-u", "jdbc:embed:/__SYS",
4037
"--maxWidth=160",
4138
});

fdb-relational-core/src/main/java/com/apple/foundationdb/relational/recordlayer/query/Literals.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,16 @@
2727
import com.google.common.base.Suppliers;
2828
import com.google.common.base.Verify;
2929
import com.google.common.collect.ImmutableList;
30-
import com.google.common.collect.ImmutableMap;
3130
import com.google.common.collect.Lists;
3231
import com.google.common.collect.Multiset;
3332
import com.google.common.collect.TreeMultiset;
3433
import com.google.protobuf.ByteString;
3534

3635
import javax.annotation.Nonnull;
3736
import javax.annotation.Nullable;
37+
import java.util.Collections;
3838
import java.util.HashMap;
39+
import java.util.LinkedHashMap;
3940
import java.util.List;
4041
import java.util.Map;
4142
import java.util.Objects;
@@ -56,12 +57,13 @@ public class Literals {
5657

5758
private Literals(@Nonnull final List<OrderedLiteral> orderedLiterals) {
5859
this.orderedLiterals = ImmutableList.copyOf(orderedLiterals);
60+
// Using unmodifiableMap because it allows null values, which are valid here
61+
// and represent either null constants or null prepared parameters in queries.
5962
this.asMapSupplier = Suppliers.memoize(() ->
60-
this.orderedLiterals
61-
.stream()
62-
.filter(orderedLiteral -> orderedLiteral.getLiteralObject() != null)
63-
.collect(ImmutableMap.toImmutableMap(OrderedLiteral::getConstantId,
64-
OrderedLiteral::getLiteralObject)));
63+
Collections.unmodifiableMap(
64+
this.orderedLiterals
65+
.stream()
66+
.collect(LinkedHashMap::new, (m, v) -> m.put(v.getConstantId(), v.getLiteralObject()), LinkedHashMap::putAll)));
6567
}
6668

6769
@Nonnull

fdb-relational-core/src/main/java/com/apple/foundationdb/relational/recordlayer/query/MutablePlanGenerationContext.java

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
import com.apple.foundationdb.record.query.expressions.Comparisons;
2828
import com.apple.foundationdb.record.query.plan.QueryPlanConstraint;
2929
import com.apple.foundationdb.record.query.plan.cascades.Quantifier;
30+
import com.apple.foundationdb.record.query.plan.cascades.predicates.AndPredicate;
31+
import com.apple.foundationdb.record.query.plan.cascades.predicates.OrPredicate;
3032
import com.apple.foundationdb.record.query.plan.cascades.predicates.QueryPredicate;
3133
import com.apple.foundationdb.record.query.plan.cascades.predicates.ValuePredicate;
3234
import com.apple.foundationdb.record.query.plan.cascades.typing.Type;
@@ -164,8 +166,24 @@ private void addEqualityConstraint(@Nonnull String leftTokenId, @Nonnull String
164166
}
165167
final var leftCov = ConstantObjectValue.of(Quantifier.constant(), leftTokenId, type);
166168
final var rightCov = ConstantObjectValue.of(Quantifier.constant(), rightTokenId, type);
169+
170+
// we can replace the relatively complex predicate below with a much simpler one: (leftCov isNotDistinctFrom rightCov)
171+
// once https://github.com/FoundationDB/fdb-record-layer/issues/3504 is in, but this is ok for now.
172+
173+
// Term1: left != null AND right != null AND left = right
174+
final var leftIsNotNull = new ValuePredicate(leftCov, new Comparisons.NullComparison(Comparisons.Type.NOT_NULL));
175+
final var rightIsNotNull = new ValuePredicate(rightCov, new Comparisons.NullComparison(Comparisons.Type.NOT_NULL));
167176
final var equalityPredicate = new ValuePredicate(leftCov, new Comparisons.ValueComparison(Comparisons.Type.EQUALS, rightCov));
168-
equalityConstraints.add(equalityPredicate);
177+
final var notNullComparison = AndPredicate.and(ImmutableList.of(leftIsNotNull, rightIsNotNull, equalityPredicate));
178+
179+
// Term2: left = null AND right = null
180+
final var leftIsNull = new ValuePredicate(leftCov, new Comparisons.NullComparison(Comparisons.Type.IS_NULL));
181+
final var rightIsNull = new ValuePredicate(rightCov, new Comparisons.NullComparison(Comparisons.Type.IS_NULL));
182+
final var bothAreNullComparison = AndPredicate.and(leftIsNull, rightIsNull);
183+
184+
// Term1 OR Term2
185+
final var constraint = OrPredicate.or(notNullComparison, bothAreNullComparison);
186+
equalityConstraints.add(constraint);
169187
}
170188

171189

fdb-relational-core/src/test/java/com/apple/foundationdb/relational/recordlayer/LogAppenderRule.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
package com.apple.foundationdb.relational.recordlayer;
2222

23+
import com.apple.foundationdb.relational.util.Assert;
2324
import org.apache.logging.log4j.Level;
2425
import org.apache.logging.log4j.LogManager;
2526
import org.apache.logging.log4j.core.LogEvent;
@@ -119,10 +120,16 @@ public boolean lastMessageIsCacheHit() {
119120
}
120121

121122
public boolean lastMessageIsCacheMiss() {
123+
if (logAppender.getLogs().isEmpty()) {
124+
Assert.failUnchecked("attempt to peak logger's last message although the logger is empty (did you forget to add 'options (log query)' maybe?)");
125+
}
122126
return getLastLogEventMessage().contains("planCache=\"miss\"");
123127
}
124128

125129
public boolean lastMessageIsCacheSkip() {
130+
if (logAppender.getLogs().isEmpty()) {
131+
Assert.failUnchecked("attempt to peak logger's last message although the logger is empty (did you forget to add 'options (log query)' maybe?)");
132+
}
126133
return getLastLogEventMessage().contains("planCache=\"skip\"");
127134
}
128135
}

0 commit comments

Comments
 (0)