Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle atomicity #2

Closed
colorfield opened this issue Aug 23, 2016 · 2 comments
Closed

Handle atomicity #2

colorfield opened this issue Aug 23, 2016 · 2 comments
Assignees
Milestone

Comments

@colorfield
Copy link
Owner

colorfield commented Aug 23, 2016

The schema and update hooks have to be converted.

  • serial_schema
  • serial_field_schema (documentation for D8)
  • serial_update_7130, serial_update_7131, serial_update_7132

The module does not create any table on install. It triggers table creation while creating a field on a content type. The table created is then "serial_" suffixed with a md5 generated string 'serial_' . md5("{$entity_type}{$bundle}{$field_name}").
There was already a todo left under D7 about improving this naming convention.

function _serial_get_table_name($entity_type, $bundle, $field_name) {
  // Remember about max length of MySQL tables - 64 symbols.
  // @todo Think about improvement for this.
  return db_escape_table('serial_' . md5("{$entity_type}_{$bundle}_{$field_name}"));
}

The table columns are sid - primary key ("The atomic serial field") and uniqid - unique key ("Unique temporary allocation Id") that relies on http://php.net/manual/en/function.uniqid.php.

@colorfield colorfield self-assigned this Aug 23, 2016
@colorfield colorfield added this to the 8.x-0.0-dev milestone Aug 23, 2016
@colorfield
Copy link
Owner Author

To feed the discussion

We should really avoid custom tables, I will start on a branch that tries to stick to the API. Entity instances uuid (e.g. node.uuid) can replace the serial_*. uniqid, right ?

Feedback really appreciated, especially on this

The allocation of serial numbers by this module is atomic. In other words, the serial values are unique even when multiple instances of the same content type / entity are created simultaneously.

@colorfield colorfield changed the title Convert install file Feedback needed about atomicity Sep 24, 2016
@colorfield
Copy link
Owner Author

colorfield commented Sep 24, 2016

A first solution that is not atomic a920ab4
We do not rely on the SQL auto increment anymore, this will be implemented via #11

@colorfield colorfield changed the title Feedback needed about atomicity Handle atomicity Sep 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant