Skip to content

Commit

Permalink
Fix inappropriate shard will cause base64 decode error (#1383)
Browse files Browse the repository at this point in the history
* Fix shard start is 0 will cause base64 decode error

Change-Id: Ibc90df4e792b00222d41806fee769082545dea40
  • Loading branch information
Linary authored and javeme committed Mar 29, 2021
1 parent a495eea commit 61466d6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,9 @@ public List<Shard> getSplits(Session session, long splitSize) {
long maxKey = this.maxKey();
double each = maxKey / count;

long offset = 0L;
String last = this.position(offset);
List<Shard> splits = new ArrayList<>((int) count);
String last = START;
long offset = 0L;
while (offset < maxKey) {
offset += each;
if (offset > maxKey) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ public long estimateNumKeys(Session session) {

@Override
public byte[] position(String position) {
if (END.equals(position)) {
if (START.equals(position) || END.equals(position)) {
return null;
}
return StringEncoding.decodeBase64(position);
Expand Down

0 comments on commit 61466d6

Please sign in to comment.