Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into dev
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/main/resources/.version
  • Loading branch information
leonchen83 committed Jul 15, 2024
2 parents cf5fe7c + f3fba93 commit 001079a
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 16 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### 0.9.6

Fix `rdt` convert db bug.

### 0.9.5

Fix full sync offset bug. this bug could cause losing data in reconnection
Expand Down
2 changes: 1 addition & 1 deletion DockerfileNative
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM springci/graalvm-ce:java11-0.12.x AS builder

ARG MAVEN_VERSION=3.9.4
ARG MAVEN_VERSION=3.9.8
ARG BASE_URL=https://ftp.yz.yamagata-u.ac.jp/pub/network/apache/maven/maven-3/${MAVEN_VERSION}/binaries

WORKDIR /app
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,29 +125,39 @@ public DB applySelectDB(RedisInputStream in, int version) throws IOException {
}
} else {
// skip
DB prev;
listener.setGuard(Guard.PASS);
try {
super.applySelectDB(in, version);
prev = super.applySelectDB(in, version);
} finally {
listener.setGuard(Guard.SAVE);
}

// convert
listener.setGuard(Guard.DRAIN);
try {
BaseRdbEncoder encoder = new BaseRdbEncoder();
byte[] db = encoder.rdbSaveLen(goal);
// type
listener.handle((byte) RDB_OPCODE_SELECTDB);
// db
listener.handle(db);
return new DB(goal);
} finally {
listener.setGuard(Guard.SAVE);
// save
if (filter.contains(prev.getDbNumber())) {
return generateDB(prev.getDbNumber(), goal);
} else {
return generateDB(prev.getDbNumber(), prev.getDbNumber());
}
}
}


private DB generateDB(long prev, long next) throws IOException {
listener.setGuard(Guard.DRAIN);
try {
BaseRdbEncoder encoder = new BaseRdbEncoder();
byte[] db = encoder.rdbSaveLen(next);
// type
listener.handle((byte) RDB_OPCODE_SELECTDB);
// db
listener.handle(db);

// set prev db number to avoid filter wrong data.
return new DB(prev);
} finally {
listener.setGuard(Guard.SAVE);
}
}

@Override
public DB applyResizeDB(RedisInputStream in, int version, ContextKeyValuePair context) throws IOException {
listener.setGuard(Guard.DRAIN);
Expand Down

0 comments on commit 001079a

Please sign in to comment.