fix: return 0 if fileptr is null while fsync

This commit is contained in:
Shengliang Guan 2022-12-30 23:07:07 +08:00
parent 574915a48b
commit 3de892d41e
2 changed files with 11 additions and 3 deletions

View File

@ -640,7 +640,7 @@ int32_t taosFtruncateFile(TdFilePtr pFile, int64_t l_size) {
int32_t taosFsyncFile(TdFilePtr pFile) { int32_t taosFsyncFile(TdFilePtr pFile) {
if (pFile == NULL) { if (pFile == NULL) {
return -1; return 0;
} }
// this implementation is WRONG // this implementation is WRONG

View File

@ -53,17 +53,25 @@ endi
return return
print =============== step2: create database print =============== step2: create database
sql create database db vgroups 33 replica 3 sql create database db vgroups 1 replica 3
sql use db; sql use db;
sql create table stb (ts timestamp, c int) tags (t int); sql create table stb (ts timestamp, c int) tags (t int);
sql create table t0 using stb tags (0); sql create table t0 using stb tags (0);
sql insert into t0 values(now, 1); $x = 0
while $x < 28
sql insert into t0 values(now, 1);
$x = $x + 1
endw
sql select * from information_schema.ins_stables where db_name = 'db'; sql select * from information_schema.ins_stables where db_name = 'db';
sql select * from information_schema.ins_tables where db_name = 'db'; sql select * from information_schema.ins_tables where db_name = 'db';
sql show db.vgroups; sql show db.vgroups;
system sh/exec.sh -n dnode1 -s stop
system sh/exec.sh -n dnode2 -s stop system sh/exec.sh -n dnode2 -s stop
system sh/exec.sh -n dnode3 -s stop
system sh/exec.sh -n dnode4 -s stop
return return
print ======== start back print ======== start back