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

Fix mysql table name too long while archiving a segment #15276

Merged
merged 2 commits into from Dec 17, 2019

Conversation

tsteur
Copy link
Member

@tsteur tsteur commented Dec 16, 2019

fix error

WP DB Error: Identifier name 'wp_foooobarrrrrr_matomo_logtmpsegment07171d02820b83eab14316299645c2e9' is too long SQL: CREATE TEMPORARY TABLE wp_foooobarrrrrr_matomo_logtmpsegment07171d02820b83eab14316299645c2e9 (idvisit BIGINT(10) UNSIGNED NOT NULL)

fix error 
> WP DB Error: Identifier name 'wp_foooobarrrrrr_matomo_logtmpsegment07171d02820b83eab14316299645c2e9' is too long SQL: CREATE TEMPORARY TABLE wp_foooobarrrrrr_matomo_logtmpsegment07171d02820b83eab14316299645c2e9 (idvisit BIGINT(10) UNSIGNED NOT NULL)
@tsteur tsteur added the Needs Review PRs that need a code review label Dec 16, 2019
@tsteur tsteur added this to the 3.13.1 milestone Dec 16, 2019
@@ -195,7 +195,8 @@ public function setQueryOriginHint($nameOfOrigiin)
private function getSegmentTmpTableName()
{
$bind = $this->getGeneralQueryBindParams();
return self::LOG_TABLE_SEGMENT_TEMPORARY_PREFIX . md5(json_encode($bind) . $this->segment->getString());
$tableName = self::LOG_TABLE_SEGMENT_TEMPORARY_PREFIX . md5(json_encode($bind) . $this->segment->getString());
return Common::mb_substr($tableName, 0, 64);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make 64 a constant? We could also shorten self::LOG_TABLE_SEGMENT_TEMPORARY_PREFIX since the table names are about 5 characters too long it seems.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pushed something, is that what you mean?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, was also wondering if shortening self::LOG_TABLE_SEGMENT_TEMPORARY_PREFIX was an option since wp_foooobarrrrrr_matomo_logtmpsegment07171d02820b83eab14316299645c2e9 was 69 characters.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@diosmosis now I understand what you mean. I guess it's not really needed I would say as the next one might again have an even longer prefix etc. Even if the table name is truncated by 16 characters it would still not be an issue since a temporary table only exists for one session and is not visible to any other mysql session... and after an archive the table is being deleted so it's unlikely there will two tables having the same name... we could shorten it though to logtmpseg if that helps and still clear what it is about?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it's not really needed. Will merge.

@diosmosis diosmosis merged commit 4cc5cd6 into 3.x-dev Dec 17, 2019
@diosmosis diosmosis deleted the tablenanemtoolong branch December 17, 2019 04:57
jonasgrilleres pushed a commit to 1024pix/pix-analytics that referenced this pull request Sep 22, 2020
…5276)

* Fix mysql table name too long while archiving a segment

fix error 
> WP DB Error: Identifier name 'wp_foooobarrrrrr_matomo_logtmpsegment07171d02820b83eab14316299645c2e9' is too long SQL: CREATE TEMPORARY TABLE wp_foooobarrrrrr_matomo_logtmpsegment07171d02820b83eab14316299645c2e9 (idvisit BIGINT(10) UNSIGNED NOT NULL)

* add constant
jbuget pushed a commit to 1024pix/pix-analytics that referenced this pull request Sep 26, 2020
…5276)

* Fix mysql table name too long while archiving a segment

fix error 
> WP DB Error: Identifier name 'wp_foooobarrrrrr_matomo_logtmpsegment07171d02820b83eab14316299645c2e9' is too long SQL: CREATE TEMPORARY TABLE wp_foooobarrrrrr_matomo_logtmpsegment07171d02820b83eab14316299645c2e9 (idvisit BIGINT(10) UNSIGNED NOT NULL)

* add constant
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Review PRs that need a code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants