Patent Description:
The accompanying drawings, which are included to provide a further understanding of the disclosed subject matter, are incorporated in and constitute a part of this specification. The drawings also illustrate implementations of the disclosed subject matter and together with the detailed description serve to explain the principles of implementations of the disclosed subject matter. No attempt is made to show structural details in more detail than may be necessary for a fundamental understanding of the disclosed subject matter and various ways in which it may be practiced.

Techniques disclosed herein enable translation of tenant identifiers, which may allow for more efficient translation of tenant identifiers used to identify the owner of database records. A record that includes a tenant identifier column which stores the value of the tenant identifier may have the value of tenant identifier removed from the tenant identifier column. If the value of the tenant identifier is stored in columns of the record other than the tenant identifier column, for example, in encoded form, a bitmap may be created which may indicate which columns of the record store the value of the tenant identifier. The value of the tenant identifier may then be removed from the columns of the record which store the value of the tenant identifier. The value of the tenant identifier and the bitmap may be stored in the record header of the record. The record may also include a key which may identify the record in a multi-tenant database. The key for a record may include the value of the tenant identifier. The value for the tenant identifier may be retrieved from the key for the record, or from a scan descriptor for a query that identified the record, when a record which has had the value its tenant identifier removed from its columns is unpacked. When tenant identifier translation is needed for the record, the value of the tenant identifier in the key for the record may be replaced with a new value, for a new tenant identifier. The bitmap in the record header may be used to identify the columns of the record which had previously stored the value of the tenant identifier. The metadata for the identified columns may be checked to determine if the columns have tenant identifier translation enabled. The new value of the tenant identifier may be used as the value of those columns identified by the bitmap whose metadata indicate that tenant identifier translation is enabled. Columns identified by the bitmap whose metadata indicate that they do not need tenant identifier translation may have the value of the tenant identifier taken from the record header of the record used as their column value.

A tenant identifier may be used to identify the owner of records stored in a database system. The value of a tenant identifier assigned to a tenant may be used as part of the key for all of the records belonging to the tenant that may be stored in the database system. The value of a tenant identifier may be represented as, for example, an alphanumeric string.

If the database system is a multi-tenant database system, a unique tenant identifier may be assigned to each of its tenants. Multi-tenancy may allow various tenants, which may be, for example, users, groups of users, or organizations, to access their own records in the database system through software tools or instances on the database system that may be shared among the various tenants. The records for each tenant may be part of a record set for that tenant. The database may be, for example, a relational database, hierarchical database, or any other suitable database type. All records stored in the database system may be stored in any suitable structure, including, for example, a Log-Structured Merge (LSM) tree.

A record stored in the database system may include a key. The key may be an identifier for the record, for example, a primary key, and may be in any suitable form, such as, for example, an alphanumeric sequence. Portions of the key may provide information about the record. For example, a portion of the key be the value of the tenant identifier for the tenant to whom the record belongs. Other portions of the key may identify, for example, a table number and identification of a row, for example, when the value of record is the contents of a row.

A record may include values. The values in a record may be, for example, the contents of columns in a row of a table of a relational database, stored as a tuple with one value per column. The values stored as a tuple may be encoded, for example, using a binary encoding. Some records may store the value of the tenant identifier for the tenant that owns the record encoded in the tuple as an encoded value of the tenant identifier. The encoded value of the tenant identifier may be stored in, for example, a tenant identifier column of the record. The encoded value of the tenant identifier may also be stored in other columns of the record which may not be tenant identifier columns.

In some situations, the tenant identifier of a record may need to be translated. Tenant identifier translation may replace the value of a tenant identifier in a record with a new value, of a new tenant identifier. For example, when records in a tenant's record set are copied to create a clone of all or a portion of the tenant's record set, for example, for sandboxing, tenant identifier translation may be used to assign a new tenant identifier to the copied records. This may allow records in a sandbox database to be used by the tenant independently of the records in the tenant's record set which was cloned.

To allow for more efficient tenant identifier translation, the records stored in the database system may be modified. A record may have the encoded value of the tenant identifier removed from its tenant identifier column. The attribute number of the tenant identifier column may be stored in the record header of the record. A record type indicator may be set in the record header. The record type indicator may be a bit that may be set to <NUM>, or true, to indicate that the record has had the encoded value of the tenant identifier removed from its tenant identifier column. A record which also stores the encoded value of the tenant identifier in columns other than the tenant identifier column may have a bitmap generated. The bitmap generated for a record may indicate which columns of the record store the encoded value of the tenant identifier. The encoded value of the tenant identifier may then be removed from the columns of the record which stored the encoded value of the tenant identifier. The encoded value of the tenant identifier and the bitmap may be stored in a record header of the record. A bitmap indicator may be set in the record header to indicate the presence of both the bitmap and the encoded value of the tenant identifier. The bitmap indicator may be a bit, which may be set to <NUM>, or true, to indicate that the record header stores the bitmap and the encoded value of the tenant identifier. This may result in a record which does not store the value of the tenant identifier, or an encoded value of the tenant identifier, in its columns.

The bitmap may be in any suitable format. For example, the bitmap for a record may be stored as a binary string with a number of digits equal to, or one less than, the number of columns in the record. Each bit of the binary string may correspond to a column of the record, so that there may be a bit in the binary string for every column of the record, or for every column that is not the tenant identifier column. When the bitmap is generated, the bit corresponding to a column may be set to <NUM> when that column stores an encoded value of the tenant identifier, and to <NUM> when that column does not store an encoded value of the tenant identifier.

A record may be modified to remove the value of tenant identifier from the columns of the record when, for example, the record is packed to its in-storage representation, which may be before being written to persistent storage of the database system.

When a record which has the encoded value of the tenant identifier removed from its columns is read from persistent storage into the working memory of the database system the value for the tenant identifier to use with the tenant identifier column of the record may be retrieved from the key for the record, or from a scan descriptor for a query that identified the record. For example, the key for the record may be an alphanumeric string that may include, as a portion, the value of the tenant identifier for the tenant that owns the record. The value for the tenant identifier may be retrieved from the key for the record. A scan descriptor for a query submitted to the database system may also include the value of the tenant identifier for the tenant that owns the records in the database against which the query will be run to find responsive records. The scan descriptor may receive the value of the tenant identifier from, for example, an executor running on the database system. The value of the tenant identifier may be retrieved from the scan descriptor of the query to which the record was responsive. The value of the tenant identifier, as retrieved from the key or the scan descriptor, may be encoded and the resultant encoded value of the tenant identifier may be used to fill in the tenant identifier column of the record while the record is in the working memory of the database system. The tenant identifier column of the record may be identified by the attribute number of the tenant identifier column stored in the record header. If the record header of the record stores a bitmap, the encoded value of the tenant identifier may be used while the record is in working memory to fill in the columns identified by the bitmap as having previously stored the encoded value of the tenant identifier. When the record is packed in working memory before being transferred to persistent storage, the encoded value of the tenant identifier may again be removed from the tenant identifier column and any other columns in which it is stored before the record is packed.

When tenant identifier translation is needed for the record, the value of the tenant identifier in the key for the record may be replaced with a new value for a new tenant identifier. For example, the key for the record may be rewritten by the executor of the database system, replacing the value of the tenant identifier with the new value for the tenant identifier. This may change the tenant identified as the owner of a record by the database system, and the tenant record set to which the record belongs. For example, when a tenant's record set is cloned for sandboxing, the records copied from the tenant's record set to form the sandbox database may need new tenant identifiers to allow the records in the sandbox database to be worked with separately from the records in the tenant's record set. A new value for a tenant identifier may be used to replace the value for the tenant identifier in the keys for the records in the sandbox database. When a record that has had its key rewritten with a new value for a tenant identifier is read into working memory, the database system may encode the new value for the tenant identifier and use the encoded new value of the tenant identifier to fill in the tenant identifier column of the record. The tenant identifier column of the record may be identified by the attribute number for the table identifier column stored in the record header of the record.

The executor of the database system may fill in columns of the record which had previously stored the encoded value of tenant identifier when the record is copied to working memory of the database system. The presence of such columns in a record may be indicated by the value of the bitmap indicator bit in the record header, which may be set, for example, to <NUM>, to indicate the presence of both the bitmap and the encoded value of the tenant identifier in the record header. The bitmap stored in the record header of the record may be used to identify the columns that had stored the encoded value of the tenant identifier. For columns of the record that the bitmap indicates had previously stored the encoded value of the tenant identifier, metadata for the column may be accessed to determine if tenant identifier translation is enabled for that type of column.

The metadata for a column may be part of a system catalog for the database system. For example, the type of a column may be stored in the system catalog. The system catalog may include metadata for all types of columns which may include an indication, for example, in the form of a Boolean variable, of whether tenant identifier translation is enabled for that type of column. Tenant identifier translation may not be enabled for any type of column that is part of a secondary index in the database system.

If the metadata indicates that tenant identifier translation is enabled for the column type of the column identified by the bitmap of the record, the executor of the database system may retrieve the new value of the tenant identifier from the key or the scan descriptor to be encoded and filled in as the value of the column. If the metadata indicates that tenant identifier translation is not enabled for the column type of the column identified by the bitmap, the executor of the database system may retrieve the encoded value of the tenant identifier from the record header to use as the value of the column. The encoded value of the tenant identifier from the record header may be an encoding of the original value of the tenant identifier even when the value of the tenant identifier in the key has been replaced with the new value of the new tenant identifier. This may allow the use of the proper value of the tenant identifier, either the original value or the new value, in the columns of a record that had previously stored the encoding of the original value of the tenant identifier and no longer store any value of the tenant identifier in the copy of the record in persistent storage.

For columns of a record identified by the bitmap in the record header that are of a column type for which tenant identifier translation is not enabled, for example due to the column being part of a secondary index, a database application may determine whether to apply tenant identifier translation. The database application may be an application used to interact with the database system. For example, a computing device running the database application may be used by a tenant to access its database in the database system.

In some implementations, there may a be regular database index that may be used to locate records that may need tenant identifier translation, or the number of records that may need tenant identifier translation may be small, for example, as they may be the records of a small table of the database. The regular database index may be used when records include columns that translation may not be enabled for, such as columns that are used in secondary indexes. An update command may be implemented by the database system that may update records that may need tenant identifier translation before a sandbox database with the records, which may be cloned from the tenant's original records, is made available to users, for example, to access through the database application. The update command may perform tenant identifier translation by walking all of the columns of the records indexed by the regular database index, or all of the records which may need tenant identifier translation and replacing any value in column that matches the encoded value of the tenant identifier with an encoded new value of the tenant identifier.

<FIG> shows an example system for translation of tenant identifiers according to an implementation of the disclosed subject matter. A database system <NUM> may include any suitable computing devices, such as, for example, a computer <NUM> as described in <FIG> or component thereof, for translation of tenant identifiers. The database system <NUM> may be implemented on a laptop, a desktop, an individual server, a server cluster, a server farm, or a distributed server system, or can be implemented as a virtual computing device or system, or any suitable combination of physical and virtual systems. The database system <NUM> can be part of a computing system and network infrastructure or can be otherwise connected to the computing system and network infrastructure, including a larger server network which can include other server systems. The database system <NUM> may include, for example, any number of server systems which may be in communication with each other and may communicate in any suitable manner. For example, the server systems of the database system <NUM> may be connected through any suitable network, which may be any suitable combination of LANs and WANs, including any combination of private networks and the Internet. The database system <NUM> may include a database executor <NUM> and a storage <NUM>. The storage <NUM> may include persistent storage <NUM> and working storage <NUM>. Records <NUM> and system catalog <NUM> may be stored in the persistent storage <NUM>.

The database executor <NUM> may be any suitable combination of hardware and software of the database system <NUM> for interacting with and managing databases stored on the database system <NUM>. The database system <NUM> may be, for example, a multi-tenant database system which may store databases for multiple tenants. The records <NUM> may include records for the databases for the multiple tenants of the database system <NUM>. The database executor <NUM> may be able to retrieve records from the records <NUM> for a tenant based on a received query with a scan descriptor and may be able to manipulate records from the records <NUM>. For example, the database executor <NUM> may be able to copy records from the persistent storage <NUM> to the working storage <NUM>, update records with new values, merge records from the working storage <NUM> back to the persistent storage <NUM> and create new copies of records in the records <NUM>, for example, when cloning a tenant's record set during the creation of a sandbox database.

The persistent storage <NUM> may be any suitable combination of hardware and software for the persistent storage of data, such as the records <NUM> and the system catalog <NUM>. For example, the persistent storage <NUM> may include hard drives, solid state drives, or other forms of persistent data storage. The persistent storage <NUM> may be distributed across any number of computing devices. The working storage <NUM> may be any suitable combination of hardware and software for storage of data which may be persistent or non-persistent and may be used to allow for records from the records <NUM> to be operated with outside of the persistent storage <NUM>. For example, the working storage <NUM> may include hard drives, solid state drives, random access memory, or other forms of data storage which may be persistent or non-persistent.

The records <NUM> may include records for the databases of the various tenants of the database system <NUM>. Records in the records <NUM> may include a tenant identifier to identify the owner of the records. The tenant identifier assigned to a tenant may be used as part of the key for all of the records belonging to the tenant that may be stored in the database. The value of a tenant identifier may be represented as, for example, an alphanumeric string. A unique tenant identifier may be assigned to each of the tenants of the database system <NUM>. Multi-tenancy may allow various tenants, which may be, for example, users, groups of users, or organizations, to access their own records in the database system <NUM> through software tools or instances on the database system <NUM> that may be shared among the various tenants. The record set for each tenant, including records stored in the records <NUM>, may be, for example, a relational database, hierarchical database, or any other suitable database type. The records <NUM> may be stored in the persistent storage <NUM> of the database system <NUM> in any suitable structure, including, for example, a Log-Structured Merge (LSM) tree. The records may be stored immutable, so that updates to a record after the record is created result in the creation of a new version of the record without making any changes to the stored previous version of the record.

A record from the records <NUM> stored in the database system <NUM> may include a key. The key may be an identifier for the record, for example, a primary key, and may be in any suitable form, such as, for example, an alphanumeric sequence. Portions of the key may provide information about the record. For example, a portion of the key be the tenant identifier for the tenant to whom the record belongs. Other portions of the key may identify, for example, a table number and identification of a row, for example, when the value of record is the contents of a row.

A record may include values. The values in a record may be, for example, the contents of columns in a row of a table of a relational database, stored as a tuple with one value per column. The values stored as a tuple may be encoded, for example, using a binary encoding. Some records may store an encoded value of the tenant identifier for the tenant that owns the record in the tuple. The encoded value of the tenant identifier may be stored in, for example, a tenant identifier column of the record. The encoded value of the tenant identifier may also be stored in other columns of the record which may not be tenant identifier columns.

The system catalog <NUM> may include metadata for tenant's record sets stored in the database system <NUM>. For example, the system catalog <NUM> may include metadata describing properties of the various column types used in the records of the records <NUM> for a tenant's record set.

<FIG> shows an example arrangement for translation of tenant identifiers according to an implementation of the disclosed subject matter. A record <NUM> from the records <NUM> may copied into the working memory <NUM>, for example, by the database executor <NUM> in response to a query to the database system <NUM>. The database executor <NUM> may unpack the record <NUM>, for example, expanding the tuple of the record <NUM> into columns. The record <NUM> may include a key <NUM>, a record header <NUM>, and values <NUM>. The key <NUM> may be the key used to identify the record <NUM> in the tenant's record set and may include a tenant identifier <NUM> and key data <NUM>. The tenant identifier <NUM> may be a value of the tenant identifier <NUM> for the tenant that owns the record <NUM>. The key data <NUM> may be other data included in the key <NUM>, such as, for example, a table number and identification of a row of the table for the record <NUM>. The key <NUM> may be stored in the form of an alphanumeric string which may be a concatenation of the tenant identifier <NUM> and the key data <NUM>.

The record header <NUM> may be a portion of the record <NUM> which may store metadata and other additional data for the record <NUM> that is outside of the values <NUM>. For example, the record header <NUM> may include indicators, for example, as bits that can be set to <NUM>, or true, or <NUM>, or false, to indicate properties of the record <NUM>.

The values <NUM> of the record <NUM> may include the values stored in the columns of the record <NUM>. The values <NUM> may form a tuple. The columns of the record <NUM> may be based on the columns of the table of the tenant's record set to which the record <NUM> belongs, for example, as identified in the key data <NUM>. For example, the columns may be a tenant identifier column <NUM> and data columns <NUM>, <NUM>, <NUM>, and <NUM>. The tenant identifier column <NUM> may be a column that stores an encoded tenant identifier <NUM>, which may be an encoding of the value of the tenant identifier <NUM>. The encoding may be, for example, a binary encoding. The data columns <NUM>, <NUM>, <NUM>, and <NUM>, may be columns that store various types of data for the record, such as, for example, character strings of set or varying lengths, or numbers. For example, the data column <NUM> may store a column value <NUM>, which may be an encoding of a value, such as a character string or number. The data column <NUM> may store a column value <NUM>, which may be an encoding of a value, such as a character string or number. In some records of the records <NUM> for a tenant, the encoded value of the tenant identifier may be stored in the columns of the record that are not the tenant identifier column. For example, the record <NUM> may store the encoded tenant identifier <NUM> in the data columns <NUM> and <NUM> in addition to the tenant identifier column <NUM>.

<FIG> shows an example arrangement for translation of tenant identifiers according to an implementation of the disclosed subject matter. The data executor <NUM> may convert a record, such as the record <NUM>, that is in the working storage <NUM> into a format that may allow for more efficient translation of tenant identifiers before the record is packed and stored in the persistent storage <NUM>. The database executor <NUM> may remove the encoded tenant identifier <NUM> from the tenant identifier column <NUM>, so that the value stored by the tenant identifier column <NUM> may be an empty value. The database executor <NUM> may store a tenant identifier column attribute number <NUM> in the record header <NUM>. The tenant identifier column attribute number <NUM> may be used to identify the tenant identifier column <NUM> in the values <NUM>. The database executor <NUM> may set a record type indicator <NUM> to <NUM>, or true. The record type indicator <NUM> may be an indicator, such as a bit, that may be used to indicate when the record <NUM> has had the encoded tenant identifier <NUM> removed from the tenant identifier column <NUM>. If the record <NUM> did not include the encoded tenant identifier <NUM> in any of the other columns in the values <NUM>, the database executor <NUM> would then pack in the record <NUM> for storage with the records <NUM> in the persistent storage <NUM>.

] <FIG>shows an example arrangement for translation of tenant identifiers according to an implementation of the disclosed subject matter. The database executor <NUM> may examine the rest of the columns in the values <NUM> to determine if any of the columns store the encoded tenant identifier <NUM>. The database executor <NUM> may find that the encoded tenant identifier <NUM> is stored in the data column <NUM> and the data column <NUM>. The database executor <NUM> may remove the encoded tenant identifier <NUM> from the data column <NUM> and the data column <NUM>, so that both columns may store an empty value. The database executor <NUM> may write the encoded tenant identifier <NUM> into the record header <NUM> of the record <NUM>. The database executor may generate the bitmap <NUM>.

The bitmap <NUM> may identify the columns in the value <NUM> of the record <NUM> outside the tenant identifier column <NUM> which had stored the encoded tenant identifier <NUM>. For example, the bitmap <NUM> for the record <NUM> may be <NUM>, indicating that the third and fourth columns, the data column <NUM> and the data column <NUM>, are the columns outside of the tenant identifier column <NUM> which had stored the encoded tenant identifier <NUM>. The bitmap <NUM> may be written to the record header <NUM>.

The database executor <NUM> may set a bitmap indicator <NUM> to <NUM>, or true. The bitmap indicator <NUM> may be, for example, a bit which may indicate whether the record header <NUM> stores a bitmap, such as the bitmap <NUM>, and an encoded value of the tenant identifier, such as the encoded tenant identifier <NUM>.

<FIG> shows an example arrangement for translation of tenant identifiers according to an implementation of the disclosed subject matter. The database executor <NUM>, after changing the format of the record <NUM>, may pack the record <NUM> and store it with the records <NUM> in the persistent storage <NUM> of the database system <NUM>. The record <NUM> may be removed from the working storage <NUM>.

<FIG> shows an example arrangement for translation of tenant identifiers according to an implementation of the disclosed subject matter. A tenant's record set in the database system <NUM> may be cloned, for example, to create a sandbox database. The database executor <NUM> may copy records of the tenant's record set, from the records <NUM> in the persistent storage <NUM>, to the working storage <NUM>. For example, the database executor <NUM> may copy the record <NUM> into the working storage as the record <NUM>. The packed data in the record <NUM>, for example, the tuple including the values for the values <NUM>, may be expanded when the record <NUM> is copied into the working storage as the record <NUM>.

<FIG> shows an example arrangement for translation of tenant identifiers according to an implementation of the disclosed subject matter. The record <NUM> may be a copy of the record <NUM>, and may include the key <NUM>, the record header <NUM>, and the values <NUM>. The key <NUM> may be a copy of the key <NUM>, including the tenant identifier <NUM> and the key data <NUM>. The record header <NUM> may be a copy of the record header <NUM>, include the tenant identifier attribute number <NUM>, the record type indicator <NUM>, the encoded tenant identifier <NUM>, the bitmap <NUM>, and the bitmap indicator <NUM>. The values <NUM> may be a copy of the values <NUM>, including the tenant identifier column <NUM> storing an empty value, the data column <NUM> storing the column value <NUM>, the data column <NUM> storing an empty value, the data column <NUM> storing an empty value, and the data column <NUM> storing the column value <NUM>.

<FIG> shows an example arrangement for translation of tenant identifiers according to an implementation of the disclosed subject matter. The database executor <NUM> may perform translation of the tenant identifier of the record <NUM> in order to prepare the record <NUM> for use in a sandbox database that is cloned from records from the tenant's record set that includes the record <NUM>. Tenant identifier translation may be needed to prevent conflict between the records in the sandbox database and the records in the tenant's record set that was cloned to create the sandbox database.

The database executor <NUM> may determine the value of the tenant identifier for the tenant that owns the record <NUM>, of which the record <NUM> is a copy, from the key <NUM>, or from a scan descriptor in a query received by the database system <NUM> and to which the record <NUM> was responsive, for example, the scan descriptor used to locate records to clone to create a sandbox database. The database executor <NUM> may then use a new value for a tenant identifier, for example, new tenant identifier <NUM>, to replace the value of the tenant identifier, for example, the tenant identifier <NUM>, in the key <NUM>. The new tenant identifier <NUM> may be a value for a tenant identifier that is different from the value for the tenant identifier <NUM>, indicating that a new tenant owns the record <NUM>. The new tenant represented by the new tenant identifier <NUM> may be the same entity, for example, same users, groups of users, or organization, as the tenant represented by the tenant identifier <NUM>, or may be a different entity. For example, an entire organization may be represented by the tenant identifier <NUM>, while only a subset of that organization may be represented by the tenant identifier <NUM>. This may allow for control over the entities, including people and organizations, that have access to a sandbox database that is a clone of an existing tenant's record set, separating access to the sandbox database and tenant's record set.

The database executor <NUM> may check the bitmap indicator <NUM>. If the bitmap indicator <NUM> were set to <NUM>, or false, then the database executor <NUM> may be finished with the translation of the tenant identifier for the record <NUM>. The database executor <NUM> may then encode the new tenant identifier <NUM> and store the encoding in the tenant identifier column <NUM>, identified using the tenant identifier column attribute number <NUM>, and make the record <NUM> available as part of the sandbox database.

<FIG> shows an example arrangement for translation of tenant identifiers according to an implementation of the disclosed subject matter. The database executor <NUM> may check the bitmap indicator <NUM> in the record header <NUM>. The bitmap indicator <NUM> may be set to <NUM>, or true, indicating that the record header <NUM> stores both a bitmap and an encoded tenant identifier.

The database executor <NUM> may check the bitmap <NUM>, which may be, for example, <NUM>, to determine which columns in the values <NUM> had previously stored the encoded tenant identifier <NUM>. The database executor <NUM> may determine that the data columns <NUM> and <NUM> previously stored the encoded tenant identifier <NUM>. The database executor <NUM> may check column metadata from the system catalog <NUM> to determine whether tenant identifier translation is enabled or disabled for the column types of the data column <NUM> and <NUM>. The column metadata may indicate that tenant identifier translation is enabled for the column type of the data column <NUM> but is disabled for the column type of the data column <NUM>. The database executor <NUM> may store an encoded new value of the tenant identifier, the new identifier <NUM>, in the data column <NUM> as the encoded new tenant identifier <NUM>.

The database executor may copy the encoded tenant identifier <NUM> from the record header <NUM> and write the encoded tenant identifier <NUM> to the data column <NUM>. The database executor may also write the encoded new tenant identifier <NUM> to the tenant identifier column <NUM>, which may be identified using the tenant identifier column attribute number <NUM>. This may complete the portions of the translation of tenant identifiers for the record <NUM> that can be performed on the database system <NUM> without resulting in database corruption. The record <NUM> may be made available for access by, for example, a database application which may be used to interact with the database system <NUM>.

<FIG> shows an example arrangement for translation of tenant identifiers according to an implementation of the disclosed subject matter. The database executor <NUM> may prepare the record <NUM> for packing and storage in the persistent storage <NUM> with the records <NUM> by removing the encoded new tenant identifier <NUM> from the tenant identifier column <NUM> and the data column <NUM> and removing the encoded tenant identifier <NUM> from the data column <NUM>. The database executor <NUM> may also re-generate the bitmap <NUM>. For example, the bitmap <NUM> may be regenerated based on the occurrence of copies of the encoded new tenant identifier <NUM> in the columns of the record <NUM> outside of the tenant identifier column <NUM>.

<FIG> shows an example arrangement for translation of tenant identifiers according to an implementation of the disclosed subject matter. The database executor <NUM>, after completing the translation of the tenant identifier for the record <NUM>, may pack the record <NUM> and store it with the records <NUM> in the persistent storage <NUM> of the database system <NUM>. The record <NUM> may be removed from the working storage <NUM>.

<FIG> shows an example procedure suitable for translation of tenant identifiers according to an implementation of the disclosed subject matter. At <NUM>, an encoded value of a tenant identifier is removed from a tenant identifier column of a record. The data executor <NUM> copies the record <NUM> from the persistent storage <NUM> to the working storage <NUM> and removes the encoded tenant identifier <NUM> from the tenant identifier column <NUM>.

At <NUM>, if the encoded value of the tenant identifier is stored in any additional columns of the record, flow proceeds to <NUM>. Otherwise, flow proceeds to <NUM> where the record type indicator for the record is set. The database executor <NUM> checks the columns of the values <NUM> of the record <NUM> to determine if any still store the encoded tenant identifier <NUM>.

At <NUM>, a bitmap identifying columns that store the encoded value of the tenant identifier is generated. The database executor <NUM> generates the bitmap <NUM> which identifies the data columns <NUM> and <NUM> of the record <NUM> as storing the encoded tenant identifier <NUM>.

At <NUM>, the encoded value of the tenant identifier is removed from any additional columns in which it is stored. The database executor <NUM> removes the encoded tenant identifier <NUM> from the data columns <NUM> and <NUM> of the record <NUM>.

At <NUM>, the bitmap and the encoded value of the tenant identifier is stored in the record header. The database executor <NUM> writes the bitmap <NUM> and the encoded tenant identifier <NUM> to the record header <NUM> of the record <NUM>.

At <NUM>, a bitmap indicator in the record header is set to true. The database executor <NUM> sets the bitmap indicator <NUM> in the record header <NUM> to <NUM>, or true, to indicate that the bitmap <NUM> and the encoded tenant identifier <NUM> are both stored in the record header <NUM> of the record <NUM>.

At <NUM>, a record type indicator in the record header is set to true. The database executor <NUM> sets the record type indicator <NUM> to <NUM>, or true, to indicate that the record <NUM> has had the encoded tenant identifier <NUM> removed from all columns it was stored in among the values <NUM> of the record <NUM>.

<FIG> shows an example procedure suitable for translation of tenant identifiers according to an implementation of the disclosed subject matter. At <NUM>, a value of a tenant identifier is determined. The database executor <NUM> has copied the record <NUM> into the working storage <NUM> as the record <NUM> as part of a cloning of a tenant's record set to create a sandbox database. The database executor <NUM> performs translation of the tenant identifier of the record <NUM> to prepare it for use in the sandbox database. The database executor <NUM> determines the tenant identifier <NUM> by, reading the tenant identifier <NUM> from the key <NUM>, or retrieving the tenant identifier <NUM> from a scan descriptor used in a query to which the record <NUM> was responsive.

At <NUM>, the value of the tenant identifier is placed in the key with a new value of a tenant identifier. For example, the database executor <NUM> replaces the tenant identifier <NUM> in the key <NUM> with the new tenant identifier <NUM>. The new tenant identifier <NUM> is a new value for a new tenant identifier that will be used for a sandbox database that includes the record <NUM> as a copy of the record <NUM>.

At <NUM>, if the bitmap indicator is set in the record header, flow proceeds to <NUM>. Otherwise, flow proceeds to <NUM>, where the tenant identifier column is filled with the encoding of new value of the tenant identifier. The database executor <NUM> checks the bitmap indicator <NUM> in the record header <NUM> to determine if the bitmap indicator <NUM> is set to true, or <NUM>, or set to false, or <NUM>.

At <NUM>, columns identified in the bitmap and for which translation is not enabled are filled in with the encoded value of the tenant identifier from the record header. The database executor <NUM> checks the metadata for the data columns <NUM> and <NUM>, which are indicated by the bitmap <NUM> as having previously stored the encoded tenant identifier <NUM>. The metadata indicates that tenant identifier translation is not enabled for the data column <NUM>. The database executor <NUM> copies the encoded tenant identifier <NUM> from the record header <NUM> and writes write it to the data column <NUM>.

At <NUM>, columns identified in the bitmap and for which translation is enabled are filled in with the encoded new value of the tenant identifier. The database executor <NUM> checks the metadata for the data columns <NUM> and <NUM>, which are indicated by the bitmap <NUM> as having previously stored the encoded tenant identifier <NUM>. The metadata indicates that tenant identifier translation is enabled for the data column <NUM>. The database executor <NUM> encodes the new tenant identifier <NUM>, from the key <NUM> or held in memory, and writes the encoded new tenant identifier <NUM> to the data column <NUM>.

At <NUM>, the tenant identifier column is filled with the new value of the tenant identifier. For example, the database executor <NUM> writes the encoded tenant identifier <NUM> to the tenant identifier column <NUM>, which is identified based on the tenant identifier column attribute number <NUM> in the record header <NUM>.

Implementations of the presently disclosed subject matter may be implemented in and used with a variety of component and network architectures. <FIG> is an example computer <NUM> suitable for implementing implementations of the presently disclosed subject matter. As discussed in further detail herein, the computer <NUM> may be a single computer in a network of multiple computers. As shown in <FIG>, computer may communicate a central component <NUM> (e.g., server, cloud server, database, etc.). The central component <NUM> may communicate with one or more other computers such as the second computer <NUM>. According to this implementation, the information obtained to and/or from a central component <NUM> may be isolated for each computer such that computer <NUM> may not share information with computer <NUM>. Alternatively or in addition, computer <NUM> may communicate directly with the second computer <NUM>.

The computer (e.g., user computer, enterprise computer, etc.) <NUM> includes a bus <NUM> which interconnects major components of the computer <NUM>, such as a central processor <NUM>, a memory <NUM> (typically RAM, but which may also include ROM, flash RAM, or the like), an input/output controller <NUM>, a user display <NUM>, such as a display or touch screen via a display adapter, a user input interface <NUM>, which may include one or more controllers and associated user input or devices such as a keyboard, mouse, WiFi/cellular radios, touchscreen, microphone/speakers and the like, and may be closely coupled to the I/O controller <NUM>, fixed storage <NUM>, such as a hard drive, flash storage, Fibre Channel network, SAN device, SCSI device, and the like, and a removable media component <NUM> operative to control and receive an optical disk, flash drive, and the like.

The bus <NUM> enable data communication between the central processor <NUM> and the memory <NUM>, which may include read-only memory (ROM) or flash memory (neither shown), and random access memory (RAM) (not shown), as previously noted. The RAM can include the main memory into which the operating system and application programs are loaded. The ROM or flash memory can contain, among other code, the Basic Input-Output system (BIOS) which controls basic hardware operation such as the interaction with peripheral components. Applications resident with the computer <NUM> can be stored on and accessed via a computer readable medium, such as a hard disk drive (e.g., fixed storage <NUM>), an optical drive, floppy disk, or other storage medium <NUM>.

The fixed storage <NUM> may be integral with the computer <NUM> or may be separate and accessed through other interfaces. A network interface <NUM> may provide a direct connection to a remote server via a telephone link, to the Internet via an internet service provider (ISP), or a direct connection to a remote server via a direct network link to the Internet via a POP (point of presence) or other technique. The network interface <NUM> may provide such connection using wireless techniques, including digital cellular telephone connection, Cellular Digital Packet Data (CDPD) connection, digital satellite data connection or the like. For example, the network interface <NUM> may enable the computer to communicate with other computers via one or more local, wide-area, or other networks, as shown in <FIG>.

Many other devices or components (not shown) may be connected in a similar manner (e.g., document scanners, digital cameras and so on). Conversely, all of the components shown in <FIG> need not be present to practice the present disclosure. The components can be interconnected in different ways from that shown. The operation of a computer such as that shown in <FIG> is readily known in the art and is not discussed in detail in this application. Code to implement the present disclosure can be stored in computer-readable storage media such as one or more of the memory <NUM>, fixed storage <NUM>, removable media <NUM>, or on a remote storage location.

<FIG> shows an example network arrangement according to an implementation of the disclosed subject matter. One or more clients <NUM>, <NUM>, such as computers, microcomputers, local computers, smart phones, tablet computing devices, enterprise devices, and the like may connect to other devices via one or more networks <NUM> (e.g., a power distribution network). The network may be a local network, wide-area network, the Internet, or any other suitable communication network or networks, and may be implemented on any suitable platform including wired and/or wireless networks. The clients may communicate with one or more servers <NUM> and/or databases <NUM>. The devices may be directly accessible by the clients <NUM>, <NUM>, or one or more other devices may provide intermediary access such as where a server <NUM> provides access to resources stored in a database <NUM>. The clients <NUM>, <NUM> also may access remote platforms <NUM> or services provided by remote platforms <NUM> such as cloud computing arrangements and services. The remote platform <NUM> may include one or more servers <NUM> and/or databases <NUM>. Information from or about a first client may be isolated to that client such that, for example, information about client <NUM> may not be shared with client <NUM>. Alternatively, information from or about a first client may be anonymized prior to being shared with another client. For example, any client identification information about client <NUM> may be removed from information provided to client <NUM> that pertains to client <NUM>.

Claim 1:
A computer-implemented method comprising:
receiving a record, the record comprising a bitmap stored in a record header, the bitmap identifying columns of the record where the encoded value of a tenant identifier is to be stored;
determining a value of the tenant identifier for the record from at least one of a key for the record and a scan descriptor;
replacing the value of the tenant identifier in the key for the record with a new value for the tenant identifier;
identifying, using the bitmap stored in the record header of the record, one or more columns of the record that stored an encoded value of the tenant identifier; and
storing an encoded new value of the tenant identifier in columns of the one or more columns identified by the bitmap stored in the record header that comprise an attribute indicating that tenant identifier translation is enabled.