Skip to content

Commit

Permalink
refactor: rename in test cases
Browse files Browse the repository at this point in the history
Signed-off-by: Sean Kao <[email protected]>
  • Loading branch information
seankao-az committed Mar 26, 2024
1 parent 6495de7 commit d610156
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 76 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -437,12 +437,10 @@ class FlintSpark(val spark: SparkSession) extends Logging {

private def updateIndexAutoToManual(index: FlintSparkIndex): Option[String] = {
val indexName = index.name
// TODO: what if index from api user is not constructed with Builder.copyWithUpdate?
val indexLogEntry = index.latestLogEntry.get
flintClient
.startTransaction(indexName, dataSourceName)
.initialLog(latest =>
// TODO: in the future should use another lock to protect entire process and not rely on this
latest.state == REFRESHING && latest.seqNo == indexLogEntry.seqNo && latest.primaryTerm == indexLogEntry.primaryTerm)
.transientLog(latest => latest.copy(state = UPDATING))
.finalLog(latest => latest.copy(state = ACTIVE))
Expand All @@ -457,13 +455,11 @@ class FlintSpark(val spark: SparkSession) extends Logging {

private def updateIndexManualToAuto(index: FlintSparkIndex): Option[String] = {
val indexName = index.name
// TODO: what if index from api user is not constructed with Builder.copyWithUpdate?
val indexLogEntry = index.latestLogEntry.get
val indexRefresh = FlintSparkIndexRefresh.create(indexName, index)
flintClient
.startTransaction(indexName, dataSourceName)
.initialLog(latest =>
// TODO: in the future should use another lock to protect entire process and not rely on this
latest.state == ACTIVE && latest.seqNo == indexLogEntry.seqNo && latest.primaryTerm == indexLogEntry.primaryTerm)
.transientLog(latest =>
latest.copy(state = UPDATING, createTime = System.currentTimeMillis()))
Expand Down
Loading

0 comments on commit d610156

Please sign in to comment.