deephaven_enterprise.checkpoint_control

Examine and repair table checkpoint records from a Core+ Python worker.

Checkpoint records (table.size files) describe the state of a table location on disk. This module reports on - and optionally repairs - locations that are not directories, are empty directories, or whose checkpoint record is missing or out of date. It is the scripting equivalent of dhconfig checkpoint repair.

Nothing is modified unless force=True is passed; by default problems are only reported.

Simple usage:

from deephaven_enterprise.checkpoint_control import repair_table

result = repair_table("MyNamespace", "MyTable")
print(result)

if result.summary_status is not RepairStatus.OK:
    result = repair_table("MyNamespace", "MyTable", force=True)
    print(result)

Bulk usage:

from deephaven_enterprise.checkpoint_control import repair_namespace_set, repair_all

print(repair_namespace_set("User", force=True))
print(repair_all())

Module Contents

class CheckpointRepairResult(j_checkpoint_repair_result)[source]

Bases: deephaven._wrapper.JObjectWrapper

Aggregate result of a checkpoint repair operation.

Parameters:

j_checkpoint_repair_result (jpy.JType)

property force: bool[source]

True if the operation was allowed to make changes.

Return type:

bool

property location_results: tuple[LocationResult, ...][source]

The LocationResult for every location that had a problem, in the order encountered. Locations without problems are not reported.

Return type:

tuple[LocationResult, …]

property locations_inspected: int[source]

The number of table locations that were inspected, including those without problems.

Return type:

int

property metadata_index_affected: bool[source]

True if any reported location belongs to a System historical table, whose locations may be tracked by a metadata index. When True, rebuild the index for the affected tables with dhctl metadata update once the locations are repaired.

Return type:

bool

property summary_status: RepairStatus[source]

Summary RepairStatus across all reported locations - the worst status reported, or RepairStatus.OK when no problems were found.

Return type:

RepairStatus

property tables_inspected: int[source]

The number of tables that were selected and inspected.

Return type:

int

class LocationResult(j_location_result)[source]

Bases: deephaven._wrapper.JObjectWrapper

The problem found at a single table location, and what was done about it.

Parameters:

j_location_result (jpy.JType)

property issue: RepairIssue[source]

The RepairIssue that was found.

Return type:

RepairIssue

property message: str[source]

A human-readable description of the problem and the action taken.

Return type:

str

property namespace: str[source]

The namespace of the table that owns the location.

Return type:

str

property path: str | None[source]

The absolute path of the location, or None when the whole table could not be inspected.

Return type:

Optional[str]

property status: RepairStatus[source]

The RepairStatus describing what was done about the problem.

Return type:

RepairStatus

property table_name: str[source]

The name of the table that owns the location.

Return type:

str

class RepairIssue(*args, **kwds)[source]

Bases: enum.Enum

The kind of problem found at a table location.

DEFINITION_UNAVAILABLE[source]

The table’s schema could not be read, so none of its locations could be inspected.

EMPTY[source]

The location is an empty directory; it should be deleted.

MISSING_CHECKPOINT_RECORD[source]

The location has no checkpoint record; one should be generated.

NOT_A_DIRECTORY[source]

The location exists but is not a directory; it should be deleted.

OUTDATED_CHECKPOINT_RECORD[source]

The location’s checkpoint record predates the current version; it should be upgraded.

class RepairStatus(*args, **kwds)[source]

Bases: enum.Enum

Outcome for a single table location. Also used as the summary across all reported locations, in which case it is the worst status reported.

FAILED[source]

A problem was found, and the attempt to repair it failed.

FLAGGED[source]

A problem was found but not acted on, because force was not set.

OK[source]

No problem was found, or (as a summary) no problem was found anywhere.

REPAIRED[source]

A problem was found and repaired.

repair(*, tables=(), namespaces=(), namespace_sets=(), force=False)[source]

Report on (and, with force=True, repair) the checkpoint records of the selected tables.

The three selections are unioned, and at least one of them must be non-empty.

Parameters:
  • tables (Iterable[tuple[str, str]]) – (namespace, table_name) pairs naming individual tables to inspect.

  • namespaces (Iterable[str]) – Namespaces whose every table should be inspected.

  • namespace_sets (Iterable[str]) – Namespace set names ("System" or "User", case-insensitive) whose every namespace’s every table should be inspected.

  • force (bool) – If True, perform the repairs. If False (the default), only report problems.

Returns:

The CheckpointRepairResult reported by the underlying Java call.

Raises:

DHError – If nothing was selected, a selected namespace or table does not exist, or the underlying Java call raises.

Return type:

CheckpointRepairResult

Example:

result = repair(
    tables=[("MyNamespace", "MyTable")], namespaces=["OtherNamespace"], force=True
)
print(result)
repair_all(*, force=False)[source]

Report on (and, with force=True, repair) the checkpoint records of every table in every namespace.

Parameters:

force (bool) – If True, perform the repairs. If False (the default), only report problems.

Returns:

The CheckpointRepairResult reported by the underlying Java call.

Raises:

DHError – If the underlying Java call raises.

Return type:

CheckpointRepairResult

Example:

result = repair_all()
print(result)
repair_namespace(namespace, *, force=False)[source]

Report on (and, with force=True, repair) the checkpoint records of every table in a namespace.

Parameters:
  • namespace (str) – The namespace whose tables should be inspected.

  • force (bool) – If True, perform the repairs. If False (the default), only report problems.

Returns:

The CheckpointRepairResult reported by the underlying Java call.

Raises:

DHError – If the namespace does not exist or has no tables, or the underlying Java call raises.

Return type:

CheckpointRepairResult

Example:

result = repair_namespace("MyNamespace")
print(result)
repair_namespace_set(namespace_set, *, force=False)[source]

Report on (and, with force=True, repair) the checkpoint records of every table in a namespace set.

Parameters:
  • namespace_set (str) – The namespace set name, "System" or "User", case-insensitive.

  • force (bool) – If True, perform the repairs. If False (the default), only report problems.

Returns:

The CheckpointRepairResult reported by the underlying Java call.

Raises:

DHError – If the name does not match a namespace set, or the underlying Java call raises.

Return type:

CheckpointRepairResult

Example:

result = repair_namespace_set("User", force=True)
print(result)
repair_table(namespace, table_name, *, force=False)[source]

Report on (and, with force=True, repair) the checkpoint records of a single table.

Parameters:
  • namespace (str) – The namespace of the table to inspect.

  • table_name (str) – The name of the table to inspect.

  • force (bool) – If True, perform the repairs. If False (the default), only report problems.

Returns:

The CheckpointRepairResult reported by the underlying Java call.

Raises:

DHError – If the table does not exist, or the underlying Java call raises.

Return type:

CheckpointRepairResult

Example:

result = repair_table("MyNamespace", "MyTable", force=True)
print(result)