Skip to content
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

[logsearchapi] Make partition table creation more reliable #374

Merged
merged 1 commit into from
Dec 1, 2020
Merged
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
10 changes: 5 additions & 5 deletions logsearchapi/server/partitions.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,14 +244,14 @@ func (c *DBClient) vacuumData(diskCapacityGBs int) {
}

func (c *DBClient) partitionTables() {
checkInterval := 12 * time.Hour
checkInterval := 1 * time.Hour
bgCtx := context.Background()
tables := []Table{auditLogEventsTable, requestInfoTable}
for {
// Check if the partition table to store audit logs 12hrs from now exists
halfDayLater := time.Now().Add(12 * time.Hour)
// Check if the partition table to store audit logs 24hrs from now exists
aDayLater := time.Now().Add(24 * time.Hour)
for _, table := range tables {
partitionExists, err := c.checkPartitionTableExists(bgCtx, table.Name, halfDayLater)
partitionExists, err := c.checkPartitionTableExists(bgCtx, table.Name, aDayLater)
log.Printf("Error while checking if partition for %s exists %s", table.Name, err)
if partitionExists {
continue
Expand All @@ -262,7 +262,7 @@ func (c *DBClient) partitionTables() {
}
}

// Check again after 12hrs
// Check again after `checkInterval` hrs
time.Sleep(checkInterval)
}
}