Change primary key

Suppose I have the following protobuf

message Object {
  string id = 1;
  string location = 2;  
  string someattr = 3;

And recordlayer defines the PK as the record type plus field id
Does the record layer support changing the PK to be record type, id and location?
Or the PK is backed by an index that has to be updated, and thus will be in write-only mode?

There is no way to change a record’s primary key. In some sense, the primary key is the only identity that the record has, so a different primary key is a different record. But, more fundamentally, the primary key determines the physical location of the serialized record. So if changed, the data needs to be rewritten.

In short, the process involves reading the old record with the old record type and writing new records with the new record type.

The indexes would also be a problem, just as you indicate, since they include the old primary key. But they could be updated by scanning the records themselves.

Rewriting the data is OK, but at this point I might as well create a new record type, write the new data, migrate the old data to the new and delete the old data.

Thanks for your input