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 crash when specifying a state_file in Ruby > 3.2.0 #144

Merged
merged 2 commits into from
Feb 28, 2024

Conversation

rophy
Copy link
Contributor

@rophy rophy commented Feb 28, 2024

Issue: the method File.exists() is removed since Ruby 3.2.0, and thus using a state_file will crash newer fluentd versions.
See: https://stackoverflow.com/a/75353113

Note: I am not a ruby developer, I simply copied the original test file and added state_file to it to reproduce the error. Let me know if this is not sufficient as unit tests.

Error: test_message(SqlInputStateFileTest): NoMethodError: undefined method `exists?' for File:Class
/home/kasm-user/fluent-plugin-sql/lib/fluent/plugin/in_sql.rb:285:in `initialize'
/home/kasm-user/fluent-plugin-sql/lib/fluent/plugin/in_sql.rb:186:in `new'
/home/kasm-user/fluent-plugin-sql/lib/fluent/plugin/in_sql.rb:186:in `start'
/home/kasm-user/.rvm/gems/ruby-3.2.2/gems/fluentd-1.16.3/lib/fluent/test/driver/base.rb:120:in `instance_start'
/home/kasm-user/.rvm/gems/ruby-3.2.2/gems/fluentd-1.16.3/lib/fluent/test/driver/base.rb:78:in `run'
/home/kasm-user/.rvm/gems/ruby-3.2.2/gems/fluentd-1.16.3/lib/fluent/test/driver/base_owner.rb:130:in `run'
/home/kasm-user/fluent-plugin-sql/test/plugin/test_in_sql_with_state_file.rb:78:in `test_message'

@ashie
Copy link
Member

ashie commented Feb 28, 2024

Thanks for your contribution!
The fix itself seems good.
Could you follow DCO?: https://github.com/fluent/fluent-plugin-sql/pull/144/checks?check_run_id=22075217219

@rophy
Copy link
Contributor Author

rophy commented Feb 28, 2024

Thanks for your contribution! The fix itself seems good. Could you follow DCO?: https://github.com/fluent/fluent-plugin-sql/pull/144/checks?check_run_id=22075217219

done

@ashie
Copy link
Member

ashie commented Feb 28, 2024

Note: CI with Ruby head is currently broken like this: fluent/fluentd#4411
I'll tackle on it in another pull request.

@ashie ashie merged commit c179334 into fluent:master Feb 28, 2024
21 of 25 checks passed
@ashie
Copy link
Member

ashie commented Feb 28, 2024

Merged. Thanks!
I'll release a new version after fixing CI.

@rophy rophy deleted the fix-state-file branch February 28, 2024 16:28
@ashie
Copy link
Member

ashie commented Feb 29, 2024

I've released it as v2.3.1.

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.

2 participants