use of com.apple.foundationdb.record.RecordMetaDataBuilder in project fdb-record-layer by FoundationDB.
the class MetaDataValidatorTest method badIndexLastModifiedVersion.
@Test
public void badIndexLastModifiedVersion() {
RecordMetaDataBuilder metaData = RecordMetaData.newBuilder().setRecords(TestRecords1Proto.getDescriptor());
metaData.getIndex("MySimpleRecord$str_value_indexed").setLastModifiedVersion(metaData.getVersion() + 1);
assertInvalid("Index MySimpleRecord$str_value_indexed has last modified version " + (metaData.getVersion() + 1) + " which is greater than the meta-data version " + metaData.getVersion(), metaData);
}
use of com.apple.foundationdb.record.RecordMetaDataBuilder in project fdb-record-layer by FoundationDB.
the class MetaDataValidatorTest method duplicateIntegralFormerAndCurrentSubspaceKeys.
@Test
public void duplicateIntegralFormerAndCurrentSubspaceKeys() {
RecordMetaDataBuilder metaData = RecordMetaData.newBuilder().setRecords(TestRecords1Proto.getDescriptor());
metaData.getIndex("MySimpleRecord$str_value_indexed").setSubspaceKey(42L);
metaData.removeIndex("MySimpleRecord$str_value_indexed");
metaData.getIndex("MySimpleRecord$num_value_3_indexed").setSubspaceKey(42);
assertInvalid("Same subspace key 42 used by index MySimpleRecord$num_value_3_indexed and former index MySimpleRecord$str_value_indexed", metaData);
}
use of com.apple.foundationdb.record.RecordMetaDataBuilder in project fdb-record-layer by FoundationDB.
the class MetaDataValidatorTest method indexAddedAfterLastModifiedVersion.
@Test
public void indexAddedAfterLastModifiedVersion() {
RecordMetaDataBuilder metaData = RecordMetaData.newBuilder().setRecords(TestRecords1Proto.getDescriptor());
metaData.getIndex("MySimpleRecord$str_value_indexed").setAddedVersion(metaData.getVersion());
metaData.getIndex("MySimpleRecord$str_value_indexed").setLastModifiedVersion(metaData.getVersion() - 1);
assertInvalid("Index MySimpleRecord$str_value_indexed has added version " + metaData.getVersion() + " which is greater than the last modified version " + (metaData.getVersion() - 1), metaData);
}
use of com.apple.foundationdb.record.RecordMetaDataBuilder in project fdb-record-layer by FoundationDB.
the class MetaDataValidatorTest method duplicateFormerSubspaceKey.
@Test
public void duplicateFormerSubspaceKey() {
RecordMetaDataBuilder metaData = RecordMetaData.newBuilder().setRecords(TestRecords1Proto.getDescriptor());
metaData.getIndex("MySimpleRecord$str_value_indexed").setSubspaceKey("same");
metaData.removeIndex("MySimpleRecord$str_value_indexed");
metaData.getIndex("MySimpleRecord$num_value_3_indexed").setSubspaceKey("same");
metaData.removeIndex("MySimpleRecord$num_value_3_indexed");
assertInvalid("Same subspace key same used by two former indexes MySimpleRecord$num_value_3_indexed and MySimpleRecord$str_value_indexed", metaData);
RecordMetaDataProto.MetaData.Builder protoBuilder = metaData.build(false).toProto().toBuilder();
protoBuilder.getFormerIndexesBuilder(0).clearFormerName();
protoBuilder.getFormerIndexesBuilder(1).clearFormerName();
metaData = RecordMetaData.newBuilder().setRecords(protoBuilder.build());
assertInvalid("Same subspace key same used by two former indexes <unknown> and <unknown>", metaData);
}
use of com.apple.foundationdb.record.RecordMetaDataBuilder in project fdb-record-layer by FoundationDB.
the class MetaDataValidatorTest method badIndexAddedVersion.
@Test
public void badIndexAddedVersion() {
RecordMetaDataBuilder metaData = RecordMetaData.newBuilder().setRecords(TestRecords1Proto.getDescriptor());
metaData.getIndex("MySimpleRecord$str_value_indexed").setAddedVersion(metaData.getVersion() + 1);
metaData.getIndex("MySimpleRecord$str_value_indexed").setLastModifiedVersion(metaData.getVersion() + 1);
assertInvalid("Index MySimpleRecord$str_value_indexed has added version " + (metaData.getVersion() + 1) + " which is greater than the meta-data version " + metaData.getVersion(), metaData);
}
Aggregations