Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ private long tryLock() {

if (!tableEntries.containsKey(tableName)) {
try {
String now = new Timestamp(Instant.now().getEpochSecond()).toString();
String now = new Timestamp(Instant.now().toEpochMilli()).toString();
statement.executeUpdate("INSERT INTO "
+ YugabyteDBDatabase.LOCK_TABLE_NAME
+ " VALUES ('" + tableName + "', 0, '" + now + "')");
Expand Down Expand Up @@ -116,7 +116,7 @@ private long tryLock() {
if (rs.next()) {
lockIdRead = rs.getLong("lock_id");
Timestamp tsRead = rs.getTimestamp("ts");
String current = new Timestamp(Instant.now().getEpochSecond()).toString();
String current = new Timestamp(Instant.now().toEpochMilli()).toString();
long lockIdTtl = DEFAULT_LOCK_ID_TTL;
String sysProp = System.getProperty(LOCK_ID_TTL_SYS_PROP_NAME);
if (sysProp != null) {
Expand All @@ -128,7 +128,7 @@ private long tryLock() {
}
}

if (lockIdRead == 0 || Instant.now().getEpochSecond() - tsRead.getTime() > lockIdTtl) {
if (lockIdRead == 0 || Instant.now().toEpochMilli() - tsRead.getTime() > lockIdTtl) {
lockIdToBeReturned = random.nextLong();
if (lockIdRead == 0) {
LOG.debug(Thread.currentThread().getName() + "> Setting lock_id = " + lockIdToBeReturned);
Expand Down