39
39
import com .apple .foundationdb .relational .recordlayer .metadata .serde .RecordMetadataSerializer ;
40
40
import com .apple .foundationdb .relational .util .Assert ;
41
41
42
+ import com .google .common .annotations .VisibleForTesting ;
42
43
import com .google .common .base .Supplier ;
43
44
import com .google .common .base .Suppliers ;
44
45
import com .google .common .collect .ImmutableList ;
@@ -95,18 +96,22 @@ public final class RecordLayerSchemaTemplate implements SchemaTemplate {
95
96
@ Nonnull
96
97
private final Supplier <String > transactionBoundMetadataSupplier ;
97
98
99
+ private final boolean intermingleTables ;
100
+
98
101
private RecordLayerSchemaTemplate (@ Nonnull final String name ,
99
102
@ Nonnull final Set <RecordLayerTable > tables ,
100
103
@ Nonnull final Set <RecordLayerInvokedRoutine > invokedRoutines ,
101
104
int version ,
102
105
boolean enableLongRows ,
103
- boolean storeRowVersions ) {
106
+ boolean storeRowVersions ,
107
+ boolean intermingleTables ) {
104
108
this .name = name ;
105
109
this .tables = ImmutableSet .copyOf (tables );
106
110
this .invokedRoutines = ImmutableSet .copyOf (invokedRoutines );
107
111
this .version = version ;
108
112
this .enableLongRows = enableLongRows ;
109
113
this .storeRowVersions = storeRowVersions ;
114
+ this .intermingleTables = intermingleTables ;
110
115
this .metaDataSupplier = Suppliers .memoize (this ::buildRecordMetadata );
111
116
this .tableIndexMappingSupplier = Suppliers .memoize (this ::computeTableIndexMapping );
112
117
this .indexesSupplier = Suppliers .memoize (this ::computeIndexes );
@@ -120,13 +125,15 @@ private RecordLayerSchemaTemplate(@Nonnull final String name,
120
125
int version ,
121
126
boolean enableLongRows ,
122
127
boolean storeRowVersions ,
128
+ boolean intermingleTables ,
123
129
@ Nonnull final RecordMetaData cachedMetadata ) {
124
130
this .name = name ;
125
131
this .version = version ;
126
132
this .tables = ImmutableSet .copyOf (tables );
127
133
this .invokedRoutines = ImmutableSet .copyOf (invokedRoutines );
128
134
this .enableLongRows = enableLongRows ;
129
135
this .storeRowVersions = storeRowVersions ;
136
+ this .intermingleTables = intermingleTables ;
130
137
this .metaDataSupplier = Suppliers .memoize (() -> cachedMetadata );
131
138
this .tableIndexMappingSupplier = Suppliers .memoize (this ::computeTableIndexMapping );
132
139
this .indexesSupplier = Suppliers .memoize (this ::computeIndexes );
@@ -155,6 +162,11 @@ public boolean isStoreRowVersions() {
155
162
return storeRowVersions ;
156
163
}
157
164
165
+ @ VisibleForTesting
166
+ public boolean isIntermingleTables () {
167
+ return intermingleTables ;
168
+ }
169
+
158
170
@ Nonnull
159
171
@ Override
160
172
public Set <RecordLayerTable > getTables () {
@@ -560,10 +572,10 @@ public RecordLayerSchemaTemplate build() {
560
572
561
573
if (cachedMetadata != null ) {
562
574
return new RecordLayerSchemaTemplate (name , new LinkedHashSet <>(tables .values ()),
563
- new LinkedHashSet <>(invokedRoutines .values ()), version , enableLongRows , storeRowVersions , cachedMetadata );
575
+ new LinkedHashSet <>(invokedRoutines .values ()), version , enableLongRows , storeRowVersions , intermingleTables , cachedMetadata );
564
576
} else {
565
577
return new RecordLayerSchemaTemplate (name , new LinkedHashSet <>(tables .values ()),
566
- new LinkedHashSet <>(invokedRoutines .values ()), version , enableLongRows , storeRowVersions );
578
+ new LinkedHashSet <>(invokedRoutines .values ()), version , enableLongRows , storeRowVersions , intermingleTables );
567
579
}
568
580
}
569
581
@@ -681,6 +693,7 @@ public Builder toBuilder() {
681
693
.setName (name )
682
694
.setVersion (version )
683
695
.setEnableLongRows (enableLongRows )
696
+ .setIntermingleTables (intermingleTables )
684
697
.addTables (getTables ())
685
698
.addInvokedRoutines (getInvokedRoutines ());
686
699
}
0 commit comments