-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed previous offset #7
base: final-connector-ybdb
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,7 +60,7 @@ private YugabyteDBOffsetContext(YugabyteDBConnectorConfig connectorConfig, | |
// sourceInfo.update(lsn, time, txId, null, sourceInfo.xmin()); | ||
sourceInfo.updateLastCommit(lastCommitLsn); | ||
sourceInfoSchema = sourceInfo.schema(); | ||
|
||
this.lastSnapshotRecord = lastSnapshotRecord; | ||
if (this.lastSnapshotRecord) { | ||
postSnapshotCompletion(); | ||
|
@@ -79,6 +79,8 @@ public YugabyteDBOffsetContext(Set<YugabyteDBOffsetContext> s, | |
this.sourceInfoSchema = sourceInfo.schema(); | ||
for (YugabyteDBOffsetContext context : s) { | ||
if (context != null) { | ||
this.lastCompletelyProcessedLsn = context.lastCompletelyProcessedLsn; | ||
this.lastCommitLsn = context.lastCommitLsn; | ||
LOGGER.debug("Populating the tabletsourceinfo" + context.getTabletSourceInfo()); | ||
if (context.getTabletSourceInfo() != null) { | ||
this.tabletSourceInfo.putAll(context.getTabletSourceInfo()); | ||
|
@@ -273,7 +275,8 @@ public String toString() { | |
+ ", lastCommitLsn=" + lastCommitLsn | ||
+ ", streamingStoppingLsn=" + streamingStoppingLsn | ||
+ ", transactionContext=" + transactionContext | ||
+ ", incrementalSnapshotContext=" + incrementalSnapshotContext + "]"; | ||
+ ", incrementalSnapshotContext=" + incrementalSnapshotContext | ||
+ ", tabletSourceInfo=" + tabletSourceInfo + "]"; | ||
} | ||
|
||
public OffsetState asOffsetState() { | ||
|
@@ -333,7 +336,7 @@ private String readOptionalString(Map<String, ?> offset, String key) { | |
public YugabyteDBOffsetContext load(Map<String, ?> offset) { | ||
|
||
LOGGER.debug("The offset being loaded in YugabyteDBOffsetContext.. " + offset); | ||
|
||
OpId opid1 = OpId.valueOf((String) offset.get(YugabyteDBOffsetContext.LAST_COMPLETELY_PROCESSED_LSN_KEY)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use a better variable name |
||
/* | ||
* final OpId lsn = OpId.valueOf(readOptionalString(offset, SourceInfo.LSN_KEY)); | ||
* final OpId lastCompletelyProcessedLsn = OpId.valueOf(readOptionalString(offset, | ||
|
@@ -355,9 +358,9 @@ public YugabyteDBOffsetContext load(Map<String, ?> offset) { | |
*/ | ||
|
||
return new YugabyteDBOffsetContext(connectorConfig, | ||
new OpId(0, 0, null, 0, 0), | ||
new OpId(0, 0, null, 0, 0), | ||
new OpId(0, 0, null, 0, 0), | ||
opid1, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What happens when there is no offset loaded? |
||
opid1, | ||
opid1, | ||
"txId", Instant.MIN, false, false, | ||
TransactionContext.load(offset), | ||
SignalBasedIncrementalSnapshotContext.load(offset)); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -278,6 +278,9 @@ private void getChanges2(ChangeEventSourceContext context, | |
for (Pair<String, String> entry : tabletPairList) { | ||
final String tabletId = entry.getValue(); | ||
offsetContext.initSourceInfo(tabletId, this.connectorConfig); | ||
if(offsetContext.lsn(tabletId).equals(new OpId(0,0,null,0,0))){ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Check formatting, if we init then lsn will always be new OpId(0,0,null,0,0)). |
||
offsetContext.getSourceInfo(tabletId).updateLastCommit(offsetContext.lastCompletelyProcessedLsn()); | ||
} | ||
} | ||
LOGGER.debug("The init tabletSourceInfo is " + offsetContext.getTabletSourceInfo()); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why extra space?