Skip to content

Commit 36de9c6

Browse files
committed
Revert parts of commit e14d363
1 parent a700003 commit 36de9c6

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

library/Vspheredb/Daemon/DbLogger.php

+1-7
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ class DbLogger implements LogWriterWithContext, EventEmitterInterface
3131

3232
protected $pid;
3333

34-
protected $lastTs = null;
35-
3634
public function __construct($instanceUuid, $fqdn, $pid)
3735
{
3836
$this->instance = $instanceUuid;
@@ -57,10 +55,6 @@ public function write($level, $message, $context = [])
5755
return;
5856
}
5957
$timestamp = Util::currentTimestamp();
60-
while ($timestamp <= $this->lastTs) {
61-
$timestamp++;
62-
}
63-
$this->lastTs = $timestamp;
6458

6559
if ($this->db === null) {
6660
$this->queue->push([
@@ -85,7 +79,7 @@ protected function reallyWrite($timestamp, $level, $message, $context = [])
8579
'instance_uuid' => $this->instance,
8680
'ts_create' => $timestamp,
8781
'pid' => $this->pid,
88-
'fqdn' => $this->fqdn,
82+
'fqdn' => $this->fqdn,
8983
'level' => $level,
9084
'message' => $message,
9185
];

schema/mysql-migrations/upgrade_59.sql

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
1-
ALTER TABLE vspheredb_daemonlog
2-
ADD PRIMARY KEY (instance_uuid, ts_create);
1+
-- The addition of a primary key on (instance_uuid, ts_create) will not be applied for now.
2+
-- This is due to the possibility of existing duplicates in the table, which could result in
3+
-- errors if the key were added to already populated tables. The comment helps track this change
4+
-- for people who might not be on the latest release but instead are using the master branch,
5+
-- and might have already imported the current state of the table before the key is added.
6+
7+
-- ALTER TABLE vspheredb_daemonlog
8+
-- ADD PRIMARY KEY (instance_uuid, ts_create);
39

410
INSERT INTO vspheredb_schema_migration
511
(schema_version, migration_time)

schema/mysql.sql

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ CREATE TABLE vspheredb_daemonlog (
9191
'emergency'
9292
) NOT NULL,
9393
message MEDIUMTEXT NOT NULL,
94-
PRIMARY KEY (instance_uuid, ts_create),
94+
-- PRIMARY KEY (instance_uuid, ts_create),
9595
INDEX idx_time (ts_create)
9696
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin;
9797

0 commit comments

Comments
 (0)