orientechnologies / orientdb

OrientDB is the most versatile DBMS supporting Graph, Document, Reactive, Full-Text and Geospatial models in one Multi-Model product. OrientDB can run distributed (Multi-Master), supports SQL, ACID Transactions, Full-Text indexing and Reactive Queries.
https://orientdb.dev
Apache License 2.0
4.76k stars 872 forks source link

Make schema changes transactional in plocal #1649

Open andrii0lomakin opened 11 years ago

andrii0lomakin commented 11 years ago

In plocal storage it is relatively simple to make schema changes transnational. Document changes are transnational now, so we need only to add log messages related to file/cluster creation which will be rolled back or committed during transaction rollback/commit accordingly.

This change allow completely align blueprints and OrientDB models.

lvca commented 11 years ago

In theory we could store the sql command as payload. I was thinking to other stuff like "alter database dateformat yyyy-MM-dd". If we had such log we could totally remove the server's log used in replication!

andrii0lomakin commented 11 years ago

SQL commands, does not work on data store level. For example if server fails in the middle of SQL command execution, it can not be restored from failed state using such approach. In order to support durability feature all operations should be logged on disk operations level (or more precisely on disk cache level). Also all SQL commands are translated in record changes, so such commands like ""alter database dateformat " which causes code:

case DATETIMEFORMAT:
  storage.getConfiguration().dateTimeFormat = stringValue;
  storage.getConfiguration().update();
  break;

public void update() throws OSerializationException { final byte[] record = toStream(); storage .updateRecord(CONFIG_RID, record, OVersionFactory.instance().createUntrackedVersion(), ORecordBytes.RECORD_TYPE, 0, null); }

are already durable and transactional in plocal storage.

The only problem is cluster creation, truncation and deletion. If we add log events for this type of actions they will be durable too. But all "alter database" commands are transactional now, that is why I thought about moving auto sharding solution from storage level to cluster level (in https://github.com/orientechnologies/orientdb/issues/1600 issue).

lvca commented 11 years ago

:+1:

andrii0lomakin commented 11 years ago

))

giastfader commented 10 years ago

Hi guys, any news about this proposal?

Thanks