diff options
author | Marc Alff <marc.alff@oracle.com> | 2010-03-04 18:10:27 -0700 |
---|---|---|
committer | Marc Alff <marc.alff@oracle.com> | 2010-03-04 18:10:27 -0700 |
commit | f6a8202311458cf0fc25684085c203c64d2774a8 (patch) | |
tree | 10d3b927cf12dac360bf1dd339e0d58fc77a79d0 /storage/perfschema | |
parent | 2155847a29bb27b9129d95632c5695f14bdacb0f (diff) | |
download | mariadb-git-f6a8202311458cf0fc25684085c203c64d2774a8.tar.gz |
Bug#51741 Unit test pfs-t failing in mysql-next-mr-bugfixing
The root cause of the failure is that when
Bug#51447 performance schema evil twin files
was fixed, instrumented file names got normalized.
The pfs-t unit test depends on this file normalization,
but it was not updated.
This fix aligns pfs-t.cc lookup_file_by_name()
with the logic in pfs_instr.cc find_or_create_file().
Diffstat (limited to 'storage/perfschema')
-rw-r--r-- | storage/perfschema/unittest/pfs-t.cc | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/storage/perfschema/unittest/pfs-t.cc b/storage/perfschema/unittest/pfs-t.cc index fcbaf4aeb8f..2b64aec3416 100644 --- a/storage/perfschema/unittest/pfs-t.cc +++ b/storage/perfschema/unittest/pfs-t.cc @@ -37,14 +37,25 @@ PFS_file* lookup_file_by_name(const char* name) uint i; PFS_file *pfs; uint len= strlen(name); + size_t dirlen; + const char *filename; + uint filename_length;; for (i= 0; i < file_max; i++) { pfs= & file_array[i]; if (pfs->m_lock.is_populated()) { - if ((len == pfs->m_filename_length) && - (strncmp(name, pfs->m_filename, pfs->m_filename_length) == 0)) + /* + When a file "foo" is instrumented, the name is normalized + to "/path/to/current/directory/foo", so we remove the + directory name here to find it back. + */ + dirlen= dirname_length(pfs->m_filename); + filename= pfs->m_filename + dirlen; + filename_length= pfs->m_filename_length - dirlen; + if ((len == filename_length) && + (strncmp(name, filename, filename_length) == 0)) return pfs; } } |