@Test public void withoutBumpingVersion() { RecordMetaData metaData = RecordMetaData.build(TestRecords1Proto.getDescriptor()); try (FDBRecordContext context = fdb.openContext()) { openMetaDataStore(context); metaDataStore.saveRecordMetaData(metaData); MetaDataException e = assertThrows(MetaDataException.class, () -> metaDataStore.saveRecordMetaData(metaData)); assertThat(e.getMessage(), containsString("meta-data version must increase")); context.commit(); } }
@API(API.Status.MAINTAINED) public void saveRecordMetaData(@Nonnull Descriptors.FileDescriptor fileDescriptor) { context.asyncToSync(FDBStoreTimer.Waits.WAIT_SAVE_META_DATA, saveRecordMetaDataAsync(fileDescriptor)); }
FDBMetaDataStore extends FDBStoreBase implements RecordMetaDataProvider { @API(API.Status.MAINTAINED) public void saveRecordMetaData(@Nonnull Descriptors.FileDescriptor fileDescriptor) { context.asyncToSync(FDBStoreTimer.Waits.WAIT_SAVE_META_DATA, saveRecordMetaDataAsync(fileDescriptor)); } }
FDBMetaDataStore extends FDBStoreBase implements RecordMetaDataProvider { @API(API.Status.MAINTAINED) public void saveRecordMetaData(@Nonnull Descriptors.FileDescriptor fileDescriptor) { context.asyncToSync(FDBStoreTimer.Waits.WAIT_SAVE_META_DATA, saveRecordMetaDataAsync(fileDescriptor)); } @API(API.Status.UNSTABLE)  FDBMetaDataStore(@Nonnull FDBRecordContext context, @Nonnull Subspace subspace,
                            @Nullable MetaDataCache cache);  FDBMetaDataStore(@Nonnull FDBRecordContext context, @Nonnull KeySpacePath path); }
FDBMetaDataStore extends FDBStoreBase implements RecordMetaDataProvider { @API(API.Status.MAINTAINED) public void saveRecordMetaData(@Nonnull Descriptors.FileDescriptor fileDescriptor) { context.asyncToSync(FDBStoreTimer.Waits.WAIT_SAVE_META_DATA, saveRecordMetaDataAsync(fileDescriptor)); } @API(API.Status.UNSTABLE)  FDBMetaDataStore(@Nonnull FDBRecordContext context, @Nonnull Subspace subspace,
                            @Nullable MetaDataCache cache);  FDBMetaDataStore(@Nonnull FDBRecordContext context, @Nonnull KeySpacePath path); @SpotBugsSuppressWarnings("EI_EXPOSE_REP2") void setDependencies(@Nonnull Descriptors.FileDescriptor[] dependencies); @Nullable Descriptors.FileDescriptor getLocalFileDescriptor(); void setLocalFileDescriptor(@Nullable Descriptors.FileDescriptor localFileDescriptor); @Nonnull MetaDataEvolutionValidator getEvolutionValidator(); void setEvolutionValidator(@Nonnull MetaDataEvolutionValidator evolutionValidator); void setExtensionRegistry(@Nullable ExtensionRegistry extensionRegistry); void setMaintainHistory(boolean maintainHistory); CompletableFuture<RecordMetaDataProto.MetaData> loadAndSetCurrent(boolean checkCache, int currentVersion); CompletableFuture<RecordMetaData> loadVersion(int version); @Nonnull CompletableFuture<Void> saveAndSetCurrent(@Nonnull RecordMetaDataProto.MetaData metaDataProto); CompletableFuture<RecordMetaData> getRecordMetaDataAsync(boolean errorIfMissing); @Nonnull CompletableFuture<Void> preloadMetaData(@Nullable RecordMetaDataProvider metaDataProvider); @Nonnull @Override RecordMetaData getRecordMetaData(); @API(API.Status.MAINTAINED) void saveRecordMetaData(@Nonnull Descriptors.FileDescriptor fileDescriptor); void saveRecordMetaData(@Nonnull RecordMetaDataProvider metaDataProvider); void saveRecordMetaData(@Nonnull RecordMetaDataProto.MetaData metaDataProto); @API(API.Status.MAINTAINED) CompletableFuture<Void> saveRecordMetaDataAsync(@Nonnull Descriptors.FileDescriptor fileDescriptor); void addIndex(@Nonnull String recordType, @Nonnull String indexName, @Nonnull String fieldName); void addIndex(@Nonnull String recordType, @Nonnull String indexName, @Nonnull KeyExpression indexExpression); void addIndex(@Nonnull String recordType, @Nonnull Index index); @Nonnull CompletableFuture<Void> addIndexAsync(@Nonnull String recordType, @Nonnull String indexName, @Nonnull String fieldName); @Nonnull CompletableFuture<Void> addIndexAsync(@Nonnull String recordType, @Nonnull String indexName,
                                                 @Nonnull KeyExpression indexExpression); @Nonnull CompletableFuture<Void> addIndexAsync(@Nonnull String recordType, @Nonnull Index index); void addMultiTypeIndex(@Nullable List<String> recordTypes, @Nonnull Index index); @Nonnull CompletableFuture<Void> addMultiTypeIndexAsync(@Nullable List<String> recordTypes, @Nonnull Index index); void addUniversalIndex(@Nonnull Index index); @Nonnull CompletableFuture<Void> addUniversalIndexAsync(@Nonnull Index index); void dropIndex(@Nonnull String indexName); @Nonnull CompletableFuture<Void> dropIndexAsync(@Nonnull String indexName); @API(API.Status.MAINTAINED) void updateRecords(@Nonnull Descriptors.FileDescriptor recordsDescriptor); @Nonnull @API(API.Status.MAINTAINED) CompletableFuture<Void> updateRecordsAsync(@Nonnull Descriptors.FileDescriptor recordsDescriptor); void mutateMetaData(@Nonnull Consumer<RecordMetaDataProto.MetaData.Builder> mutateMetaDataProto); void mutateMetaData(@Nonnull Consumer<RecordMetaDataProto.MetaData.Builder> mutateMetaDataProto,
                               @Nullable Consumer<RecordMetaDataBuilder> mutateRecordMetaDataBuilder); @Nonnull CompletableFuture<Void> mutateMetaDataAsync(@Nonnull Consumer<RecordMetaDataProto.MetaData.Builder> mutateMetaDataProto); @Nonnull CompletableFuture<Void> mutateMetaDataAsync(@Nonnull Consumer<RecordMetaDataProto.MetaData.Builder> mutateMetaDataProto,
                                                       @Nullable Consumer<RecordMetaDataBuilder> mutateRecordMetaDataBuilder); void updateStoreRecordVersions(boolean storeRecordVersions); @Nonnull CompletableFuture<Void> updateStoreRecordVersionsAsync(boolean storeRecordVersions); void enableSplitLongRecords(); @Nonnull CompletableFuture<Void> enableSplitLongRecordsAsync(); @Nullable @VisibleForTesting MetaDataCache getCache(); }
FDBMetaDataStore extends FDBStoreBase implements RecordMetaDataProvider { @API(API.Status.MAINTAINED) public void saveRecordMetaData(@Nonnull Descriptors.FileDescriptor fileDescriptor) { context.asyncToSync(FDBStoreTimer.Waits.WAIT_SAVE_META_DATA, saveRecordMetaDataAsync(fileDescriptor)); } @API(API.Status.UNSTABLE)  FDBMetaDataStore(@Nonnull FDBRecordContext context, @Nonnull Subspace subspace,
                            @Nullable MetaDataCache cache);  FDBMetaDataStore(@Nonnull FDBRecordContext context, @Nonnull KeySpacePath path); @SpotBugsSuppressWarnings("EI_EXPOSE_REP2") void setDependencies(@Nonnull Descriptors.FileDescriptor[] dependencies); @Nullable Descriptors.FileDescriptor getLocalFileDescriptor(); void setLocalFileDescriptor(@Nullable Descriptors.FileDescriptor localFileDescriptor); @Nonnull MetaDataEvolutionValidator getEvolutionValidator(); void setEvolutionValidator(@Nonnull MetaDataEvolutionValidator evolutionValidator); void setExtensionRegistry(@Nullable ExtensionRegistry extensionRegistry); void setMaintainHistory(boolean maintainHistory); CompletableFuture<RecordMetaDataProto.MetaData> loadAndSetCurrent(boolean checkCache, int currentVersion); CompletableFuture<RecordMetaData> loadVersion(int version); @Nonnull CompletableFuture<Void> saveAndSetCurrent(@Nonnull RecordMetaDataProto.MetaData metaDataProto); CompletableFuture<RecordMetaData> getRecordMetaDataAsync(boolean errorIfMissing); @Nonnull CompletableFuture<Void> preloadMetaData(@Nullable RecordMetaDataProvider metaDataProvider); @Nonnull @Override RecordMetaData getRecordMetaData(); @API(API.Status.MAINTAINED) void saveRecordMetaData(@Nonnull Descriptors.FileDescriptor fileDescriptor); void saveRecordMetaData(@Nonnull RecordMetaDataProvider metaDataProvider); void saveRecordMetaData(@Nonnull RecordMetaDataProto.MetaData metaDataProto); @API(API.Status.MAINTAINED) CompletableFuture<Void> saveRecordMetaDataAsync(@Nonnull Descriptors.FileDescriptor fileDescriptor); void addIndex(@Nonnull String recordType, @Nonnull String indexName, @Nonnull String fieldName); void addIndex(@Nonnull String recordType, @Nonnull String indexName, @Nonnull KeyExpression indexExpression); void addIndex(@Nonnull String recordType, @Nonnull Index index); @Nonnull CompletableFuture<Void> addIndexAsync(@Nonnull String recordType, @Nonnull String indexName, @Nonnull String fieldName); @Nonnull CompletableFuture<Void> addIndexAsync(@Nonnull String recordType, @Nonnull String indexName,
                                                 @Nonnull KeyExpression indexExpression); @Nonnull CompletableFuture<Void> addIndexAsync(@Nonnull String recordType, @Nonnull Index index); void addMultiTypeIndex(@Nullable List<String> recordTypes, @Nonnull Index index); @Nonnull CompletableFuture<Void> addMultiTypeIndexAsync(@Nullable List<String> recordTypes, @Nonnull Index index); void addUniversalIndex(@Nonnull Index index); @Nonnull CompletableFuture<Void> addUniversalIndexAsync(@Nonnull Index index); void dropIndex(@Nonnull String indexName); @Nonnull CompletableFuture<Void> dropIndexAsync(@Nonnull String indexName); @API(API.Status.MAINTAINED) void updateRecords(@Nonnull Descriptors.FileDescriptor recordsDescriptor); @Nonnull @API(API.Status.MAINTAINED) CompletableFuture<Void> updateRecordsAsync(@Nonnull Descriptors.FileDescriptor recordsDescriptor); void mutateMetaData(@Nonnull Consumer<RecordMetaDataProto.MetaData.Builder> mutateMetaDataProto); void mutateMetaData(@Nonnull Consumer<RecordMetaDataProto.MetaData.Builder> mutateMetaDataProto,
                               @Nullable Consumer<RecordMetaDataBuilder> mutateRecordMetaDataBuilder); @Nonnull CompletableFuture<Void> mutateMetaDataAsync(@Nonnull Consumer<RecordMetaDataProto.MetaData.Builder> mutateMetaDataProto); @Nonnull CompletableFuture<Void> mutateMetaDataAsync(@Nonnull Consumer<RecordMetaDataProto.MetaData.Builder> mutateMetaDataProto,
                                                       @Nullable Consumer<RecordMetaDataBuilder> mutateRecordMetaDataBuilder); void updateStoreRecordVersions(boolean storeRecordVersions); @Nonnull CompletableFuture<Void> updateStoreRecordVersionsAsync(boolean storeRecordVersions); void enableSplitLongRecords(); @Nonnull CompletableFuture<Void> enableSplitLongRecordsAsync(); @Nullable @VisibleForTesting MetaDataCache getCache(); static final Tuple CURRENT_KEY; static final Tuple HISTORY_KEY_PREFIX; static final Tuple OLD_FORMAT_KEY; }