apache / apache/iotdb

[Feature request] remove dependency on wmic & wsh from windows batch files

Đang mở
#11,014 3 bình luận 2 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Java
Star
6.4k
Fork
1.2k
Merge trung bình
1 ngày 23 giờ
Pull request đã merge (30 ngày)
115

Mô tả

### Search before asking

- [X] I searched in the [issues](https://github.com/apache/iotdb/issues) and found nothing similar.

### Motivation

Hello team, I am building an installer for IotDB so that I can distribte IotDB with a solution I develop. The installer deploys IotDB as a windows service.

During my testing I have discovered that;

1. The env scripts are using wmic which is deprecated and is an optional feature on Windows 10/11 (https://learn.microsoft.com/en-us/windows/whats-new/deprecated-features)
2. The env script are using WSH which is not desirable. Windows Scripting host is blocked on many customer sites and is not good practise on Windows.

To add to this, I am testing in the Windows 11 Sandbox which does not allow you to enable the wmic feature anyway so IotDB would never start successfully.

To work around this I have developed a small C# console app to return the number of cores and memory in megabytes

https://github.com/ope-nz/IotDBHWInfo

In the env batch files I have replaced the cores/memory determination with these lines;

for /f %%A in ('..\tools\IotDBHWInfo.exe -cores') do set "system_cpu_cores=%%A"
echo CORES %system_cpu_cores%

for /f %%A in ('..\tools\IotDBHWInfo.exe -memory') do set "system_memory_in_mb=%%A"
echo SYSTEM MEMORY %system_memory_in_mb%

### Solution

Develop alternate solution to using wmic/wsh such as console app show above

### Alternatives

Use https://github.com/ope-nz/IotDBHWInfo

Update env batch files with

for /f %%A in ('..\tools\IotDBHWInfo.exe -cores') do set "system_cpu_cores=%%A"
echo CORES %system_cpu_cores%

for /f %%A in ('..\tools\IotDBHWInfo.exe -memory') do set "system_memory_in_mb=%%A"
echo SYSTEM MEMORY %system_memory_in_mb%

### Are you willing to submit a PR?

- [X] I'm willing to submit a PR!

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu bằng cách xác định các tệp batch của môi trường Windows và các lệnh gọi wmic và WSH hiện tại. So sánh việc phát hiện số lõi CPU và bộ nhớ của chúng với hành vi được mô tả cho IotDBHWInfo.exe. Hoàn thành khi các script môi trường không còn phụ thuộc vào wmic hoặc WSH và IotDB có thể khởi động trong kịch bản Windows 11 Sandbox đã nêu.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
csharp, shell
Lĩnh vực
devops, operating-systems
Loại issue
Tính năng
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.