Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
jobily
Questdb
提交
e98aa324
Q
Questdb
项目概览
jobily
/
Questdb
12 个月 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Q
Questdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
e98aa324
编写于
5月 12, 2020
作者:
V
Vlad Ilyushchenko
提交者:
GitHub
5月 12, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore: questdb.exe able to start server from both "runtime" and no-JRE package. (#277)
上级
5ae7888e
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
89 addition
and
43 deletion
+89
-43
benchmarks/src/main/java/module-info.java
benchmarks/src/main/java/module-info.java
+1
-1
core/src/main/bin/questdb.exe
core/src/main/bin/questdb.exe
+0
-0
core/src/main/java/io/questdb/ServerMain.java
core/src/main/java/io/questdb/ServerMain.java
+2
-1
win64svc/src/common.h
win64svc/src/common.h
+2
-1
win64svc/src/questdb.c
win64svc/src/questdb.c
+75
-36
win64svc/src/service.c
win64svc/src/service.c
+6
-3
win64svc/src/svcctrl.c
win64svc/src/svcctrl.c
+3
-1
未找到文件。
benchmarks/src/main/java/module-info.java
浏览文件 @
e98aa324
module
io
.
questdb
.
bechmarks
{
module
io
.
questdb
.
be
n
chmarks
{
requires
jdk
.
unsupported
;
requires
java
.
base
;
requires
io
.
questdb
;
...
...
core/src/main/bin/questdb.exe
浏览文件 @
e98aa324
无法预览此类型文件
core/src/main/java/io/questdb/ServerMain.java
浏览文件 @
e98aa324
...
...
@@ -218,13 +218,14 @@ public class ServerMain {
private
static
void
extractSite
(
String
dir
,
boolean
force
,
Log
log
)
throws
IOException
{
final
String
publicZip
=
"/io/questdb/site/public.zip"
;
final
String
publicDest
=
dir
+
"/public"
;
final
byte
[]
buffer
=
new
byte
[
1024
*
1024
];
try
(
final
InputStream
is
=
ServerMain
.
class
.
getResourceAsStream
(
publicZip
))
{
if
(
is
!=
null
)
{
try
(
ZipInputStream
zip
=
new
ZipInputStream
(
is
))
{
ZipEntry
ze
;
while
((
ze
=
zip
.
getNextEntry
())
!=
null
)
{
final
File
dest
=
new
File
(
dir
,
ze
.
getName
());
final
File
dest
=
new
File
(
publicDest
,
ze
.
getName
());
if
(!
ze
.
isDirectory
())
{
copyInputStream
(
force
,
buffer
,
dest
,
zip
,
log
);
}
...
...
win64svc/src/common.h
浏览文件 @
e98aa324
...
...
@@ -27,6 +27,7 @@
typedef
struct
{
int
command
;
BOOL
forceCopy
;
BOOL
localRuntime
;
LPSTR
dir
;
int
errorCode
;
LPSTR
javaExec
;
...
...
@@ -56,6 +57,6 @@ int svcStart(CONFIG *config);
int
svcStop
(
CONFIG
*
config
);
void
log_event
(
WORD
logType
,
char
*
serviceName
,
char
*
message
);
void
log_event
(
WORD
logType
,
char
*
serviceName
,
c
onst
c
har
*
message
);
#endif //WIN64SVC_COMMON_H
win64svc/src/questdb.c
浏览文件 @
e98aa324
...
...
@@ -4,15 +4,18 @@
#include <string.h>
#include <time.h>
#include "common.h"
#ifdef _MSC_VER
#include "getopt.h"
#else
#include <rpc.h>
#include <handleapi.h>
#include <synchapi.h>
#include <processthreadsapi.h>
#include <errhandlingapi.h>
#include <getopt.h>
#endif // __MSVC__
#define CMD_START 1
...
...
@@ -23,6 +26,8 @@
#define CMD_SERVICE 6
#define CMD_CONSOLE -1
void
buildJavaExec
(
CONFIG
*
config
,
const
char
*
javaExecOpt
);
void
freeConfig
(
CONFIG
*
config
)
{
if
(
config
->
exeName
!=
NULL
)
{
free
(
config
->
exeName
);
...
...
@@ -60,38 +65,48 @@ int makeDir(const char *dir) {
return
1
;
}
int
fileExists
(
char
*
file
)
{
WIN32_FIND_DATA
FindFileData
;
HANDLE
handle
=
FindFirstFile
(
file
,
&
FindFileData
);
int
found
=
handle
!=
INVALID_HANDLE_VALUE
;
if
(
found
)
{
FindClose
(
handle
);
}
return
found
;
}
void
buildJavaArgs
(
CONFIG
*
config
)
{
// main class
LPCSTR
mainClass
=
"io.questdb.ServerMain"
;
LPCSTR
mainClass
=
"io.questdb
/io.questdb
.ServerMain"
;
// put together static java opts
LPCSTR
javaOpts
=
" -XX:+PrintGCApplicationStoppedTime"
\
" -XX:+PrintSafepointStatistics"
\
" -XX:PrintSafepointStatisticsCount=1"
\
" -XX:+PrintGCDetails"
\
" -XX:+PrintGCTimeStamps"
\
" -XX:+PrintGCDateStamps"
\
" -XX:+UnlockDiagnosticVMOptions"
\
" -XX:GuaranteedSafepointInterval=90000000"
\
" -XX:-UseBiasedLocking"
\
" -XX:BiasedLockingStartupDelay=0"
;
LPCSTR
javaOpts
=
"-XX:+UnlockExperimentalVMOptions"
" -XX:+AlwaysPreTouch"
" -XX:+UseParallelOldGC"
" --add-exports java.base/jdk.internal.math=io.questdb"
" "
;
// put together classpath
char
classpath
[
MAX_PATH
+
64
];
memset
(
classpath
,
0
,
sizeof
(
classpath
));
if
(
!
config
->
localRuntime
)
{
pathCopy
(
classpath
,
config
->
exeName
);
strcat
(
classpath
,
"
\\
questdb.jar"
);
}
// put together command line
char
*
args
=
malloc
((
strlen
(
javaOpts
)
+
strlen
(
classpath
)
+
strlen
(
mainClass
)
+
strlen
(
config
->
dir
)
+
256
)
*
sizeof
(
char
));
strcpy
(
args
,
javaOpts
);
strcat
(
args
,
" -cp
\"
"
);
if
(
!
config
->
localRuntime
)
{
strcat
(
args
,
" -p
\"
"
);
strcat
(
args
,
classpath
);
strcat
(
args
,
"
\"
"
);
}
strcat
(
args
,
" -m "
);
strcat
(
args
,
mainClass
);
strcat
(
args
,
" -d
\"
"
);
strcat
(
args
,
config
->
dir
);
...
...
@@ -116,16 +131,14 @@ void initAndParseConfig(int argc, char **argv, CONFIG *config) {
GetFullPathName
(
argv
[
0
],
n
,
exe
,
NULL
);
config
->
exeName
=
exe
;
char
*
tag
=
NULL
;
char
*
java
Home
=
NULL
;
char
*
java
ExecOpt
=
NULL
;
BOOL
parsing
=
TRUE
;
while
(
parsing
)
{
c
=
getopt
(
argc
,
argv
,
"d:fj:t:"
);
switch
(
c
)
{
case
-
1
:
if
(
optind
<
argc
)
{
...
...
@@ -170,7 +183,7 @@ void initAndParseConfig(int argc, char **argv, CONFIG *config) {
break
;
case
'j'
:
java
Home
=
optarg
;
java
ExecOpt
=
optarg
;
break
;
case
't'
:
...
...
@@ -183,21 +196,7 @@ void initAndParseConfig(int argc, char **argv, CONFIG *config) {
}
}
if
(
javaHome
==
NULL
)
{
// check our environment
javaHome
=
getenv
(
"JAVA_HOME"
);
if
(
javaHome
==
NULL
)
{
eprintf
(
"JAVA_HOME is not defined"
);
config
->
errorCode
=
ECONFIG_JAVA_HOME
;
}
}
if
(
javaHome
!=
NULL
)
{
char
*
javaExec
=
malloc
((
strlen
(
javaHome
)
+
64
)
*
sizeof
(
char
));
strcpy
(
javaExec
,
javaHome
);
strcat
(
javaExec
,
"
\\
bin
\\
java.exe"
);
config
->
javaExec
=
javaExec
;
}
buildJavaExec
(
config
,
javaExecOpt
);
size_t
tagSize
=
tag
==
NULL
?
0
:
strlen
(
tag
);
...
...
@@ -214,6 +213,10 @@ void initAndParseConfig(int argc, char **argv, CONFIG *config) {
config
->
serviceName
=
lpServiceName
;
char
buf
[
2048
];
sprintf
(
buf
,
"JAVA_HOME %s "
,
config
->
javaExec
);
log_event
(
EVENTLOG_INFORMATION_TYPE
,
config
->
serviceName
,
buf
);
// Service display name
LPCSTR
serviceDisplayNamePrefix
=
SVC_DISPLAY_NAME
;
...
...
@@ -232,6 +235,40 @@ void initAndParseConfig(int argc, char **argv, CONFIG *config) {
buildJavaArgs
(
config
);
}
void
buildJavaExec
(
CONFIG
*
config
,
const
char
*
javaExecOpt
)
{
config
->
javaExec
=
malloc
(
MAX_PATH
);
memset
(
config
->
javaExec
,
0
,
MAX_PATH
);
if
(
javaExecOpt
)
{
strcpy
(
config
->
javaExec
,
javaExecOpt
);
config
->
localRuntime
=
FALSE
;
return
;
}
else
{
// check if we are being executed from runtime location
pathCopy
(
config
->
javaExec
,
config
->
exeName
);
strcat
(
config
->
javaExec
,
"
\\
java.exe"
);
if
(
fileExists
(
config
->
javaExec
))
{
config
->
localRuntime
=
TRUE
;
return
;
}
else
{
// fallback to JAVA_HOME
char
*
javaHome
=
getenv
(
"JAVA_HOME"
);
if
(
javaHome
)
{
strcpy
(
config
->
javaExec
,
javaHome
);
strcat
(
config
->
javaExec
,
"
\\
bin
\\
java.exe"
);
if
(
fileExists
(
config
->
javaExec
))
{
config
->
localRuntime
=
FALSE
;
return
;
}
}
}
}
free
(
config
->
javaExec
);
config
->
javaExec
=
NULL
;
eprintf
(
"
\r\n
JAVA_HOME is not defined
\r\n
"
);
config
->
errorCode
=
ECONFIG_JAVA_HOME
;
}
FILE
*
redirectStdout
(
CONFIG
*
config
)
{
// create log dir
...
...
@@ -274,6 +311,8 @@ int qdbConsole(CONFIG *config) {
si
.
cb
=
sizeof
(
si
);
ZeroMemory
(
&
pi
,
sizeof
(
pi
));
eprintf
(
"JAVA_EXE: %s
\n\r\n\r
"
,
config
->
javaExec
);
// Start the child process.
if
(
!
CreateProcess
(
config
->
javaExec
,
config
->
javaArgs
,
NULL
,
NULL
,
FALSE
,
0
,
NULL
,
NULL
,
&
si
,
&
pi
))
{
eprintf
(
"CreateProcess failed [%s](%lu).
\n
"
,
config
->
javaExec
,
GetLastError
());
...
...
win64svc/src/service.c
浏览文件 @
e98aa324
...
...
@@ -14,7 +14,7 @@ VOID ReportSvcStatus(DWORD, DWORD, DWORD);
VOID
WINAPI
qdbService
(
DWORD
argc
,
LPSTR
*
argv
);
void
log_event
(
WORD
logType
,
char
*
serviceName
,
char
*
message
)
{
void
log_event
(
WORD
logType
,
char
*
serviceName
,
c
onst
c
har
*
message
)
{
HANDLE
hEventSource
;
LPCTSTR
lpszStrings
[
1
];
...
...
@@ -111,14 +111,17 @@ VOID WINAPI qdbService(DWORD argc, LPSTR *argv) {
si
.
cb
=
sizeof
(
si
);
ZeroMemory
(
&
pi
,
sizeof
(
pi
));
// Start the child process.
char
buf
[
2048
];
sprintf
(
buf
,
"Starting %s %s"
,
gConfig
->
javaExec
,
gConfig
->
javaArgs
);
log_event
(
EVENTLOG_INFORMATION_TYPE
,
gConfig
->
serviceName
,
buf
);
if
(
!
CreateProcess
(
gConfig
->
javaExec
,
gConfig
->
javaArgs
,
NULL
,
NULL
,
FALSE
,
0
,
NULL
,
NULL
,
&
si
,
&
pi
))
{
log_event
(
EVENTLOG_ERROR_TYPE
,
gConfig
->
serviceName
,
"Could not start java"
);
ReportSvcStatus
(
SERVICE_STOPPED
,
NO_ERROR
,
0
);
return
;
}
char
buf
[
2048
];
//
char buf[2048];
sprintf
(
buf
,
"Started %s %s"
,
gConfig
->
javaExec
,
gConfig
->
javaArgs
);
log_event
(
EVENTLOG_INFORMATION_TYPE
,
gConfig
->
serviceName
,
buf
);
...
...
win64svc/src/svcctrl.c
浏览文件 @
e98aa324
...
...
@@ -31,6 +31,8 @@ int svcInstall(CONFIG *config) {
if
(
config
->
forceCopy
)
{
strcat
(
szPath
,
" -f"
);
}
strcat
(
szPath
,
" -j "
);
strcat
(
szPath
,
config
->
javaExec
);
// Create the service
...
...
@@ -61,7 +63,7 @@ int svcInstall(CONFIG *config) {
}
SERVICE_DESCRIPTION
description
;
description
.
lpDescription
=
"High performance time series database (www.questdb.
org
)"
;
description
.
lpDescription
=
"High performance time series database (www.questdb.
io
)"
;
ChangeServiceConfig2
(
hService
,
SERVICE_CONFIG_DESCRIPTION
,
&
description
);
eprintf
(
"Service installed: %s
\n
"
,
config
->
serviceName
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录