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

sql: changing name column type to binary type #1762

Merged
merged 3 commits into from
Apr 13, 2022

Conversation

zhijian-pro
Copy link
Contributor

@zhijian-pro zhijian-pro commented Apr 12, 2022

This pr is mainly to solve the problem that juicefs cannot create files whose filenames are not UTF8 encoded when using the sql type of metadata engine
To solve this problem, the metadata database field type needs to be updated, so there is a certain compatibility problem with the old version. The following is a smooth upgrade scheme for upgrading the old version to this version:

  1. If there are old clients in mount state, they can be upgraded without stopping them
  2. Enter the metadata database and manually execute sql
# on mysql
alter table jfs_edge
    modify name varbinary(255) not null;
alter table jfs_symlink
    modify target varbinary(4096) not null;


# on postgres
alter table jfs_edge
    alter column name type bytea using name::bytea;

alter table jfs_symlink
    alter column target type bytea using target::bytea;
  1. At this time, the old client in the mount state can already write files with non-utf8 file names, but it should be noted that after executing sql, the old version of the client cannot use the metadata engine to remount, That is to say, the client in the non-mounted state is incompatible with the metadata engine after executing sql, and a new version of the client is required to mount.

Close #1684 #1567

@codecov-commenter
Copy link

codecov-commenter commented Apr 12, 2022

Codecov Report

Merging #1762 (dd552ed) into main (f342a98) will increase coverage by 0.45%.
The diff coverage is 73.33%.

@@            Coverage Diff             @@
##             main    #1762      +/-   ##
==========================================
+ Coverage   61.56%   62.01%   +0.45%     
==========================================
  Files         135      135              
  Lines       22924    22935      +11     
==========================================
+ Hits        14114    14224     +110     
+ Misses       7210     7121      -89     
+ Partials     1600     1590      -10     
Impacted Files Coverage Δ
pkg/meta/sql.go 67.34% <68.00%> (+0.10%) ⬆️
pkg/meta/dump.go 75.86% <100.00%> (ø)
pkg/meta/redis.go 73.42% <100.00%> (ø)
pkg/meta/tkv.go 76.55% <100.00%> (ø)
pkg/chunk/utils_unix.go 73.33% <0.00%> (-20.00%) ⬇️
cmd/mount.go 67.96% <0.00%> (-2.76%) ⬇️
pkg/vfs/vfs.go 77.98% <0.00%> (+0.06%) ⬆️
pkg/meta/base.go 71.69% <0.00%> (+0.50%) ⬆️
pkg/vfs/writer.go 79.66% <0.00%> (+1.01%) ⬆️
cmd/info.go 70.12% <0.00%> (+1.77%) ⬆️
... and 6 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b7bfb05...dd552ed. Read the comment docs.

@zhijian-pro
Copy link
Contributor Author

zhijian-pro commented Apr 12, 2022

moved to descripotion

@zhijian-pro zhijian-pro changed the title Test changing name column type to binary type changing name column type to binary type Apr 12, 2022
@zhijian-pro
Copy link
Contributor Author

Close #1684 #1567

@zhijian-pro zhijian-pro marked this pull request as ready for review April 12, 2022 10:46
@davies davies changed the title changing name column type to binary type sql: changing name column type to binary type Apr 13, 2022
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

Successfully merging this pull request may close these issues.

PGsql ERROR: invalid byte sequence for encoding "UTF8"
3 participants