Record layer saveRecord fails with ***java.util.concurrent.ExecutionException: com.apple.foundationdb.record.RecordCoreException: Expected only a single key extension for split record***

Record layer

We’re seeing intermittent exceptions when using record layer to persist records using ‘saveRecord/async’ since upgrading to 2.8.91.

Debugging the issue, it appears that the unpackKey happening during the

FDBRecordStore#loadExistingRecord from saveRecord returns a tuple with first element as null.

Our setup has setSplitLongRecords set to true, but I have verified that none of the records are actually split since we aren’t breaching the 100kb size limit for splits to happen.
Any ideas here what might be the issue ?

We had initially suspected rewriting the record is triggering this, but have seen cases for new record inserts as well.

Does your environment report LoggableException.getLogInfo? If so, what do the subspace and key there look like? If not, handling that might help narrow it down.

I tried catching the RecordCoreException and then tried the following -

new LogabbleException(e).getLogInfo() //where e is the above exception of split record

which returns an empty map.
Is there something else you referred to ?

Interestingly , this has started coming up when we are doing a metadata fetch from FDB as well while opening up a record store.
This works -

RecordMetaDataBuilder metadataBuilder = RecordMetaData.newBuilder().setRecords(LocalDescriptor.getDescriptor());
        addPrimaryKeys(metadataBuilder);
        metadataBuilder.setSplitLongRecords(true);

        FDBRecordStore store = FDBRecordStore.newBuilder()
                .setContext(context)
                .setKeySpacePath(getKeyspacePath("Foo"))
                .setMetaDataProvider(metadataBuilder.build())                
                .createOrOpen();

and this doesn’t -

FDBMetaDataStore metaDataStore = getDefaultMetadataStore(context);
      
        addPrimaryKeys(metadataBuilder);
        metadataBuilder.setSplitLongRecords(true);
        try {
            FDBRecordStore store = FDBRecordStore.newBuilder()
                    .setContext(context)
                    .setKeySpacePath(getKeyspacePath("Foo"))                    
                    .setMetaDataStore(metaDataStore)
                    .createOrOpen();

            return store;
        } catch (RecordCoreException e) {
            System.out.println(new LoggableException(e).getLogInfo());
            throw new RuntimeException(e);
        }

The only change in the above snippets is the way we are fetching the metadata

I meant getLogInfo from the RecordCoreException itself. It looks like that method doesn’t combine causes, so you’re only seeing the one just created.

Since the problem only occurs when using FDBMetaDataStore, I wonder whether you are storing that in the same (that is, overlapping) keyspace as the records. That happened here, so maybe there could be some explicit check for that.