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

**URL:** <https://forums.foundationdb.org/t/record-layer-saverecord-fails-with-java-util-concurrent-executionexception-com-apple-foundationdb-record-recordcoreexception-expected-only-a-single-key-extension-for-split-record/1887>\
**Category:** Record Layer\
**Created:** [January 17, 2020, 12:24pm UTC](https://forums.foundationdb.org/t/record-layer-saverecord-fails-with-java-util-concurrent-executionexception-com-apple-foundationdb-record-recordcoreexception-expected-only-a-single-key-extension-for-split-record/1887 "2020-01-17T12:24:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rahul-nitkkr](https://sea1.discourse-cdn.com/foundationdb/user_avatar/forums.foundationdb.org/rahul-nitkkr/32/754_2.png) [@rahul-nitkkr](https://forums.foundationdb.org/u/rahul-nitkkr)\
**Post date:** [January 17, 2020, 12:24pm UTC](https://forums.foundationdb.org/t/record-layer-saverecord-fails-with-java-util-concurrent-executionexception-com-apple-foundationdb-record-recordcoreexception-expected-only-a-single-key-extension-for-split-record/1887/1 "2020-01-17T12:24:17Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![MMcM](https://avatars.discourse-cdn.com/v4/letter/m/d07c76/32.png) [@MMcM](https://forums.foundationdb.org/u/MMcM)\
**Post date:** [January 17, 2020, 5:01pm UTC](https://forums.foundationdb.org/t/record-layer-saverecord-fails-with-java-util-concurrent-executionexception-com-apple-foundationdb-record-recordcoreexception-expected-only-a-single-key-extension-for-split-record/1887/2 "2020-01-17T17:01:59Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![rahul-nitkkr](https://sea1.discourse-cdn.com/foundationdb/user_avatar/forums.foundationdb.org/rahul-nitkkr/32/754_2.png) [@rahul-nitkkr](https://forums.foundationdb.org/u/rahul-nitkkr)\
**Post date:** [January 20, 2020, 4:21pm UTC](https://forums.foundationdb.org/t/record-layer-saverecord-fails-with-java-util-concurrent-executionexception-com-apple-foundationdb-record-recordcoreexception-expected-only-a-single-key-extension-for-split-record/1887/3 "2020-01-20T16:21:22Z")

</div>

I tried catching the `RecordCoreException` and then tried the following -

```auto
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 -

```auto
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** -

```auto
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

---

<div class="post-metadata">

**Author:** ![MMcM](https://avatars.discourse-cdn.com/v4/letter/m/d07c76/32.png) [@MMcM](https://forums.foundationdb.org/u/MMcM)\
**Post date:** [January 22, 2020, 5:17pm UTC](https://forums.foundationdb.org/t/record-layer-saverecord-fails-with-java-util-concurrent-executionexception-com-apple-foundationdb-record-recordcoreexception-expected-only-a-single-key-extension-for-split-record/1887/4 "2020-01-22T17:17:40Z")

</div>

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](https://forums.foundationdb.org/t/1818/7), so maybe there could be some explicit check for that.
