Skip to content

build on windows system. - #322

Merged
tabokie merged 1 commit into
tikv:masterfrom
MichaelScofield:build/windows
Jul 27, 2023
Merged

build on windows system.#322
tabokie merged 1 commit into
tikv:masterfrom
MichaelScofield:build/windows

Conversation

@MichaelScofield

@MichaelScofield MichaelScofield commented Jul 4, 2023

Copy link
Copy Markdown
Contributor

Let cargo build pass under windows system:

  1. use windows os specific symlink API in fork.rs
  2. use different LogFd implementations in each os. Guarded (or choosen) by feature flags
    • for non-linux or non-unix system, use the plain std::fs APIs instead
    • for linux and unix system, still use the nix raw bindings

@MichaelScofield

Copy link
Copy Markdown
Contributor Author

@tabokie PTAL

@tabokie tabokie left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Some CI changes that're needed:

Comment thread src/fork.rs
Comment thread src/env/log_fd.rs Outdated
Comment thread src/env/log_fd.rs
Comment thread src/env/log_fd/nix.rs Outdated
@MichaelScofield

Copy link
Copy Markdown
Contributor Author

@tabokie PTAL. Can you approve the workflow to run so I can debug the windows build in CI?

@MichaelScofield

Copy link
Copy Markdown
Contributor Author

@tabokie can you make this PR always run workflow? Need another approval again. Debugging github workflow is a pain, especially for os = windows. I can see more commits to debug it in the future.

@tabokie

tabokie commented Jul 9, 2023

Copy link
Copy Markdown
Member

I don't have the permission to do that. It's weird though because my fork repo runs the workflow just fine: https://github.com/tabokie/raft-engine/actions, I wonder why your fork repo ignores the workflow file.

@tabokie

tabokie commented Jul 10, 2023

Copy link
Copy Markdown
Member

@MichaelScofield You can work around this by merging another small PR first. E.g. Open another PR to update clap manually (#306)

@MichaelScofield

Copy link
Copy Markdown
Contributor Author

@tabokie
Having trouble with building pingcap grpc in windows os: https://github.com/tikv/raft-engine/actions/runs/5493202302/jobs/10013725416 . Any ideas? Thx!

@tabokie

tabokie commented Jul 12, 2023

Copy link
Copy Markdown
Member

It can build now, you just need to fix the tests.

@MichaelScofield

Copy link
Copy Markdown
Contributor Author

Running into infamous "access denied (os error 5)" error in windows. Convert this PR to draft first, to reduce github notification noise.

@MichaelScofield
MichaelScofield marked this pull request as draft July 12, 2023 15:34
@codecov

codecov Bot commented Jul 16, 2023

Copy link
Copy Markdown

Codecov Report

Patch coverage: 95.34% and no project coverage change.

Comparison is base (58041ad) 97.98% compared to head (94a96db) 97.99%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #322   +/-   ##
=======================================
  Coverage   97.98%   97.99%           
=======================================
  Files          31       33    +2     
  Lines       12329    12388   +59     
=======================================
+ Hits        12081    12140   +59     
  Misses        248      248           
Files Changed Coverage Δ
src/env/mod.rs 85.00% <ø> (ø)
src/file_pipe_log/pipe.rs 98.10% <ø> (ø)
src/fork.rs 100.00% <ø> (ø)
src/lib.rs 100.00% <ø> (ø)
src/env/log_fd/unix.rs 91.15% <91.15%> (ø)
src/env/default.rs 93.75% <100.00%> (+1.60%) ⬆️
src/env/log_fd/plain.rs 100.00% <100.00%> (ø)
src/swappy_allocator.rs 99.34% <100.00%> (+<0.01%) ⬆️
tests/failpoints/test_engine.rs 99.90% <100.00%> (ø)
tests/failpoints/test_io_error.rs 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@MichaelScofield
MichaelScofield marked this pull request as ready for review July 16, 2023 12:44
@MichaelScofield

Copy link
Copy Markdown
Contributor Author

@tabokie PTAL. The tests are all passed (at least in my repo's action, see here). Let's approve the workflow in this PR to see how it goes!

tabokie
tabokie previously approved these changes Jul 17, 2023
Comment thread Cargo.toml Outdated
Comment thread Cargo.toml
Comment thread src/file_pipe_log/pipe.rs Outdated
Comment thread src/env/log_fd/plain.rs
use std::path::Path;
use std::sync::Arc;

pub struct LogFd(Arc<RwLock<File>>);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This implementation kind of defeats the point of Handle abstraction, which is to be efficiently shared between multiple readers/writers. I like seeing a fallback solution that covers all platforms other than Windows, but this implementation is too inefficient for production use.

I can think of two ways to go around this:

(1) use raw windows HANDLE here like in #69, it has the downside of windows-only.
(2) further separate LogFile into unix and windows version. The windows version looks something like below. It has the downside of needing to port lots of failpoints again.

struct LogFd(File);
struct LogFile(File);
impl LogFd {
  fn new_writer(&self) -> LogFile {
    LogFile(self.0.try_clone().unwrap())
  }
}

@tabokie
tabokie dismissed their stale review July 17, 2023 09:58

mistake

@tabokie

tabokie commented Jul 21, 2023

Copy link
Copy Markdown
Member

@MichaelScofield #325 is merged. Feel free to ask questions. #322 (comment) might be too much work for this PR, you can follow up in another one or let me handle it later.

@MichaelScofield

Copy link
Copy Markdown
Contributor Author

@tabokie Sorry for the late reply, busy week.

I actually considered using the raw Windows API earlier. However, skimmed through the "windows" crate and the "official win32 API docs", I find it's not a quick and easy task. It requires detailed understanding of Windows filesystem to do it well, which I'm currently lacking of, nor do I have the time to study it. Besides, the windows binding APIs are all "unsafe" to call in rust. So I decide to switch back to the good old std fs, make it right first.

I'll make the features worked in the new test matrix this weekend.

@MichaelScofield

Copy link
Copy Markdown
Contributor Author

@tabokie tests are ok now, PTAL

Comment thread .github/workflows/rust.yml Outdated
Comment thread Makefile Outdated
Comment thread src/lib.rs
Comment thread Makefile
@MichaelScofield

Copy link
Copy Markdown
Contributor Author

@tabokie PTAL

Now the "test_matrix" is only used in coverage job, and only runs under ubuntu.

@tabokie tabokie left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Rest LG.

Comment thread .github/workflows/rust.yml Outdated

@tabokie tabokie left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

DCO needs fixing.

Comment thread Makefile Outdated
Signed-off-by: luofucong <luofc@foxmail.com>
@MichaelScofield

Copy link
Copy Markdown
Contributor Author

@tabokie PTAL

@tabokie

tabokie commented Jul 26, 2023

Copy link
Copy Markdown
Member

GitHub action space is not enough.. I'll take a look tomorrow.

@tabokie tabokie left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, Thanks

@tabokie
tabokie merged commit 2dcaf5b into tikv:master Jul 27, 2023
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