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

yangzhg pushed a commit to branch bdbje
in repository https://gitbox.apache.org/repos/asf/doris-thirdparty.git

commit 284830b22b0dc8cefbeef81c3002e97faa2dff01
Author: Zhengguo Yang <yangz...@gmail.com>
AuthorDate: Wed Aug 3 17:09:09 2022 +0800

    patch bdbje
---
 .gitignore                                    |  84 ++++++++++++
 README.md                                     |   5 +
 pom.xml                                       | 190 ++++++++++++++++++++++++++
 src/com/sleepycat/je/dbi/EnvironmentImpl.java |   4 +
 src/com/sleepycat/je/log/LogManager.java      |   3 +
 src/com/sleepycat/je/rep/impl/RepImpl.java    |   5 +
 src/com/sleepycat/je/rep/vlsn/VLSNIndex.java  |  20 ++-
 7 files changed, 309 insertions(+), 2 deletions(-)

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..e9e224c
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,84 @@
+##############################
+## Java
+##############################
+.mtj.tmp/
+*.class
+*.jar
+*.war
+*.ear
+*.nar
+hs_err_pid*
+
+##############################
+## Maven
+##############################
+target/
+pom.xml.tag
+pom.xml.releaseBackup
+pom.xml.versionsBackup
+pom.xml.next
+pom.xml.bak
+release.properties
+dependency-reduced-pom.xml
+buildNumber.properties
+.mvn/timing.properties
+.mvn/wrapper/maven-wrapper.jar
+
+##############################
+## Gradle
+##############################
+bin/
+build/
+.gradle
+.gradletasknamecache
+gradle-app.setting
+!gradle-wrapper.jar
+
+##############################
+## IntelliJ
+##############################
+out/
+.idea/
+.idea_modules/
+*.iml
+*.ipr
+*.iws
+
+##############################
+## Eclipse
+##############################
+.settings/
+bin/
+tmp/
+.metadata
+.classpath
+.project
+*.tmp
+*.bak
+*.swp
+*~.nib
+local.properties
+.loadpath
+.factorypath
+
+##############################
+## NetBeans
+##############################
+nbproject/private/
+build/
+nbbuild/
+dist/
+nbdist/
+nbactions.xml
+nb-configuration.xml
+
+##############################
+## Visual Studio Code
+##############################
+.vscode/
+.code-workspace
+
+##############################
+## OS X
+##############################
+.DS_Store
\ No newline at end of file
diff --git a/README.md b/README.md
index 6b446cb..14f209d 100644
--- a/README.md
+++ b/README.md
@@ -27,3 +27,8 @@ Berkley Database Java Edition - build and runtime support.
 | Source code  | 
http://www.oracle.com/technetwork/database/database-technologies/nosqldb/downloads/index.html
 |
 | Organization | Oracle Corporation                                           |
 | Developers   | Oracle Corporation                                           |
+
+# Alternatives
+
+A fork of com.sleepycat:je:18.3.12 from 
[bdbje](https://repo1.maven.org/maven2/com/sleepycat/je/18.3.12/je-18.3.12-sources.jar),
 Applied patches from [StarRocks bdbje](https://github.com/StarRocks/bdb-je/).
+Because of  StarRocks bdbje based on version 7.x, Apache Doris use bdbje  base 
on version 18.x.  So cannot use StarRocks bdb-je directly.
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..c377413
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,190 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0";
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache</groupId>
+        <artifactId>apache</artifactId>
+        <version>23</version>
+    </parent>
+    <groupId>org.apache.doris</groupId>
+    <artifactId>je</artifactId>
+    <version>18.3.12-doris</version>
+    <name>bdb-je apache doris release</name>
+    <url>https://doris.apache.org/</url>
+    <description>fork from bdb-je 18.3.12 from maven with starrocks bdbje 
patches</description>
+    <licenses>
+        <license>
+            <name>Apache 2.0 License</name>
+            <url>https://www.apache.org/licenses/LICENSE-2.0.html</url>
+            <distribution>repo</distribution>
+        </license>
+    </licenses>
+    <scm>
+        
<connection>scm:git:https://g...@github.com/apache/doris-thirdparty.git</connection>
+        
<developerConnection>scm:git:https://g...@github.com/apache/doris-thirdparty.git</developerConnection>
+        <url>scm:git:https://g...@github.com/apache/doris-thirdparty.git</url>
+        <tag>HEAD</tag>
+    </scm>
+    <issueManagement>
+        <system>GitHub</system>
+        <url>https://github.com/apache/doris/issues</url>
+    </issueManagement>
+    <mailingLists>
+        <mailingList>
+            <name>Dev Mailing List</name>
+            <post>d...@doris.apache.org</post>
+            <subscribe>dev-subscr...@doris.apache.org</subscribe>
+            <unsubscribe>dev-unsubscr...@doris.apache.org</unsubscribe>
+        </mailingList>
+        <mailingList>
+            <name>Commits Mailing List</name>
+            <post>commits@doris.apache.org</post>
+            <subscribe>commits-subscr...@doris.apache.org</subscribe>
+            <unsubscribe>commits-unsubscr...@doris.apache.org</unsubscribe>
+        </mailingList>
+    </mailingLists>
+    <dependencies>
+        <dependency>
+            <groupId>javax.resource</groupId>
+            <artifactId>connector</artifactId>
+            <version>1.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.ant</groupId>
+            <artifactId>ant</artifactId>
+            <version>1.10.12</version>
+        </dependency>
+        <dependency>
+            <groupId>org.checkerframework</groupId>
+            <artifactId>checker</artifactId>
+            <version>3.22.2</version>
+        </dependency>
+        <dependency>
+            <groupId>org.checkerframework</groupId>
+            <artifactId>checker-qual</artifactId>
+            <version>3.22.2</version>
+        </dependency>
+        <dependency>
+            <groupId>sun.jdk</groupId>
+            <artifactId>jconsole</artifactId>
+            <version>jdk</version>
+            <scope>system</scope>
+            <systemPath>${java.home}/../lib/jconsole.jar</systemPath>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.12</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+    <properties>
+        <maven.compiler.source>8</maven.compiler.source>
+        <maven.compiler.target>8</maven.compiler.target>
+    </properties>
+    <build>
+        <plugins>
+            <plugin>
+                <artifactId>maven-clean-plugin</artifactId>
+                <version>3.0.0</version>
+                <configuration>
+                    <filesets>
+                        <fileset>
+                            <directory>./target/</directory>
+                            <includes>
+                                <include>${artifactId}*.jar</include>
+                            </includes>
+                            <followSymlinks>false</followSymlinks>
+                        </fileset>
+                    </filesets>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jar-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>default-jar</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>jar</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+                    <archive>
+                        <manifest>
+                            
<mainClass>com.sleepycat.je.utilint.JarMain</mainClass>
+                        </manifest>
+                    </archive>
+                    <outputDirectory>./target/</outputDirectory>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-javadoc-plugin</artifactId>
+                <configuration>
+                    <source>8</source>
+                    <attach>true</attach>
+                </configuration>
+                <executions>
+                    <execution>
+                        <id>attach-javadocs</id>
+                        <goals>
+                            <goal>jar</goal>
+                        </goals>
+                        <configuration>
+                            <additionalparam>-Xdoclint:none</additionalparam>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-source-plugin</artifactId>
+                <configuration>
+                    <attach>true</attach>
+                </configuration>
+                <executions>
+                    <execution>
+                        <phase>compile</phase>
+                        <goals>
+                            <goal>jar</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-gpg-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>sign-artifacts</id>
+                        <phase>verify</phase>
+                        <goals>
+                            <goal>sign</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>1.8</source>
+                    <target>1.8</target>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+    <repositories>
+        <repository>
+            <!-- for Javax.resource/connector -->
+            <id>Grails Core</id>
+            <url>https://repo.grails.org/grails/core/</url>
+        </repository>
+    </repositories>
+</project>
\ No newline at end of file
diff --git a/src/com/sleepycat/je/dbi/EnvironmentImpl.java 
b/src/com/sleepycat/je/dbi/EnvironmentImpl.java
index 262c59b..63e3b75 100644
--- a/src/com/sleepycat/je/dbi/EnvironmentImpl.java
+++ b/src/com/sleepycat/je/dbi/EnvironmentImpl.java
@@ -3956,4 +3956,8 @@ public class EnvironmentImpl implements EnvConfigObserver 
{
                 this, restoreRequired.toString());
         }
     }
+
+    // only used for RepImpl
+    public void setReplicaLatestVLSNSeq(long seq) {
+    }
 }
diff --git a/src/com/sleepycat/je/log/LogManager.java 
b/src/com/sleepycat/je/log/LogManager.java
index c286b67..9ddfa84 100644
--- a/src/com/sleepycat/je/log/LogManager.java
+++ b/src/com/sleepycat/je/log/LogManager.java
@@ -568,6 +568,9 @@ public class LogManager {
                 vlsn = envImpl.assignVLSNs(params.entry);
             } else {
                 vlsn = params.repContext.getClientVLSN();
+                if (params.repContext.inReplicationStream()) {
+                    envImpl.setReplicaLatestVLSNSeq(vlsn.getSequence());
+                }
             }
         } else {
             vlsn = null;
diff --git a/src/com/sleepycat/je/rep/impl/RepImpl.java 
b/src/com/sleepycat/je/rep/impl/RepImpl.java
index ea547c8..934ce3b 100644
--- a/src/com/sleepycat/je/rep/impl/RepImpl.java
+++ b/src/com/sleepycat/je/rep/impl/RepImpl.java
@@ -2373,6 +2373,11 @@ public class RepImpl
         return false;
     }
 
+    @Override
+    public void setReplicaLatestVLSNSeq(long seq) {
+        vlsnIndex.setReplicaLatestVLSNSeq(seq);
+    }
+
     public void setAuthenticator(StreamAuthenticator authenticator) {
         this.authenticator = authenticator;
     }
diff --git a/src/com/sleepycat/je/rep/vlsn/VLSNIndex.java 
b/src/com/sleepycat/je/rep/vlsn/VLSNIndex.java
index 6d5a728..d9238ad 100644
--- a/src/com/sleepycat/je/rep/vlsn/VLSNIndex.java
+++ b/src/com/sleepycat/je/rep/vlsn/VLSNIndex.java
@@ -359,6 +359,11 @@ public class VLSNIndex {
      */
     private AtomicLong nextVLSNCounter;
 
+    /*
+     * For replica node to record the latest vlsn seq copied from master
+     */
+    private volatile long replicaLatestVLSNSeq = VLSN.NULL_VLSN_SEQUENCE;
+
     /*
      * For storing the persistent version of the VLSNIndex. For keys > 0,
      * the key is the VLSN sequence number, data = VLSNBucket. Key = -1 has
@@ -456,6 +461,7 @@ public class VLSNIndex {
                 new AtomicLong(0);
         } else {
             nextVLSNCounter = new AtomicLong(last.getSequence());
+            replicaLatestVLSNSeq = VLSN.NULL_VLSN_SEQUENCE;
         }
     }
 
@@ -476,6 +482,7 @@ public class VLSNIndex {
 
         putWaitVLSN = null;
         nextVLSNCounter = null;
+        replicaLatestVLSNSeq = VLSN.UNINITIALIZED_VLSN_SEQUENCE;
     }
 
     /*
@@ -487,7 +494,15 @@ public class VLSNIndex {
     }
 
     public long getLatestAllocatedVal() {
-        return nextVLSNCounter.get();
+        if (nextVLSNCounter !=null ) {
+            return nextVLSNCounter.get();
+        } else {
+            return replicaLatestVLSNSeq;
+        }
+    }
+
+    public void setReplicaLatestVLSNSeq(long seq) {
+        replicaLatestVLSNSeq = seq;
     }
 
     /*
@@ -2137,7 +2152,8 @@ public class VLSNIndex {
     public void awaitConsistency() {
 
         /* VLSNIndex is not initialized and in use yet, no need to wait. */
-        if (nextVLSNCounter == null) {
+        /* VLSNIndex is not initialized and in use yet, no need to wait. */
+        if (nextVLSNCounter == null && replicaLatestVLSNSeq == 
VLSN.NULL_VLSN_SEQUENCE) {
             return;
         }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to