This is an automated email from the ASF dual-hosted git repository.

zhaoc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 0d45769  [incubator-doris][thirdpary][glog][bug] Calucate file length 
at the be start (#3594)
0d45769 is described below

commit 0d457692bc545a1a9075ec0b423534c01c34f89e
Author: turbo jason <[email protected]>
AuthorDate: Fri May 15 15:15:54 2020 +0800

    [incubator-doris][thirdpary][glog][bug] Calucate file length at the be 
start (#3594)
---
 thirdparty/patches/glog-0.3.3-for-palo2.patch | 36 +++++++++++++--------------
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/thirdparty/patches/glog-0.3.3-for-palo2.patch 
b/thirdparty/patches/glog-0.3.3-for-palo2.patch
index 9c4af36..d9477c8 100644
--- a/thirdparty/patches/glog-0.3.3-for-palo2.patch
+++ b/thirdparty/patches/glog-0.3.3-for-palo2.patch
@@ -288,26 +288,26 @@
      file_length_ = bytes_since_flush_ = 0;
      rollover_attempt_ = kRolloverAttemptFrequency-1;
    }
- 
-+
+
 +  if ((file_ == NULL) && (!inited_) && (FLAGS_log_split_method == "size")) {
-+     CheckFileNumQuota();
-+     const char* filename = file_list_.back().name.c_str();
-+     int fd = open(filename, O_WRONLY | O_CREAT /* | O_EXCL */ | O_APPEND, 
0664);
-+     if (fd != -1) {
-+      #ifdef HAVE_FCNTL
-+      // Mark the file close-on-exec. We don't really care if this fails
-+      fcntl(fd, F_SETFD, FD_CLOEXEC);
-+      #endif
-+
-+      file_ = fdopen(fd, "a");  // Make a FILE*.
-+      if (file_ == NULL) {  // Man, we're screwed!, try to create new log file
-+           close(fd);
-+      } 
-+        inited_ = true;
++    CheckFileNumQuota();
++    const char* filename = file_list_.back().name.c_str();
++    int fd = open(filename, O_WRONLY | O_CREAT /* | O_EXCL */ | O_APPEND, 
0664);
++    if (fd != -1) {
++#ifdef HAVE_FCNTL
++      // Mark the file close-on-exec. We don't really care if this fails
++      fcntl(fd, F_SETFD, FD_CLOEXEC);
++#endif
++      file_ = fdopen(fd, "ra"); // Read and append a FILE*.
++      if (file_ == NULL) {      // Man, we're screwed!, try to create new log 
file
++        close(fd);
++      }
++      fseek(file_, 0, SEEK_END);
++      file_length_ = bytes_since_flush_ = ftell(file_);
++      inited_ = true;
 +    }
-+  }  
-+
++  }
++ 
    // If there's no destination file, make one before outputting
    if (file_ == NULL) {
      // Try to rollover the log file every 32 log messages.  The only time


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to