Package com.mckoi.database
Class MultiVersionTableIndices
- java.lang.Object
-
- com.mckoi.database.MultiVersionTableIndices
-
final class MultiVersionTableIndices extends java.lang.Object
This class manages a set of indices for a table over different versions. The indices include the list of rows (required), and any index data (optional). This object manages table indexes at multiple revision levels. When indexes are requested, what is returned is an isolated version of the current indexes. Index changes automatically create a new version and each version of the index found is isolated from any concurrent changes.This class is not thread safe, but it assumes thread safety by the callee. It is not safe for multi-threaded access.
-
-
Field Summary
Fields Modifier and Type Field Description private int
column_count
The number of columns in the referenced table.private java.lang.String
journal_count_stat_key
private TransactionSystem
system
The system object.private TableName
table_name
The name of the table.private java.util.ArrayList
transaction_mod_list
A list of MasterTableJournal objects that represent the changes that have occurred to this master index after various transactions have been committed.private long
TS_merge_count
private long
TS_merge_size
-
Constructor Summary
Constructors Constructor Description MultiVersionTableIndices(TransactionSystem system, TableName table_name, int column_count)
Constructs this object with the given number of column.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) void
addTransactionJournal(MasterTableJournal change)
Adds a transaction journal to the list of modifications on the indices kept here.DebugLogger
Debug()
Returns the DebugLogger object used to log debug messages.(package private) MasterTableJournal[]
findAllJournalsSince(long commit_id)
Returns a list of all MasterTableJournal objects that have been successfully committed against this table that have an 'commit_id' that is greater or equal to the given.(package private) boolean
hasTransactionChangesPending()
Returns true if this table has any journal modifications that have not yet been incorporated into master index.(package private) boolean
mergeJournalChanges(long commit_id)
Updates the master records from the journal logs up to the given 'commit_id'.(package private) java.lang.String
transactionChangeString()
Returns a string describing the transactions pending on this table.
-
-
-
Field Detail
-
table_name
private final TableName table_name
The name of the table.
-
column_count
private final int column_count
The number of columns in the referenced table.
-
system
private final TransactionSystem system
The system object.
-
transaction_mod_list
private java.util.ArrayList transaction_mod_list
A list of MasterTableJournal objects that represent the changes that have occurred to this master index after various transactions have been committed.This list can be used to build the indices and a table row enumerator for snapshots of the table at various transaction check points.
-
journal_count_stat_key
private java.lang.String journal_count_stat_key
-
TS_merge_count
private long TS_merge_count
-
TS_merge_size
private long TS_merge_size
-
-
Constructor Detail
-
MultiVersionTableIndices
MultiVersionTableIndices(TransactionSystem system, TableName table_name, int column_count)
Constructs this object with the given number of column.
-
-
Method Detail
-
Debug
public final DebugLogger Debug()
Returns the DebugLogger object used to log debug messages.
-
mergeJournalChanges
boolean mergeJournalChanges(long commit_id)
Updates the master records from the journal logs up to the given 'commit_id'. This could be a fairly expensive operation if there are a lot of modifications because each change could require a lookup of records in the data source.NOTE: It's extremely important that when this is called, there are no transactions open that are using the merged journal. If there is, then a transaction may be able to see changes in a table that were made after the transaction started.
Returns true if all journal changes were merged.
-
findAllJournalsSince
MasterTableJournal[] findAllJournalsSince(long commit_id)
Returns a list of all MasterTableJournal objects that have been successfully committed against this table that have an 'commit_id' that is greater or equal to the given.This is part of the conglomerate commit check phase and will be on a commit_lock.
-
addTransactionJournal
void addTransactionJournal(MasterTableJournal change)
Adds a transaction journal to the list of modifications on the indices kept here.
-
hasTransactionChangesPending
boolean hasTransactionChangesPending()
Returns true if this table has any journal modifications that have not yet been incorporated into master index.
-
transactionChangeString
java.lang.String transactionChangeString()
Returns a string describing the transactions pending on this table.
-
-